Skip to content

Commit 1b98ed0

Browse files
committed
Merge tag 'x86-boot-2021-06-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 boot update from Ingo Molnar: "Modernize the genimage.sh script, add a 'hdimage' target and EFI support" * tag 'x86-boot-2021-06-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/boot: Modernize genimage script; hdimage+EFI support
2 parents 909489b + f279b49 commit 1b98ed0

5 files changed

Lines changed: 252 additions & 104 deletions

File tree

arch/x86/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ drivers-$(CONFIG_FB) += arch/x86/video/
257257

258258
boot := arch/x86/boot
259259

260-
BOOT_TARGETS = bzdisk fdimage fdimage144 fdimage288 isoimage
260+
BOOT_TARGETS = bzdisk fdimage fdimage144 fdimage288 hdimage isoimage
261261

262262
PHONY += bzImage $(BOOT_TARGETS)
263263

@@ -315,8 +315,9 @@ define archhelp
315315
echo ' fdimage - Create 1.4MB boot floppy image (arch/x86/boot/fdimage)'
316316
echo ' fdimage144 - Create 1.4MB boot floppy image (arch/x86/boot/fdimage)'
317317
echo ' fdimage288 - Create 2.8MB boot floppy image (arch/x86/boot/fdimage)'
318+
echo ' hdimage - Create a BIOS/EFI hard disk image (arch/x86/boot/hdimage)'
318319
echo ' isoimage - Create a boot CD-ROM image (arch/x86/boot/image.iso)'
319-
echo ' bzdisk/fdimage*/isoimage also accept:'
320+
echo ' bzdisk/fdimage*/hdimage/isoimage also accept:'
320321
echo ' FDARGS="..." arguments for the booted kernel'
321322
echo ' FDINITRD=file initrd for the booted kernel'
322323
echo ''

arch/x86/boot/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ setup.elf
1111
fdimage
1212
mtools.conf
1313
image.iso
14+
hdimage

arch/x86/boot/Makefile

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ KCOV_INSTRUMENT := n
2929
SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
3030

3131
targets := vmlinux.bin setup.bin setup.elf bzImage
32-
targets += fdimage fdimage144 fdimage288 image.iso mtools.conf
32+
targets += fdimage fdimage144 fdimage288 image.iso hdimage
3333
subdir- := compressed
3434

3535
setup-y += a20.o bioscall.o cmdline.o copy.o cpu.o cpuflags.o cpucheck.o
@@ -115,47 +115,49 @@ $(obj)/compressed/vmlinux: FORCE
115115
$(Q)$(MAKE) $(build)=$(obj)/compressed $@
116116

117117
# Set this if you want to pass append arguments to the
118-
# bzdisk/fdimage/isoimage kernel
118+
# bzdisk/fdimage/hdimage/isoimage kernel
119119
FDARGS =
120-
# Set this if you want an initrd included with the
121-
# bzdisk/fdimage/isoimage kernel
120+
# Set this if you want one or more initrds included in the image
122121
FDINITRD =
123122

124-
image_cmdline = default linux $(FDARGS) $(if $(FDINITRD),initrd=initrd.img,)
123+
imgdeps = $(obj)/bzImage $(obj)/mtools.conf $(src)/genimage.sh
125124

126125
$(obj)/mtools.conf: $(src)/mtools.conf.in
127126
sed -e 's|@OBJ@|$(obj)|g' < $< > $@
128127

128+
targets += mtools.conf
129+
130+
# genimage.sh requires bash, but it also has a bunch of other
131+
# external dependencies.
129132
quiet_cmd_genimage = GENIMAGE $3
130-
cmd_genimage = sh $(srctree)/$(src)/genimage.sh $2 $3 $(obj)/bzImage \
131-
$(obj)/mtools.conf '$(image_cmdline)' $(FDINITRD)
133+
cmd_genimage = $(BASH) $(srctree)/$(src)/genimage.sh $2 $3 $(obj)/bzImage \
134+
$(obj)/mtools.conf '$(FDARGS)' $(FDINITRD)
132135

133-
PHONY += bzdisk fdimage fdimage144 fdimage288 isoimage bzlilo install
136+
PHONY += bzdisk fdimage fdimage144 fdimage288 hdimage isoimage install
134137

135138
# This requires write access to /dev/fd0
136-
bzdisk: $(obj)/bzImage $(obj)/mtools.conf
139+
# All images require syslinux to be installed; hdimage also requires
140+
# EDK2/OVMF if the kernel is compiled with the EFI stub.
141+
bzdisk: $(imgdeps)
137142
$(call cmd,genimage,bzdisk,/dev/fd0)
138143

139-
# These require being root or having syslinux 2.02 or higher installed
140-
fdimage fdimage144: $(obj)/bzImage $(obj)/mtools.conf
144+
fdimage fdimage144: $(imgdeps)
141145
$(call cmd,genimage,fdimage144,$(obj)/fdimage)
142146
@$(kecho) 'Kernel: $(obj)/fdimage is ready'
143147

144-
fdimage288: $(obj)/bzImage $(obj)/mtools.conf
148+
fdimage288: $(imgdeps)
145149
$(call cmd,genimage,fdimage288,$(obj)/fdimage)
146150
@$(kecho) 'Kernel: $(obj)/fdimage is ready'
147151

148-
isoimage: $(obj)/bzImage
152+
hdimage: $(imgdeps)
153+
$(call cmd,genimage,hdimage,$(obj)/hdimage)
154+
@$(kecho) 'Kernel: $(obj)/hdimage is ready'
155+
156+
isoimage: $(imgdeps)
149157
$(call cmd,genimage,isoimage,$(obj)/image.iso)
150158
@$(kecho) 'Kernel: $(obj)/image.iso is ready'
151159

152-
bzlilo:
153-
if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi
154-
if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi
155-
cat $(obj)/bzImage > $(INSTALL_PATH)/vmlinuz
156-
cp System.map $(INSTALL_PATH)/
157-
if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
158-
159160
install:
160-
sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(obj)/bzImage \
161+
$(CONFIG_SHELL) $(srctree)/$(src)/install.sh \
162+
$(KERNELRELEASE) $(obj)/bzImage \
161163
System.map "$(INSTALL_PATH)"

0 commit comments

Comments
 (0)