mirror of
https://gitlab.com/qemu-project/ipxe.git
synced 2025-11-03 07:59:06 +08:00
Some versions of GNU ld (observed with binutils 2.36 on Arch Linux) introduce a .note.gnu.property section marked as loadable at a high address and with non-empty contents. This adds approximately 128MB of garbage to the BIOS .usb disk images. Fix by using a custom linker script for the prefix-only binaries such as the USB disk partition table and MBR, in order to allow unwanted sections to be explicitly discarded. Reported-by: Christian Hesse <mail@eworm.de> Tested-by: Christian Hesse <mail@eworm.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
95 lines
2.1 KiB
Makefile
95 lines
2.1 KiB
Makefile
# -*- makefile -*- : Force emacs to use Makefile mode
|
|
|
|
# BIOS-specific directories containing source files
|
|
#
|
|
SRCDIRS += arch/x86/drivers/net
|
|
|
|
# The linker scripts
|
|
#
|
|
LDSCRIPT = arch/x86/scripts/pcbios.lds
|
|
LDSCRIPT_PREFIX = arch/x86/scripts/prefixonly.lds
|
|
|
|
# Stop ld from complaining about our customised linker script
|
|
#
|
|
LDFLAGS += -N --no-check-sections
|
|
|
|
# Media types.
|
|
#
|
|
MEDIA += rom
|
|
MEDIA += mrom
|
|
MEDIA += pcirom
|
|
MEDIA += isarom
|
|
MEDIA += pxe
|
|
MEDIA += kpxe
|
|
MEDIA += kkpxe
|
|
MEDIA += kkkpxe
|
|
MEDIA += lkrn
|
|
MEDIA += dsk
|
|
MEDIA += nbi
|
|
MEDIA += hd
|
|
MEDIA += raw
|
|
MEDIA += exe
|
|
|
|
# Padding rules
|
|
#
|
|
PAD_rom = $(PERL) $(PADIMG) --blksize=512 --byte=0xff
|
|
PAD_mrom = $(PAD_rom)
|
|
PAD_pcirom = $(PAD_rom)
|
|
PAD_isarom = $(PAD_rom)
|
|
PAD_dsk = $(PERL) $(PADIMG) --blksize=512
|
|
PAD_hd = $(PERL) $(PADIMG) --blksize=32768
|
|
PAD_exe = $(PERL) $(PADIMG) --blksize=512
|
|
|
|
# Finalisation rules
|
|
#
|
|
FINALISE_rom = $(PERL) $(FIXROM)
|
|
FINALISE_mrom = $(FINALISE_rom)
|
|
FINALISE_pcirom = $(FINALISE_rom)
|
|
FINALISE_isarom = $(FINALISE_rom)
|
|
|
|
# Use $(ROMS) rather than $(DRIVERS) for "allroms", "allmroms", etc.
|
|
#
|
|
LIST_NAME_rom := ROMS
|
|
LIST_NAME_mrom := ROMS
|
|
LIST_NAME_pcirom := ROMS
|
|
LIST_NAME_isarom := ROMS
|
|
|
|
# ISO or FAT filesystem images
|
|
NON_AUTO_MEDIA += iso
|
|
$(BIN)/%.iso $(BIN)/%.sdsk: $(BIN)/%.lkrn util/genfsimg
|
|
$(QM)$(ECHO) " [GENFSIMG] $@"
|
|
$(Q)util/genfsimg -o $@ $<
|
|
|
|
# rule to write disk images to /dev/fd0
|
|
NON_AUTO_MEDIA += fd0
|
|
%fd0 : %dsk
|
|
$(QM)$(ECHO) " [DD] $@"
|
|
$(Q)dd if=$< bs=512 conv=sync of=/dev/fd0
|
|
$(Q)sync
|
|
|
|
# Special target for building Master Boot Record binary
|
|
$(BIN)/mbr.tmp : $(BIN)/mbr.o
|
|
$(QM)$(ECHO) " [LD] $@"
|
|
$(Q)$(LD) $(LDFLAGS) -T $(LDSCRIPT_PREFIX) -o $@ -e mbr $<
|
|
|
|
# rule to make a USB disk image
|
|
$(BIN)/usbdisk.tmp : $(BIN)/usbdisk.o
|
|
$(QM)$(ECHO) " [LD] $@"
|
|
$(Q)$(LD) $(LDFLAGS) -T $(LDSCRIPT_PREFIX) -o $@ -e mbr $<
|
|
|
|
NON_AUTO_MEDIA += usb
|
|
%usb: $(BIN)/usbdisk.bin %hd
|
|
$(QM)$(ECHO) " [FINISH] $@"
|
|
$(Q)cat $^ > $@
|
|
|
|
NON_AUTO_MEDIA += vhd
|
|
%vhd: %usb
|
|
$(QM)$(ECHO) " [FINISH] $@"
|
|
$(Q)$(QEMUIMG) convert -f raw -O vpc $< $@
|
|
|
|
# Padded floppy image (e.g. for iLO)
|
|
NON_AUTO_MEDIA += pdsk
|
|
%pdsk : %dsk
|
|
$(Q)cp $< $@
|
|
$(Q)$(PADIMG) --blksize=1474560 $@
|