Skip to content

Commit 54e1130

Browse files
committed
Merge branch 'x86-build-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 build changes from Ingo Molnar: "Two small changes" * 'x86-build-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86, defconfig: Add DEVTMPFS and DEVTMPFS_MOUNT to *86*_defconfig x86, build: move build output statistics away from stderr
2 parents 014d595 + 7f71be4 commit 54e1130

4 files changed

Lines changed: 30 additions & 17 deletions

File tree

arch/x86/boot/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ GCOV_PROFILE := n
7171
$(obj)/bzImage: asflags-y := $(SVGA_MODE)
7272

7373
quiet_cmd_image = BUILD $@
74-
cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/zoffset.h > $@
74+
cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin \
75+
$(obj)/zoffset.h $@
7576

7677
$(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE
7778
$(call if_changed,image)

arch/x86/boot/tools/build.c

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
*/
66

77
/*
8-
* This file builds a disk-image from two different files:
8+
* This file builds a disk-image from three different files:
99
*
1010
* - setup: 8086 machine code, sets up system parm
1111
* - system: 80386 code for actual system
12+
* - zoffset.h: header with ZO_* defines
1213
*
13-
* It does some checking that all files are of the correct type, and
14-
* just writes the result to stdout, removing headers and padding to
15-
* the right amount. It also writes some system data to stderr.
14+
* It does some checking that all files are of the correct type, and writes
15+
* the result to the specified destination, removing headers and padding to
16+
* the right amount. It also writes some system data to stdout.
1617
*/
1718

1819
/*
@@ -136,7 +137,7 @@ static void die(const char * str, ...)
136137

137138
static void usage(void)
138139
{
139-
die("Usage: build setup system [zoffset.h] [> image]");
140+
die("Usage: build setup system zoffset.h image");
140141
}
141142

142143
#ifdef CONFIG_EFI_STUB
@@ -265,7 +266,7 @@ int main(int argc, char ** argv)
265266
int c;
266267
u32 sys_size;
267268
struct stat sb;
268-
FILE *file;
269+
FILE *file, *dest;
269270
int fd;
270271
void *kernel;
271272
u32 crc = 0xffffffffUL;
@@ -280,10 +281,13 @@ int main(int argc, char ** argv)
280281
startup_64 = 0x200;
281282
#endif
282283

283-
if (argc == 4)
284-
parse_zoffset(argv[3]);
285-
else if (argc != 3)
284+
if (argc != 5)
286285
usage();
286+
parse_zoffset(argv[3]);
287+
288+
dest = fopen(argv[4], "w");
289+
if (!dest)
290+
die("Unable to write `%s': %m", argv[4]);
287291

288292
/* Copy the setup code */
289293
file = fopen(argv[1], "r");
@@ -318,7 +322,7 @@ int main(int argc, char ** argv)
318322
/* Set the default root device */
319323
put_unaligned_le16(DEFAULT_ROOT_DEV, &buf[508]);
320324

321-
fprintf(stderr, "Setup is %d bytes (padded to %d bytes).\n", c, i);
325+
printf("Setup is %d bytes (padded to %d bytes).\n", c, i);
322326

323327
/* Open and stat the kernel file */
324328
fd = open(argv[2], O_RDONLY);
@@ -327,7 +331,7 @@ int main(int argc, char ** argv)
327331
if (fstat(fd, &sb))
328332
die("Unable to stat `%s': %m", argv[2]);
329333
sz = sb.st_size;
330-
fprintf (stderr, "System is %d kB\n", (sz+1023)/1024);
334+
printf("System is %d kB\n", (sz+1023)/1024);
331335
kernel = mmap(NULL, sz, PROT_READ, MAP_SHARED, fd, 0);
332336
if (kernel == MAP_FAILED)
333337
die("Unable to mmap '%s': %m", argv[2]);
@@ -348,27 +352,31 @@ int main(int argc, char ** argv)
348352
#endif
349353

350354
crc = partial_crc32(buf, i, crc);
351-
if (fwrite(buf, 1, i, stdout) != i)
355+
if (fwrite(buf, 1, i, dest) != i)
352356
die("Writing setup failed");
353357

354358
/* Copy the kernel code */
355359
crc = partial_crc32(kernel, sz, crc);
356-
if (fwrite(kernel, 1, sz, stdout) != sz)
360+
if (fwrite(kernel, 1, sz, dest) != sz)
357361
die("Writing kernel failed");
358362

359363
/* Add padding leaving 4 bytes for the checksum */
360364
while (sz++ < (sys_size*16) - 4) {
361365
crc = partial_crc32_one('\0', crc);
362-
if (fwrite("\0", 1, 1, stdout) != 1)
366+
if (fwrite("\0", 1, 1, dest) != 1)
363367
die("Writing padding failed");
364368
}
365369

366370
/* Write the CRC */
367-
fprintf(stderr, "CRC %x\n", crc);
371+
printf("CRC %x\n", crc);
368372
put_unaligned_le32(crc, buf);
369-
if (fwrite(buf, 1, 4, stdout) != 4)
373+
if (fwrite(buf, 1, 4, dest) != 4)
370374
die("Writing CRC failed");
371375

376+
/* Catch any delayed write failures */
377+
if (fclose(dest))
378+
die("Writing image failed");
379+
372380
close(fd);
373381

374382
/* Everything is OK */

arch/x86/configs/i386_defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ CONFIG_MAC80211=y
142142
CONFIG_MAC80211_LEDS=y
143143
CONFIG_RFKILL=y
144144
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
145+
CONFIG_DEVTMPFS=y
146+
CONFIG_DEVTMPFS_MOUNT=y
145147
CONFIG_DEBUG_DEVRES=y
146148
CONFIG_CONNECTOR=y
147149
CONFIG_BLK_DEV_LOOP=y

arch/x86/configs/x86_64_defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ CONFIG_MAC80211=y
141141
CONFIG_MAC80211_LEDS=y
142142
CONFIG_RFKILL=y
143143
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
144+
CONFIG_DEVTMPFS=y
145+
CONFIG_DEVTMPFS_MOUNT=y
144146
CONFIG_DEBUG_DEVRES=y
145147
CONFIG_CONNECTOR=y
146148
CONFIG_BLK_DEV_LOOP=y

0 commit comments

Comments
 (0)