diff options
author | H. Peter Anvin <hpa@zytor.com> | 2019-02-28 23:09:34 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2019-02-28 23:09:34 -0800 |
commit | 0731d3d3947d6a47cf2d837b81bc72de26160ca3 (patch) | |
tree | 406a526983530aa71f82658c716b0daf9f51ea3b | |
parent | 56c69d73a56ee35a1d26d1ac7ccf73dedbe5f354 (diff) | |
download | syslinux-0731d3d3947d6a47cf2d837b81bc72de26160ca3.tar.gz syslinux-0731d3d3947d6a47cf2d837b81bc72de26160ca3.tar.xz syslinux-0731d3d3947d6a47cf2d837b81bc72de26160ca3.zip |
WIP: more cleanup for EFI to build cleaner
Something is wrong with the linking of the EFI core, though...
-rw-r--r-- | .gitmodules | 2 | ||||
-rw-r--r-- | Makefile | 42 | ||||
-rw-r--r-- | com32/Makefile | 24 | ||||
-rw-r--r-- | com32/efi/Makefile | 59 | ||||
m--------- | com32/efi/gnu-efi (renamed from gnu-efi) | 0 | ||||
-rw-r--r-- | core/Makefile | 169 | ||||
-rw-r--r-- | core/Makefile.bios | 90 | ||||
-rw-r--r-- | core/Makefile.efi | 50 | ||||
-rw-r--r-- | core/bios/isolinux-debug.asm | 2 | ||||
-rw-r--r-- | core/bios/main/isolinux-c.c (renamed from core/bios/isolinux-c.c) | 0 | ||||
-rw-r--r-- | core/bios/main/isolinux-debug-c.c (renamed from core/bios/isolinux-debug-c.c) | 0 | ||||
-rw-r--r-- | core/bios/main/isolinux-debug.asm | 2 | ||||
-rw-r--r-- | core/bios/main/isolinux.asm (renamed from core/bios/isolinux.asm) | 0 | ||||
-rw-r--r-- | core/bios/main/ldlinux-c.c (renamed from core/bios/ldlinux-c.c) | 0 | ||||
-rw-r--r-- | core/bios/main/ldlinux.asm (renamed from core/bios/ldlinux.asm) | 0 | ||||
-rw-r--r-- | core/bios/main/lpxelinux-c.c (renamed from core/bios/lpxelinux-c.c) | 0 | ||||
-rw-r--r-- | core/bios/main/lpxelinux.asm (renamed from core/bios/lpxelinux.asm) | 0 | ||||
-rw-r--r-- | core/bios/main/pxelinux-c.c (renamed from core/bios/pxelinux-c.c) | 0 | ||||
-rw-r--r-- | core/bios/main/pxelinux.asm (renamed from core/bios/pxelinux.asm) | 0 | ||||
-rw-r--r-- | core/common/cleanup.c (renamed from core/cleanup.c) | 0 | ||||
-rw-r--r-- | core/common/conio.c (renamed from core/conio.c) | 0 | ||||
-rw-r--r-- | core/common/console.c (renamed from core/console.c) | 0 | ||||
-rw-r--r-- | core/common/debug.c (renamed from core/debug.c) | 0 | ||||
-rw-r--r-- | core/common/dmi.c (renamed from core/dmi.c) | 0 | ||||
-rw-r--r-- | core/common/errno.c (renamed from core/errno.c) | 0 | ||||
-rw-r--r-- | core/common/idle.c (renamed from core/idle.c) | 0 | ||||
-rw-r--r-- | core/common/init.c (renamed from core/init.c) | 0 | ||||
-rw-r--r-- | core/common/path.c (renamed from core/path.c) | 0 | ||||
-rw-r--r-- | core/common/pmapi.c (renamed from core/pmapi.c) | 0 | ||||
-rw-r--r-- | core/common/sysappend.c (renamed from core/sysappend.c) | 0 | ||||
-rw-r--r-- | core/common/writehex.c (renamed from core/writehex.c) | 0 | ||||
-rw-r--r-- | core/common/writestr.c (renamed from core/writestr.c) | 0 | ||||
-rw-r--r-- | core/efi/adv.c (renamed from efi/adv.c) | 0 | ||||
-rw-r--r-- | core/efi/adv.h (renamed from efi/adv.h) | 0 | ||||
-rw-r--r-- | core/efi/console.c (renamed from efi/console.c) | 0 | ||||
-rw-r--r-- | core/efi/cp865_8x16.h (renamed from efi/cp865_8x16.h) | 0 | ||||
-rw-r--r-- | core/efi/derivative.c (renamed from efi/derivative.c) | 0 | ||||
-rw-r--r-- | core/efi/diskio.c (renamed from efi/diskio.c) | 0 | ||||
-rw-r--r-- | core/efi/efi.h (renamed from efi/efi.h) | 0 | ||||
-rw-r--r-- | core/efi/fio.c (renamed from efi/fio.c) | 0 | ||||
-rw-r--r-- | core/efi/fio.h (renamed from efi/fio.h) | 0 | ||||
-rw-r--r-- | core/efi/i386/linux.S (renamed from efi/i386/linux.S) | 0 | ||||
-rw-r--r-- | core/efi/i386/syslinux.ld (renamed from efi/i386/syslinux.ld) | 0 | ||||
-rw-r--r-- | core/efi/main.c (renamed from efi/main.c) | 7 | ||||
-rw-r--r-- | core/efi/mem.c (renamed from efi/mem.c) | 0 | ||||
-rw-r--r-- | core/efi/pxe.c (renamed from efi/pxe.c) | 0 | ||||
-rw-r--r-- | core/efi/syslinux.ld (renamed from efi/syslinux.ld) | 0 | ||||
-rw-r--r-- | core/efi/tcp.c (renamed from efi/tcp.c) | 0 | ||||
-rw-r--r-- | core/efi/udp.c (renamed from efi/udp.c) | 0 | ||||
-rw-r--r-- | core/efi/vesa.c (renamed from efi/vesa.c) | 0 | ||||
-rw-r--r-- | core/efi/x86_64/linux.S (renamed from efi/x86_64/linux.S) | 0 | ||||
-rw-r--r-- | core/efi/x86_64/syslinux.ld (renamed from efi/x86_64/syslinux.ld) | 0 | ||||
-rw-r--r-- | core/fs/fat/codepage.S (renamed from core/codepage.S) | 2 | ||||
-rw-r--r-- | core/fs/ntfs/ntfs.c | 1 | ||||
-rw-r--r-- | core/fs/pxe/dhcp_option.c | 2 | ||||
-rw-r--r-- | core/fs/pxe/ftp.c | 1 | ||||
-rw-r--r-- | core/fs/pxe/http.c | 2 | ||||
-rw-r--r-- | core/fs/xfs/xfs.c | 1 | ||||
-rw-r--r-- | core/include/net.h | 8 | ||||
-rw-r--r-- | efi/Makefile | 97 | ||||
-rwxr-xr-x | efi/build-gnu-efi.sh | 45 | ||||
-rwxr-xr-x | efi/check-gnu-efi.sh | 38 | ||||
-rwxr-xr-x | efi/clean-gnu-efi.sh | 37 | ||||
-rw-r--r-- | mk/bios.mk | 1 | ||||
-rw-r--r-- | mk/build.mk | 22 | ||||
-rw-r--r-- | mk/efi.mk | 58 | ||||
-rw-r--r-- | mk/elf.mk | 32 | ||||
-rw-r--r-- | mk/syslinux.mk | 2 | ||||
-rw-r--r-- | prepcore/bios/.gitignore (renamed from lzo/.gitignore) | 0 | ||||
-rw-r--r-- | prepcore/bios/Makefile (renamed from lzo/Makefile) | 8 | ||||
-rw-r--r-- | prepcore/bios/doc/LZO.TXT (renamed from lzo/doc/LZO.TXT) | 0 | ||||
-rw-r--r-- | prepcore/bios/include/lzo/lzo1.h (renamed from lzo/include/lzo/lzo1.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/include/lzo/lzo1a.h (renamed from lzo/include/lzo/lzo1a.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/include/lzo/lzo1b.h (renamed from lzo/include/lzo/lzo1b.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/include/lzo/lzo1c.h (renamed from lzo/include/lzo/lzo1c.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/include/lzo/lzo1f.h (renamed from lzo/include/lzo/lzo1f.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/include/lzo/lzo1x.h (renamed from lzo/include/lzo/lzo1x.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/include/lzo/lzo1y.h (renamed from lzo/include/lzo/lzo1y.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/include/lzo/lzo1z.h (renamed from lzo/include/lzo/lzo1z.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/include/lzo/lzo2a.h (renamed from lzo/include/lzo/lzo2a.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/include/lzo/lzo_asm.h (renamed from lzo/include/lzo/lzo_asm.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/include/lzo/lzoconf.h (renamed from lzo/include/lzo/lzoconf.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/include/lzo/lzodefs.h (renamed from lzo/include/lzo/lzodefs.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/include/lzo/lzoutil.h (renamed from lzo/include/lzo/lzoutil.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/prepcore.c (renamed from lzo/prepcore.c) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/compr1b.h (renamed from lzo/src/compr1b.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/compr1c.h (renamed from lzo/src/compr1c.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/config1x.h (renamed from lzo/src/config1x.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo1_d.ch (renamed from lzo/src/lzo1_d.ch) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo1x_1.c (renamed from lzo/src/lzo1x_1.c) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo1x_1k.c (renamed from lzo/src/lzo1x_1k.c) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo1x_1l.c (renamed from lzo/src/lzo1x_1l.c) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo1x_1o.c (renamed from lzo/src/lzo1x_1o.c) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo1x_9x.c (renamed from lzo/src/lzo1x_9x.c) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo1x_c.ch (renamed from lzo/src/lzo1x_c.ch) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo1x_d.ch (renamed from lzo/src/lzo1x_d.ch) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo1x_d1.c (renamed from lzo/src/lzo1x_d1.c) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo1x_d2.c (renamed from lzo/src/lzo1x_d2.c) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo1x_d3.c (renamed from lzo/src/lzo1x_d3.c) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo1x_o.c (renamed from lzo/src/lzo1x_o.c) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo1x_oo.ch (renamed from lzo/src/lzo1x_oo.ch) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo_conf.h (renamed from lzo/src/lzo_conf.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo_crc.c (renamed from lzo/src/lzo_crc.c) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo_dict.h (renamed from lzo/src/lzo_dict.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo_dll.ch (renamed from lzo/src/lzo_dll.ch) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo_func.h (renamed from lzo/src/lzo_func.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo_init.c (renamed from lzo/src/lzo_init.c) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo_mchw.ch (renamed from lzo/src/lzo_mchw.ch) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo_ptr.c (renamed from lzo/src/lzo_ptr.c) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo_ptr.h (renamed from lzo/src/lzo_ptr.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo_str.c (renamed from lzo/src/lzo_str.c) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo_supp.h (renamed from lzo/src/lzo_supp.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo_swd.ch (renamed from lzo/src/lzo_swd.ch) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/lzo_util.c (renamed from lzo/src/lzo_util.c) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/miniacc.h (renamed from lzo/src/miniacc.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/stats1a.h (renamed from lzo/src/stats1a.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/stats1b.h (renamed from lzo/src/stats1b.h) | 0 | ||||
-rw-r--r-- | prepcore/bios/src/stats1c.h (renamed from lzo/src/stats1c.h) | 0 | ||||
-rw-r--r-- | prepcore/efi/Makefile | 30 | ||||
-rw-r--r-- | prepcore/efi/prepcore.c (renamed from efi/wrapper.c) | 22 | ||||
-rw-r--r-- | prepcore/efi/prepcore.h (renamed from efi/wrapper.h) | 0 |
121 files changed, 379 insertions, 477 deletions
diff --git a/.gitmodules b/.gitmodules index 6ce10f45..6a766b88 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "gnu-efi"] - path = gnu-efi + path = com32/efi/gnu-efi url = git://git.code.sf.net/p/gnu-efi/code @@ -68,7 +68,7 @@ $(if $(cd-output),, \ # MAKEDIR = $(topdir)/mk -export MAKEDIR topdir OBJDIR +export MAKEDIR topdir include $(MAKEDIR)/syslinux.mk @@ -151,7 +151,7 @@ MODULES = com32/menu/*.c32 com32/modules/*.c32 com32/mboot/*.c32 \ com32/cmenu/libmenu/*.c32 ldlinux/$(LDLINUX) endif -export FIRMWARE FWCLASS ARCH BITS +export FIRMWARE firmware FWCLASS fwclass ARCH BITS # List of module objects that should be installed for all derivatives INSTALLABLE_MODULES = $(MODULES) @@ -174,34 +174,36 @@ BOBJECTS = \ # files that depend only on the B phase, but may have to be regenerated # for "make installer". -ifeq ($(FWCLASS),EFI) - -BSUBDIRS = codepage lzo core ldlinux com32 mbr sample efi txt +BSUBDIRS = codepage prepcore/$(fwclass) core ldlinux com32 mbr sample txt ISUBDIRS = -INSTALLSUBDIRS = efi +INSTALL_AUX = $(INSTALLABLE_MODULES) -NETINSTALLABLE = efi/syslinux.efi $(INSTALLABLE_MODULES) +# Things to install in /tftpboot +NETINSTALLABLE = $(INSTALLABLE_MODULES) -else +ifeq ($(FWCLASS),EFI) +INSTALL_AUX += core/syslinux.efi +NETINSTALLABLE += core/syslinux.efi +endif +ifeq ($(FWCLASS),BIOS) -BSUBDIRS = codepage lzo core ldlinux com32 memdisk mbr sample \ - diag libinstaller dos win32 win64 dosutil txt +BSUBDIRS += libinstaller dos win32 win64 dosutil IOBJECTS = utils/gethostip utils/isohybrid utils/mkdiskimage \ mtools/syslinux linux/syslinux extlinux/extlinux ISUBDIRS = libinstaller mtools linux extlinux utils # Things to install in /usr/bin -INSTALL_BIN = mtools/syslinux +INSTALL_BIN += mtools/syslinux # Things to install in /sbin -INSTALL_SBIN = extlinux/extlinux +INSTALL_SBIN += extlinux/extlinux # Things to install in /usr/lib/syslinux -INSTALL_AUX = core/pxelinux.0 \ +INSTALL_AUX += core/pxelinux.0 \ core/isolinux.bin core/isolinux-debug.bin \ dos/syslinux.com core/lpxelinux.0 \ - mbr/*.bin $(INSTALLABLE_MODULES) -INSTALL_AUX_OPT = win32/syslinux.exe win64/syslinux64.exe + mbr/*.bin +INSTALL_AUX_OPT += win32/syslinux.exe win64/syslinux64.exe INSTALL_DIAG = diag/mbr/handoff.bin \ diag/geodsp/geodsp1s.img.xz diag/geodsp/geodspms.img.xz @@ -211,9 +213,7 @@ INSTALLSUBDIRS = com32 utils dosutil # Things to install in /boot/extlinux EXTBOOTINSTALL = $(INSTALLABLE_MODULES) -# Things to install in /tftpboot -NETINSTALLABLE = core/pxelinux.0 core/lpxelinux.0 \ - $(INSTALLABLE_MODULES) +NETINSTALLABLE += core/pxelinux.0 core/lpxelinux.0 endif # ifeq ($(FWCLASS),EFI) @@ -252,7 +252,7 @@ bios: @mkdir -p $(OBJ)/bios $(MAKE) -C $(OBJ)/bios -f $(SRC)/Makefile SRC="$(SRC)" \ objdir=$(OBJ)/bios OBJ=$(OBJ)/bios \ - FIRMWARE=BIOS FWCLASS=BIOS \ + FIRMWARE=BIOS firmware=bios FWCLASS=BIOS fwclass=bios \ ARCH=i386 LDLINUX=ldlinux.c32 $(MAKECMDGOALS) efi32: @@ -260,7 +260,7 @@ efi32: $(MAKE) -C $(OBJ)/efi32 -f $(SRC)/Makefile SRC="$(SRC)" \ objdir=$(OBJ)/efi32 OBJ=$(OBJ)/efi32 \ ARCH=i386 BITS=32 LDLINUX=ldlinux.e32 \ - FIRMWARE=EFI32 FWCLASS=EFI \ + FIRMWARE=EFI32 firmware=efi32 FWCLASS=EFI fwclass=efi \ $(MAKECMDGOALS) efi64: @@ -268,7 +268,7 @@ efi64: $(MAKE) -C $(OBJ)/efi64 -f $(SRC)/Makefile SRC="$(SRC)" \ objdir=$(OBJ)/efi64 OBJ=$(OBJ)/efi64 \ ARCH=x86_64 BITS=64 LDLINUX=ldlinux.e64 \ - FIRMWARE=EFI64 FWCLASS=EFI \ + FIRMWARE=EFI64 firmware=efi64 FWCLASS=EFI fwclass=efi \ $(MAKECMDGOALS) else # FIRMWARE diff --git a/com32/Makefile b/com32/Makefile index c2650307..412ad8df 100644 --- a/com32/Makefile +++ b/com32/Makefile @@ -1,13 +1,16 @@ -ifdef PRECORE -SUBDIRS = tools lib -else -SUBDIRS = tools lib libutil gpllib libupload modules mboot \ - menu samples elflink rosh cmenu lua/src +PRECOREDIRS := tools lib +PRECOREDIRS_EFI := efi +PRECOREDIRS_BIOS := -ifneq ($(FWCLASS),EFI) +POSTCOREDIRS := libutil gpllib libupload modules mboot \ + menu samples elflink rosh cmenu lua/src +POSTCOREDIRS_EFI := # These tools are no applicable to EFI, or need serious porting -SUBDIRS += hdt sysdump chain -endif +POSTCOREDIRS_BIOS = hdt sysdump chain + +SUBDIRS = $(PRECOREDIRS) $(PRECOREDIRS_$(FWCLASS)) +ifndef PRECORE +SUBDIRS += $(POSTCOREDIRS) $(POSTCOREDIRS_$(FWCLASS)) endif all tidy dist clean spotless install: subdirs @@ -19,8 +22,9 @@ $(SUBDIRS): $(MAKE) -C $(OBJ)/$@ SRC='$(SRC)/$@' OBJ='$(OBJ)/$@' \ -f '$(SRC)/$@/Makefile' $(MAKECMDGOALS) -# Parallel dependencies -lib: tools +# Parallel dependencies +LIBDEP_EFI := efi +lib: tools $(LIBDEP_$(FWCLASS)) gpllib libupload libutil: lib cmenu: lib libutil diff --git a/com32/efi/Makefile b/com32/efi/Makefile new file mode 100644 index 00000000..d5ccd86f --- /dev/null +++ b/com32/efi/Makefile @@ -0,0 +1,59 @@ +## ----------------------------------------------------------------------- +## +## Copyright 2011 Intel Corporation; author: Matt Fleming +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, Inc., 53 Temple Place Ste 330, +## Boston MA 02111-1307, USA; either version 2 of the License, or +## (at your option) any later version; incorporated herein by reference. +## +## ----------------------------------------------------------------------- + +include $(MAKEDIR)/elf.mk + +# The targets to build in this directory +all: libefi + +EFISRC = $(SRC)/gnu-efi +EFIOBJ = $(OBJ)/gnu-efi + +# This is a hack due to missing rules in gnu-efi/Make.rules +# Also note make rather than $(MAKE) below. +unexport MAKEFLAGS + +EFIMAKE = make -C '$(EFIOBJ)' \ + SRCDIR='$(EFISRC)' \ + HOSTCC='$(CC_FOR_BUILD)' \ + ARCH='$(EFI_SUBARCH)' PREFIX='$(OBJ)' \ + -f '$(EFISRC)/Makefile' + +libefi: include/efi/$(EFI_SUBARCH)/efibind.h \ + lib/libefi.a lib/libgnuefi.a + +include/%/$(EFI_SUBARCH)/efibind.h lib/lib%.a lib/libgnu%.a: + @echo Building gnu-efi for $(EFI_SUBARCH) + if [ -f $(topdir)/.gitmodule ]; then \ + ( cd $(topdir) && git submodule update --init ); \ + fi + mkdir -p $(EFIOBJ) + $(EFIMAKE) + $(EFIMAKE) install + +install: + +strip: + +tidy dist: + rm -f *.so *.o wrapper + find . \( -name \*.o -o -name \*.a -o -name .\*.d -o -name \*.tmp \) -print0 | \ + xargs -0r rm -f + if [ -d gnu-efi ]; then $(EFIMAKE) clean; fi + +clean: clean-efi tidy + +clean-efi: + rm -rf gnu-efi + +spotless: clean + rm -rf lib include diff --git a/gnu-efi b/com32/efi/gnu-efi -Subproject d34132e62f666904158c7ec2f1eef5a9d5281c3 +Subproject d34132e62f666904158c7ec2f1eef5a9d5281c3 diff --git a/core/Makefile b/core/Makefile index 6b79d877..b6d74166 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1,7 +1,7 @@ ## ----------------------------------------------------------------------- ## ## Copyright 1998-2009 H. Peter Anvin - All Rights Reserved -## Copyright 2009-2016 Intel Corporation; author: H. Peter Anvin +## Copyright 2009-2019 Intel Corporation; author: H. Peter Anvin ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -12,78 +12,56 @@ ## ----------------------------------------------------------------------- # -# Makefile for the SYSLINUX core +# General Makefile for the Syslinux core # include $(MAKEDIR)/elf.mk -include $(objdir)/version.mk -INCLUDE += -I$(SRC)/include -I$(com32)/lib \ - -I$(SRC)/bios/lwip/src/include \ - -I$(SRC)/bios/lwip/src/include/ipv4 -I$(SRC)/fs/pxe +INCLUDE += -I$(SRC)/include -I$(com32)/lib -I$(SRC)/fs/pxe # This is very similar to cp437; technically it's for Norway and Denmark, # but it's unlikely the characters that are different will be used in # filenames by other users. CODEPAGE = cp865 -# The targets to build in this directory... -BTARGET = ldlinux.bss ldlinux.sys \ - isolinux.bin isolinux-debug.bin pxelinux.0 lpxelinux.0 - -# The corresponding ELF files -ETARGET = $(patsubst $(SRC)/%-c.c,%.elf,$(wildcard $(SRC)/bios/*-c.c)) +# Directories to actually build from +SRCDIRS := common elflink fs mem include $(fwclass) # Export library files LIBCORE_FILES = libcore.so libcore.weak -# All primary source files for the main syslinux files -NASMSRC := $(sort $(shell find $(SRC) -name '*.asm' -print)) -NASMHDR := $(sort $(shell find $(SRC) -name '*.inc' -print)) -CSRC := $(sort $(shell find $(SRC) -name '*.c' -print)) -SSRC := $(sort $(shell find $(SRC) -name '*.S' -print)) -CHDR := $(sort $(shell find $(SRC) -name '*.h' -print)) -OTHERSRC := -ALLSRC = $(NASMSRC) $(NASMHDR) $(CSRC) $(SSRC) $(CHDR) $(OTHERSRC) - -COBJ := $(subst $(SRC)/,,$(patsubst %.c,%.o,$(CSRC))) -SOBJ := $(subst $(SRC)/,,$(patsubst %.S,%.o,$(SSRC))) - -# To make this compatible with the following $(filter-out), make sure -# we prefix everything with $(SRC) -CORE_PXE_DIRS = $(SRC)/bios/pxe -LPXELINUX_DIRS = $(SRC)/bios/lwip -PXELINUX_DIRS = $(SRC)/bios/legacynet - -CORE_PXE_CSRC = $(sort $(shell find $(CORE_PXE_DIRS) -name '*.c' -print)) -CORE_PXE_SSRC = $(sort $(shell find $(CORE_PXE_DIRS) -name '*.S' -print)) -LPXELINUX_CSRC = $(sort $(shell find $(LPXELINUX_DIRS) -name '*.c' -print)) -LPXELINUX_SSRC = $(sort $(shell find $(LPXELINUX_DIRS) -name '*.S' -print)) -PXELINUX_CSRC = $(sort $(shell find $(PXELINUX_DIRS) -name '*.c' -print)) -PXELINUX_SSRC = $(sort $(shell find $(PXELINUX_DIRS) -name '*.S' -print)) - -CORE_PXE_OBJS = $(subst $(SRC)/,,$(CORE_PXE_CSRC:%.c=%.o) $(CORE_PXE_SSRC:%.S=%.o)) -LPXELINUX_OBJS = $(subst $(SRC)/,,$(LPXELINUX_CSRC:%.c=%.o) $(LPXELINUX_SSRC:%.S=%.o)) -PXELINUX_OBJS = $(subst $(SRC)/,,$(PXELINUX_CSRC:%.c=%.o) $(PXELINUX_SSRC:%.S=%.o)) - -UNITTEST_DIRS = $(sort $(shell find $(SRC) -type d -name tests)) - -# Don't include network stack specific objects or unit tests -FILTER_DIRS = $(UNITTEST_DIRS) $(CORE_PXE_DIRS) \ - $(PXELINUX_DIRS) $(LPXELINUX_DIRS) -ifeq ($(FWCLASS),EFI) -FILTER_DIRS += $(SRC)/bios -endif -FILTER_OBJS = $(patsubst $(SRC)/%,%/%,$(FILTER_DIRS)) +# Libraries to link with the core +CORE_LIBS = $(objdir)/com32/lib/libcom32.a -COBJS = $(filter-out $(FILTER_OBJS),$(COBJ)) -SOBJS = $(filter-out $(FILTER_OBJS),$(SOBJ)) +# Core preparation program +PREPCORE = $(objdir)/prepcore/$(fwclass)/prepcore -CORE_LIB = bios/libsyslinux.a -CORE_LIBS = $(CORE_LIB) $(objdir)/com32/lib/libcom32.a -CORE_LIBOBJS = $(COBJS) $(SOBJS) +# All primary source files for the main syslinux files +SRCFILES := $(sort $(shell find $(SRCDIRS:%=$(SRC)/%) \ + -name tests -prune -o -type f -print)) +NASMSRC := $(filter %.asm,$(SRCFILES)) +NASMHDR := $(filter %.inc,$(SRCFILES)) +CSRC := $(filter %.c ,$(SRCFILES)) +SSRC := $(filter %.S ,$(SRCFILES)) +CHDR := $(filter %.h ,$(SRCFILES)) +ALLSRC := $(NASMSRC) $(NASMHDR) $(CSRC) $(SSRC) $(CHDR) + +COBJ := $(CSRC:$(SRC)/%.c=%.o) +SOBJ := $(SSRC:$(SRC)/%.S=%.o) +NASMOBJ := $(NASMSRC:$(SRC)/%.asm=%.o) +ALLOBJ := $(COBJ) $(SOBJ) $(NASMOBJ) + +DATE_DEFS = -DDATE_STR='"$(DATE)"' -DHEXDATE="$(HEXDATE)" + +%.a: + rm -f $@ + $(AR) cq $@ $^ + $(RANLIB) $@ -PREPCORE = $(OBJ)/../lzo/prepcore +include $(SRC)/Makefile.$(fwclass) + +CORE_LIBOBJS ?= $(ALLOBJ) # This makes the core quite a bit smaller, but requires that the proper # __export tags are in place. It would be very good to add the same things @@ -102,70 +80,16 @@ ifndef DATE DATE := $(shell sh $(SRC)/../gen-id.sh $(VERSION) $(HEXDATE)) endif -ifeq ($(FWCLASS),EFI) -all: makeoutputdirs $(COBJS) $(SOBJS) codepage.o $(LIBCORE_FILES) -else -all: makeoutputdirs $(BTARGET) $(LIBCORE_FILES) -endif - -makeoutputdirs: - @mkdir -p $(sort $(dir $(COBJ) $(SOBJ))) - -ifeq ($(FWCLASS),BIOS) - -%.raw: %.elf - $(OBJCOPY) -O binary -S $< $@ +CORELDSCRIPT ?= $(SRC)/$(fwclass)/syslinux.ld -%.bin: %.raw $(PREPCORE) - $(PREPCORE) $< $@ - -NASMFLAGS += -DDATE_STR="'$(DATE)'" -DHEXDATE="$(HEXDATE)" -I$(SRC)/bios/ -I$(objdir)/ -I$(OBJ)/ - -%.o: %.asm kwdhash.gen $(objdir)/version.gen - -AUXLIBS = bios/libpxelinux.a bios/liblpxelinux.a -CORELDSCRIPT = $(SRC)/bios/syslinux.ld -CORELDFLAGS = $(MAIN_LDFLAGS) -pie --no-dynamic-linker \ +CORELDFLAGS += $(MAIN_LDFLAGS) -pie --no-dynamic-linker \ --unresolved-symbols=report-all \ -E -M -T $(CORELDSCRIPT) -# Assembly file to force certain symbols to be exported even if -# they are not used by the core. -EXPORT = bios/export.o - -$(ETARGET): %.elf: %.o %-c.o $(EXPORT) %.a $(CORE_LIBS) $(CORELDSCRIPT) - $(LD) $(CORELDFLAGS) -o $@ $< $*-c.o $(EXPORT) \ - --start-group $*.a $(CORE_LIBS) --end-group \ - > $*.map - if [ `$(NM) -D -u $@ | wc -l` -ne 0 ]; then \ - $(NM) -D -u $@ 1>&2; rm -f $@; false; fi - $(OBJDUMP) -h $@ > $*.sec - $(PERL) $(SRC)/lstadjust.pl $*.lsr $*.sec $*.lst - -# Legacy network stack -bios/pxelinux.a: $(CORE_PXE_OBJS) $(PXELINUX_OBJS) - -# LwIP network stack -bios/lpxelinux.a: $(CORE_PXE_OBJS) $(LPXELINUX_OBJS) - -# Otherwise, no special library needed, a null library will be created - -bios/%.a: - rm -f $@ - $(AR) cq $@ $^ - $(RANLIB) $@ - -%.0: bios/%.bin - cp -f $< $@ - -%.bin: bios/%.bin - cp -f $< $@ - -ldlinux.bss: bios/ldlinux.bin - dd if=$< of=$@ bs=512 count=1 +all: makeoutputdirs $(BTARGET) $(LIBCORE_FILES) -ldlinux.sys: bios/ldlinux.bin - dd if=$< of=$@ bs=512 skip=2 +makeoutputdirs: + @mkdir -p $(sort $(dir $(ALLOBJ))) libcore.S: $(ETARGET) $(SRC)/export.pl $(PERL) '$(SRC)/export.pl' libcore.S libcore.weak $(ETARGET) @@ -173,21 +97,12 @@ libcore.S: $(ETARGET) $(SRC)/export.pl libcore.weak: libcore.S : $@ generated by side effect from $< -# Don't use $(SHARED) here: we don't want a SONAME on libcore.so libcore.so: libcore.o $(LD) $(LDFLAGS) -shared -o $@ $< -endif # BIOS - $(CORE_LIB): $(CORE_LIBOBJS) - rm -f $@ - $(AR) cq $@ $^ - $(RANLIB) $@ - -codepage.cp: $(OBJ)/../codepage/$(CODEPAGE).cp - cp -f $< $@ -codepage.o: codepage.S codepage.cp +fs/fat/codepage.o: SFLAGS += -DCODEPAGE=\"$(objdir)/codepage/$(CODEPAGE).cp\" install: installer @@ -201,7 +116,7 @@ tidy dist: for d in $(find . -type d -print) ; do \ ( cd "$$d" ; \ rm -f *.o *.a .*.d *.lst \ - codepage.cp *.elf stupid.* patch.offset .depend \ + *.elf stupid.* patch.offset .depend \ *.elf.tmp *.sym \ *.lsr *.map *.sec *.raw \ ); done @@ -212,5 +127,5 @@ clean: tidy spotless: clean rm -f $(BTARGET) *.bin *_bin.c -# Include dependencies file --include $(shell find $(OBJ) -name '.*.d' -print) +# Include dependencies files +-include $(shell find $(OBJ) -name '.*.d' -type f -print) diff --git a/core/Makefile.bios b/core/Makefile.bios new file mode 100644 index 00000000..ea33f9cc --- /dev/null +++ b/core/Makefile.bios @@ -0,0 +1,90 @@ +## -*- makefile-gmake -*- ------------------------------------------------- +## +## Copyright 1998-2009 H. Peter Anvin - All Rights Reserved +## Copyright 2009-2019 Intel Corporation; author: H. Peter Anvin +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, Inc., 53 Temple Place Ste 330, +## Boston MA 02111-1307, USA; either version 2 of the License, or +## (at your option) any later version; incorporated herein by reference. +## +## ----------------------------------------------------------------------- + +# +# BIOS-specific Makefile for the Syslinux core +# + +INCLUDE += -I$(SRC)/bios/lwip/src/include \ + -I$(SRC)/bios/lwip/src/include/ipv4 + +# The targets to build in this directory... +BTARGET := ldlinux.bss ldlinux.sys \ + isolinux.bin isolinux-debug.bin pxelinux.0 lpxelinux.0 + +# The corresponding ELF files +ETARGET := $(patsubst $(SRC)/bios/main/%.asm,bios/%.elf,\ + $(wildcard $(SRC)/bios/main/*.asm)) + +CORE_PXE_DIRS := bios/pxe fs/pxe +LPXELINUX_DIRS := bios/lwip +PXELINUX_DIRS := bios/legacynet +MAIN_DIRS := bios/main +FILTER_DIRS := $(CORE_PXE_DIRS) $(LPXELINUX_DIRS) \ + $(PXELINUX_DIRS) $(MAIN_DIRS) + +CORE_PXE_OBJS := $(filter $(CORE_PXE_DIRS:%=%/%.o),$(ALLOBJ)) +LPXELINUX_OBJS := $(filter $(LPXELINUX_DIRS:%=%/%.o),$(ALLOBJ)) +PXELINUX_OBJS := $(filter $(PXELINUX_DIRS:%=%/%.o),$(ALLOBJ)) +MAIN_OBJS := $(filter $(MAIN_DIRS:%=%/%.o),$(ALLOBJ)) + +CORE_LIBOBJS := $(filter-out $(FILTER_DIRS:%=%/%.o),$(ALLOBJ)) + +AUXLIBS := bios/pxelinux.a bios/lpxelinux.a +CORELDSCRIPT := $(SRC)/bios/syslinux.ld + +CORE_LIB := bios/libsyslinux.a + +%.raw: %.elf + $(OBJCOPY) -O binary -S $< $@ + +%.bin: %.raw $(PREPCORE) + $(PREPCORE) $< $@ + +NASMFLAGS += $(DATE_DEFS) -I$(SRC)/bios/ -I$(objdir)/ -I$(OBJ)/ + +%.o: %.asm $(objdir)/version.gen + +# Assembly file to force certain symbols to be exported even if +# they are not used by the core. +EXPORT = bios/export.o + +$(ETARGET): bios/%.elf: bios/main/%.o bios/main/%-c.o $(EXPORT) bios/%.a \ + $(CORE_LIB) $(CORE_LIBS) $(CORELDSCRIPT) + $(LD) $(CORELDFLAGS) -o $@ $(filter %.o,$^) \ + --start-group $(filter %.a,$^) --end-group \ + > bios/$*.map + if [ `$(NM) -D -u $@ | wc -l` -ne 0 ]; then \ + $(NM) -D -u $@ 1>&2; rm -f $@; false; fi + $(OBJDUMP) -h $@ > bios/$*.sec + $(PERL) $(SRC)/lstadjust.pl bios/main/$*.lsr bios/$*.sec bios/$*.lst + +# Legacy network stack +bios/pxelinux.a: $(CORE_PXE_OBJS) $(PXELINUX_OBJS) + +# LwIP network stack +bios/lpxelinux.a: $(CORE_PXE_OBJS) $(LPXELINUX_OBJS) + +# Otherwise, no special library needed, a null library will be created + +%.0: bios/%.bin + cp -f $< $@ + +%.bin: bios/%.bin + cp -f $< $@ + +ldlinux.bss: bios/ldlinux.bin + dd if=$< of=$@ bs=512 count=1 + +ldlinux.sys: bios/ldlinux.bin + dd if=$< of=$@ bs=512 skip=2 diff --git a/core/Makefile.efi b/core/Makefile.efi new file mode 100644 index 00000000..dce513ed --- /dev/null +++ b/core/Makefile.efi @@ -0,0 +1,50 @@ +## -*- makefile -*- ------------------------------------------------------ +## +## Copyright 1998-2009 H. Peter Anvin - All Rights Reserved +## Copyright 2009-2019 Intel Corporation; author: H. Peter Anvin +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, Inc., 53 Temple Place Ste 330, +## Boston MA 02111-1307, USA; either version 2 of the License, or +## (at your option) any later version; incorporated herein by reference. +## +## ----------------------------------------------------------------------- + +# +# EFI-specific Makefile for the Syslinux core +# + +# The targets to build in this directory... +BTARGET = syslinux.efi + +# The corresponding ELF files +ETARGET = efi/syslinux.elf + +# Export library files +LIBCORE_FILES = libcore.so libcore.weak + +CORE_LIBOBJS = $(ALLOBJ) + +CORELDFLAGS = +CORE_LIB = efi/libsyslinux.a + +INCLUDE += -I$(SRC)/efi +CFLAGS += $(DATE_DEFS) + +# Build the wrapper app and wrap our .so to produce a .efi +syslinux.efi: efi/syslinux.elf $(PREPCORE) + $(PREPCORE) $< $@ + +wrapper: wrapper.c wrapper.h + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o $@ $< $(LIBS_FOR_BUILD) + +CORELDSCRIPT = $(LDSCRIPT) + +# Assembly file to force certain symbols to be exported even if +# they are not used by the core. +EXPORT = export.o + +$(ETARGET): $(CORE_LIB) + $(LD) $(CORELDFLAGS) --strip-debug -o $@ $^ \ + -L$(objdir)/com32/efi/lib -lgnuefi -lefi diff --git a/core/bios/isolinux-debug.asm b/core/bios/isolinux-debug.asm deleted file mode 100644 index 9c74b7cd..00000000 --- a/core/bios/isolinux-debug.asm +++ /dev/null @@ -1,2 +0,0 @@ -%define DEBUG_MESSAGES 1 -%include "isolinux.asm" diff --git a/core/bios/isolinux-c.c b/core/bios/main/isolinux-c.c index b0173e08..b0173e08 100644 --- a/core/bios/isolinux-c.c +++ b/core/bios/main/isolinux-c.c diff --git a/core/bios/isolinux-debug-c.c b/core/bios/main/isolinux-debug-c.c index 14f05005..14f05005 100644 --- a/core/bios/isolinux-debug-c.c +++ b/core/bios/main/isolinux-debug-c.c diff --git a/core/bios/main/isolinux-debug.asm b/core/bios/main/isolinux-debug.asm new file mode 100644 index 00000000..571b3fad --- /dev/null +++ b/core/bios/main/isolinux-debug.asm @@ -0,0 +1,2 @@ +%define DEBUG_MESSAGES 1 +%include "main/isolinux.asm" diff --git a/core/bios/isolinux.asm b/core/bios/main/isolinux.asm index e4eafa21..e4eafa21 100644 --- a/core/bios/isolinux.asm +++ b/core/bios/main/isolinux.asm diff --git a/core/bios/ldlinux-c.c b/core/bios/main/ldlinux-c.c index 1d01d9a7..1d01d9a7 100644 --- a/core/bios/ldlinux-c.c +++ b/core/bios/main/ldlinux-c.c diff --git a/core/bios/ldlinux.asm b/core/bios/main/ldlinux.asm index 050f503b..050f503b 100644 --- a/core/bios/ldlinux.asm +++ b/core/bios/main/ldlinux.asm diff --git a/core/bios/lpxelinux-c.c b/core/bios/main/lpxelinux-c.c index 93b4bc9e..93b4bc9e 100644 --- a/core/bios/lpxelinux-c.c +++ b/core/bios/main/lpxelinux-c.c diff --git a/core/bios/lpxelinux.asm b/core/bios/main/lpxelinux.asm index f41961d4..f41961d4 100644 --- a/core/bios/lpxelinux.asm +++ b/core/bios/main/lpxelinux.asm diff --git a/core/bios/pxelinux-c.c b/core/bios/main/pxelinux-c.c index ac23d822..ac23d822 100644 --- a/core/bios/pxelinux-c.c +++ b/core/bios/main/pxelinux-c.c diff --git a/core/bios/pxelinux.asm b/core/bios/main/pxelinux.asm index 4cfdf1a2..4cfdf1a2 100644 --- a/core/bios/pxelinux.asm +++ b/core/bios/main/pxelinux.asm diff --git a/core/cleanup.c b/core/common/cleanup.c index eceb8e94..eceb8e94 100644 --- a/core/cleanup.c +++ b/core/common/cleanup.c diff --git a/core/conio.c b/core/common/conio.c index e1c14987..e1c14987 100644 --- a/core/conio.c +++ b/core/common/conio.c diff --git a/core/console.c b/core/common/console.c index 3b545bbd..3b545bbd 100644 --- a/core/console.c +++ b/core/common/console.c diff --git a/core/debug.c b/core/common/debug.c index 9bf8b3a6..9bf8b3a6 100644 --- a/core/debug.c +++ b/core/common/debug.c diff --git a/core/dmi.c b/core/common/dmi.c index 9a108341..9a108341 100644 --- a/core/dmi.c +++ b/core/common/dmi.c diff --git a/core/errno.c b/core/common/errno.c index adfd92f8..adfd92f8 100644 --- a/core/errno.c +++ b/core/common/errno.c diff --git a/core/idle.c b/core/common/idle.c index 27cdfc6f..27cdfc6f 100644 --- a/core/idle.c +++ b/core/common/idle.c diff --git a/core/init.c b/core/common/init.c index 45a05093..45a05093 100644 --- a/core/init.c +++ b/core/common/init.c diff --git a/core/path.c b/core/common/path.c index 8e517ca7..8e517ca7 100644 --- a/core/path.c +++ b/core/common/path.c diff --git a/core/pmapi.c b/core/common/pmapi.c index cfdffa69..cfdffa69 100644 --- a/core/pmapi.c +++ b/core/common/pmapi.c diff --git a/core/sysappend.c b/core/common/sysappend.c index 758703ea..758703ea 100644 --- a/core/sysappend.c +++ b/core/common/sysappend.c diff --git a/core/writehex.c b/core/common/writehex.c index fde27037..fde27037 100644 --- a/core/writehex.c +++ b/core/common/writehex.c diff --git a/core/writestr.c b/core/common/writestr.c index fb9de348..fb9de348 100644 --- a/core/writestr.c +++ b/core/common/writestr.c diff --git a/efi/adv.c b/core/efi/adv.c index 7709e088..7709e088 100644 --- a/efi/adv.c +++ b/core/efi/adv.c diff --git a/efi/adv.h b/core/efi/adv.h index 419ad3ba..419ad3ba 100644 --- a/efi/adv.h +++ b/core/efi/adv.h diff --git a/efi/console.c b/core/efi/console.c index d7ed0b4a..d7ed0b4a 100644 --- a/efi/console.c +++ b/core/efi/console.c diff --git a/efi/cp865_8x16.h b/core/efi/cp865_8x16.h index 358a5638..358a5638 100644 --- a/efi/cp865_8x16.h +++ b/core/efi/cp865_8x16.h diff --git a/efi/derivative.c b/core/efi/derivative.c index 12edd705..12edd705 100644 --- a/efi/derivative.c +++ b/core/efi/derivative.c diff --git a/efi/diskio.c b/core/efi/diskio.c index d6a160e1..d6a160e1 100644 --- a/efi/diskio.c +++ b/core/efi/diskio.c diff --git a/efi/efi.h b/core/efi/efi.h index c266532f..c266532f 100644 --- a/efi/efi.h +++ b/core/efi/efi.h diff --git a/efi/fio.c b/core/efi/fio.c index f56cd5b4..f56cd5b4 100644 --- a/efi/fio.c +++ b/core/efi/fio.c diff --git a/efi/fio.h b/core/efi/fio.h index a1bfe68d..a1bfe68d 100644 --- a/efi/fio.h +++ b/core/efi/fio.h diff --git a/efi/i386/linux.S b/core/efi/i386/linux.S index 4049ad4d..4049ad4d 100644 --- a/efi/i386/linux.S +++ b/core/efi/i386/linux.S diff --git a/efi/i386/syslinux.ld b/core/efi/i386/syslinux.ld index bab3fc74..bab3fc74 100644 --- a/efi/i386/syslinux.ld +++ b/core/efi/i386/syslinux.ld diff --git a/efi/main.c b/core/efi/main.c index 5c302744..74e692c2 100644 --- a/efi/main.c +++ b/core/efi/main.c @@ -17,11 +17,10 @@ #include "efi_pxe.h" __export uint16_t PXERetry; -__export char copyright_str[] = "Copyright (C) 2011-" YEAR_STR "\n"; +__export const char copyright_str[] = "Copyright (C) 2011-" YEAR_STR "\n"; uint8_t SerialNotice = 1; -__export char syslinux_banner[] = "Syslinux " VERSION_STR " (EFI; " DATE_STR ")\n"; +__export const char syslinux_banner[] = "Syslinux " VERSION_STR " (EFI; " DATE_STR ")\n"; char CurrentDirName[CURRENTDIR_MAX]; -struct com32_sys_args __com32; uint32_t _IdleTimer = 0; char __lowmem_heap[32]; @@ -1280,7 +1279,7 @@ extern char __bss_end[]; static void efi_setcwd(CHAR16 *dp) { - CHAR16 *c16; + const CHAR16 *c16; char *c8; int i, j; diff --git a/efi/mem.c b/core/efi/mem.c index 67e8221d..67e8221d 100644 --- a/efi/mem.c +++ b/core/efi/mem.c diff --git a/efi/pxe.c b/core/efi/pxe.c index 5b552b39..5b552b39 100644 --- a/efi/pxe.c +++ b/core/efi/pxe.c diff --git a/efi/syslinux.ld b/core/efi/syslinux.ld index e0270537..e0270537 100644 --- a/efi/syslinux.ld +++ b/core/efi/syslinux.ld diff --git a/efi/tcp.c b/core/efi/tcp.c index 6ac4f0d3..6ac4f0d3 100644 --- a/efi/tcp.c +++ b/core/efi/tcp.c diff --git a/efi/udp.c b/core/efi/udp.c index be2f2f2a..be2f2f2a 100644 --- a/efi/udp.c +++ b/core/efi/udp.c diff --git a/efi/vesa.c b/core/efi/vesa.c index b4a541be..b4a541be 100644 --- a/efi/vesa.c +++ b/core/efi/vesa.c diff --git a/efi/x86_64/linux.S b/core/efi/x86_64/linux.S index 29dde94a..29dde94a 100644 --- a/efi/x86_64/linux.S +++ b/core/efi/x86_64/linux.S diff --git a/efi/x86_64/syslinux.ld b/core/efi/x86_64/syslinux.ld index 450641c6..450641c6 100644 --- a/efi/x86_64/syslinux.ld +++ b/core/efi/x86_64/syslinux.ld diff --git a/core/codepage.S b/core/fs/fat/codepage.S index 6fb046f6..8ddd628b 100644 --- a/core/codepage.S +++ b/core/fs/fat/codepage.S @@ -2,5 +2,5 @@ .globl codepage .hidden codepage codepage: - .incbin "codepage.cp" + .incbin CODEPAGE .size codepage, .-codepage diff --git a/core/fs/ntfs/ntfs.c b/core/fs/ntfs/ntfs.c index 54213668..df10c08b 100644 --- a/core/fs/ntfs/ntfs.c +++ b/core/fs/ntfs/ntfs.c @@ -31,7 +31,6 @@ #include <klibc/compiler.h> #include <ctype.h> -#include "codepage.h" #include "ntfs.h" #include "runlist.h" diff --git a/core/fs/pxe/dhcp_option.c b/core/fs/pxe/dhcp_option.c index 88102cbe..374fe48c 100644 --- a/core/fs/pxe/dhcp_option.c +++ b/core/fs/pxe/dhcp_option.c @@ -2,9 +2,9 @@ #include <string.h> #include <core.h> #include <x86/cpu.h> -#include <lwip/opt.h> /* DNS_MAX_SERVERS */ #include <dprintf.h> #include "core_pxe.h" +#include "net.h" char LocalDomain[256]; diff --git a/core/fs/pxe/ftp.c b/core/fs/pxe/ftp.c index 6893e540..b1bca41f 100644 --- a/core/fs/pxe/ftp.c +++ b/core/fs/pxe/ftp.c @@ -20,7 +20,6 @@ #include <minmax.h> #include <x86/cpu.h> #include <netinet/in.h> -#include <lwip/api.h> #include "core.h" #include "fs.h" #include "core_pxe.h" diff --git a/core/fs/pxe/http.c b/core/fs/pxe/http.c index 5b8fce11..2a03bb1d 100644 --- a/core/fs/pxe/http.c +++ b/core/fs/pxe/http.c @@ -1,6 +1,6 @@ #include <syslinux/sysappend.h> #include <ctype.h> -#include <lwip/api.h> +#include <limits.h> #include "core_pxe.h" #include "version.h" #include "url.h" diff --git a/core/fs/xfs/xfs.c b/core/fs/xfs/xfs.c index 6f459737..0db261d2 100644 --- a/core/fs/xfs/xfs.c +++ b/core/fs/xfs/xfs.c @@ -27,7 +27,6 @@ #include <klibc/compiler.h> #include <ctype.h> -#include "codepage.h" #include "xfs_types.h" #include "xfs_sb.h" #include "xfs_ag.h" diff --git a/core/include/net.h b/core/include/net.h index c64191d8..fa8554e5 100644 --- a/core/include/net.h +++ b/core/include/net.h @@ -5,6 +5,14 @@ #include <stdbool.h> #include <stddef.h> +#ifdef __FIRMWARE_BIOS__ +# include <lwip/opt.h> +# include <lwip/api.h> +#else +# define DNS_MAX_SERVERS 4 +typedef int err_t; +#endif + void net_core_init(void); void net_parse_dhcp(void); diff --git a/efi/Makefile b/efi/Makefile deleted file mode 100644 index 780ff18d..00000000 --- a/efi/Makefile +++ /dev/null @@ -1,97 +0,0 @@ -## ----------------------------------------------------------------------- -## -## Copyright 2011 Intel Corporation; author: Matt Fleming -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, Inc., 53 Temple Place Ste 330, -## Boston MA 02111-1307, USA; either version 2 of the License, or -## (at your option) any later version; incorporated herein by reference. -## -## ----------------------------------------------------------------------- - -VPATH = $(SRC) -include $(MAKEDIR)/elf.mk -include $(MAKEDIR)/efi.mk - -CC_FOR_BUILD ?= $(CC) - -# Upstream gnu-efi has old-style function definitions. -CFLAGS += -Wno-strict-prototypes - -CORE_CSRC := $(sort $(shell find '$(core)' -name '*.c' -print)) -CORE_COBJ := $(subst $(core),$(OBJ)/../core,$(patsubst %.c,%.o,$(CORE_CSRC))) - -# We don't want to include any of the networking stack or the thread -# code since it will be implemented completely differently for EFI. -FILTERED_OBJS := $(OBJ)/../core/bios/% \ - $(patsubst $(core)/%,$(OBJ)/../core/%/%,\ - $(shell find '$(core)' -type d -name tests)) - -CORE_OBJS = $(filter-out $(FILTERED_OBJS),$(CORE_COBJ)) - -LIB_OBJS = $(addprefix $(objdir)/com32/lib/,$(CORELIBOBJS)) \ - $(LIBEFI) - -CSRC = $(sort $(wildcard $(SRC)/*.c)) -OBJS = $(subst $(SRC)/,,$(filter-out %wrapper.o, $(patsubst %.c,%.o,$(CSRC)))) - -OBJS += $(objdir)/core/codepage.o $(ARCH)/linux.o - -# The DATE is set on the make command line when building binaries for -# official release. Otherwise, substitute a hex string that is pretty much -# guaranteed to be unique to be unique from build to build. -ifndef HEXDATE -HEXDATE := $(shell $(PERL) $(SRC)/../now.pl $(SRCS)) -endif -ifndef DATE -DATE := $(shell sh $(SRC)/../gen-id.sh $(VERSION) $(HEXDATE)) -endif -CFLAGS += -DDATE_STR='"$(DATE)"' - -$(OBJ)/$(ARCH): - mkdir -p $@ - -$(OBJS): | $(OBJ)/$(ARCH) - -# The targets to build in this directory -BTARGET = syslinux.efi - -syslinux.so: $(OBJS) $(CORE_OBJS) $(LIB_OBJS) - $(LD) $(LDFLAGS) --strip-debug -o $@ $^ -lgnuefi -lefi - -# We need to rename the .hash section because the EFI firmware -# linker really doesn't like it. -# $(OBJCOPY) --rename-section .gnu.hash=.sdata,load,data,alloc $^ $@ -#syslinux.so: syslinux1.so -# cp $^ $@ - -wrapper: wrapper.c - $(CC_FOR_BUILD) $^ -o $@ - -# -# Build the wrapper app and wrap our .so to produce a .efi -syslinux.efi: syslinux.so wrapper - $(OBJ)/wrapper syslinux.so $@ - -all: $(BTARGET) - -codepage.o: ../codepage/cp865.cp - cp $(objdir)/../codepage/cp865.cp codepage.cp - $(CC) $(SFLAGS) -c -o $@ $(core)/codepage.S - -install: - install -m 755 $(BTARGET) $(INSTALLROOT)$(AUXDIR) - -strip: - -tidy dist: - rm -f *.so *.o wrapper - find . \( -name \*.o -o -name \*.a -o -name .\*.d -o -name \*.tmp \) -print0 | \ - xargs -0r rm -f - $(topdir)/efi/clean-gnu-efi.sh $(EFI_SUBARCH) $(objdir) - -clean: tidy - -spotless: clean - rm -f $(BTARGET) diff --git a/efi/build-gnu-efi.sh b/efi/build-gnu-efi.sh deleted file mode 100755 index 63460b69..00000000 --- a/efi/build-gnu-efi.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -set -e - -# Initialise the gnu-efi submodule and ensure the source is up-to-date. -# Then build and install it for the given architecture. - -if [ $# -lt 2 ]; then -cat <<EOF -Usage: $0: <arch> <objdir> - -Build the <arch> gnu-efi libs and header files and install in <objdir>. - - <arch> - A gnu-efi \$ARCH argument, i.e. ia32, x86_64 - <objdir> - The Syslinux object directory - -EOF - exit 1 -fi - -ARCH="$1" -objdir="$(readlink -f $2)" - -if [ ! -e ../version.h ]; then - printf "build-gnu-efi.sh: Cannot be run outside Syslinux object tree\n" - pwd - exit 1 -fi - -( - cd ../.. - if [ -d .git ]; then - git submodule update --init - fi -) - -mkdir -p "$objdir/gnu-efi" -cd "$objdir/gnu-efi" - -EFIDIR="$(readlink -f "$objdir/../gnu-efi")" - -make SRCDIR="$EFIDIR" TOPDIR="$EFIDIR" -f "$EFIDIR/Makefile" ARCH=$ARCH -make SRCDIR="$EFIDIR" TOPDIR="$EFIDIR" -f "$EFIDIR/Makefile" ARCH=$ARCH PREFIX="$objdir" install - -cd "$objdir/efi" diff --git a/efi/check-gnu-efi.sh b/efi/check-gnu-efi.sh deleted file mode 100755 index 7d99e9ab..00000000 --- a/efi/check-gnu-efi.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -# Verify that gnu-efi is installed in the object directory for our -# firmware. If it isn't, build it. - -if [ $# -lt 2 ]; then -cat <<EOF -Usage: $0: <arch> <objdir> - -Check for gnu-efi libraries and header files in <objdir> and, if none -exist, build and install them. - - <arch> - A gnu-efi \$ARCH argument, i.e. ia32, x86_64 - <objdir> - The Syslinux object directory - -EOF - exit 1 -fi - -ARCH=$1 -objdir=$2 - -if [ ! \( -f "$objdir/include/efi/$ARCH/efibind.h" -a -f "$objdir/lib/libefi.a" -a -f "$objdir/lib/libgnuefi.a" \) ]; then - # Build the external project with a clean make environment, as - # Syslinux disables built-in implicit rules. - export MAKEFLAGS= - - ../../efi/build-gnu-efi.sh $ARCH "$objdir" - if [ $? -ne 0 ]; then - printf "Failed to build gnu-efi. " - printf "Execute the following command for full details: \n\n" - printf "build-gnu-efi.sh $ARCH $objdir\n\n" - - exit 1 - fi -else - printf "skip gnu-efi build/install\n" -fi diff --git a/efi/clean-gnu-efi.sh b/efi/clean-gnu-efi.sh deleted file mode 100755 index bc950261..00000000 --- a/efi/clean-gnu-efi.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -set -e - -# Initialise the gnu-efi submodule and ensure the source is up-to-date. -# Then build and install it for the given architecture. - -if [ $# -lt 2 ]; then -cat <<EOF -Usage: $0: <arch> <objdir> - -Build the <arch> gnu-efi libs and header files and install in <objdir>. - - <arch> - A gnu-efi \$ARCH argument, i.e. ia32, x86_64 - <objdir> - The Syslinux object directory - -EOF - exit 1 -fi - -ARCH="$1" -objdir=$(readlink -f "$2") - -( - cd ../.. - if [ -d .git ]; then - git submodule update --init - fi -) - -if [ -d "$objdir/gnu-efi" ];then - cd "$objdir/gnu-efi" - EFIDIR="$(readlink -f "$objdir/../gnu-efi")" - make SRCDIR="$EFIDIR" TOPDIR="$EFIDIR" -f "$EFIDIR/Makefile" ARCH=$ARCH clean -fi - -cd "$objdir/efi" diff --git a/mk/bios.mk b/mk/bios.mk new file mode 100644 index 00000000..89d8f00d --- /dev/null +++ b/mk/bios.mk @@ -0,0 +1 @@ +GCCOPT += -mregparm=3 -DREGPARM=3 diff --git a/mk/build.mk b/mk/build.mk index 9becd412..de0e90d8 100644 --- a/mk/build.mk +++ b/mk/build.mk @@ -16,18 +16,22 @@ ## include $(MAKEDIR)/syslinux.mk -OPTFLAGS = -g -Os -INCLUDES = -CFLAGS = $(WARNFLAGS) -D_FILE_OFFSET_BITS=64 \ - $(OPTFLAGS) $(INCLUDES) -LDFLAGS = -LIBS = +OPTFLAGS = -g -O2 +INCLUDES = -I$(SRC)/include +CFLAGS_FOR_BUILD ?= $(WARNFLAGS) -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) +CFLAGS_FOR_BUILD += $(INCLUDES) +LDFLAGS_FOR_BUILD = +LIBS_FOR_BUILD = .SUFFIXES: .c .o .S .s .i .elf .com .bin .asm .lst .c32 .lss %.o: %.c - $(CC) $(UMAKEDEPS) $(CFLAGS) -c -o $@ $< + $(CC_FOR_BUILD) $(UMAKEDEPS) $(CFLAGS_FOR_BUILD) -c -o $@ $< %.i: %.c - $(CC) $(UMAKEDEPS) $(CFLAGS) -E -o $@ $< + $(CC_FOR_BUILD) $(UMAKEDEPS) $(CFLAGS_FOR_BUILD) -E -o $@ $< %.s: %.c - $(CC) $(UMAKEDEPS) $(CFLAGS) -S -o $@ $< + $(CC_FOR_BUILD) $(UMAKEDEPS) $(CFLAGS_FOR_BUILD) -S -o $@ $< +%: %.o + $(CC_FOR_BUILD) $(UMAKEDEPS) $(CFLAGS_FOR_BUILD) \ + $(LDFLAGS_FOR_BUILD) -o $@ $^ $(LIBS_FOR_BUILD) + @@ -1,54 +1,32 @@ -include $(MAKEDIR)/syslinux.mk - -com32 = $(topdir)/com32 -core = $(topdir)/core - # Support IA32 and x86_64 platforms with one build # Set up architecture specifics; for cross compilation, set ARCH as apt # gnuefi sets up architecture specifics in ia32 or x86_64 sub directories # set up the LIBDIR and EFIINC for building for the appropriate architecture -GCCOPT := $(call gcc_ok,-fno-stack-protector,) -EFIINC = $(objdir)/include/efi -LIBDIR = $(objdir)/lib +GCCOPT += -DEFI_FUNCTION_WRAPPER +GCCOPT += -mno-red-zone +GCCOPT += -fshort-wchar + +FWFLAGS = -Wno-unused-parameter -Wno-strict-prototypes -ifeq ($(ARCH),i386) - ARCHOPT = -m32 -march=i386 - EFI_SUBARCH = ia32 -endif -ifeq ($(ARCH),x86_64) - ARCHOPT = -m64 -march=x86-64 - EFI_SUBARCH = $(ARCH) -endif +FWLIBS = -#LIBDIR=/usr/lib +EFIINCDIR = $(objdir)/com32/efi/include/efi +EFILIBDIR = $(objdir)/com32/efi/lib + +EFI_SUBARCH := $(ARCH:i386=ia32) FORMAT=efi-app-$(EFI_SUBARCH) -CFLAGS = -I$(EFIINC) -I$(EFIINC)/$(EFI_SUBARCH) \ - -DEFI_FUNCTION_WRAPPER -fPIC -fshort-wchar -ffreestanding \ - -Wall -I$(com32)/include -I$(com32)/include/sys \ - -I$(core)/include -I$(core)/ $(ARCHOPT) \ - -I$(com32)/lib/ -I$(com32)/libutil/include -std=gnu99 \ - -DELF_DEBUG -DSYSLINUX_EFI -I$(objdir) \ - $(GCCWARN) -D__COM32__ -D__FIRMWARE_$(FIRMWARE)__ -mno-red-zone \ - -DLDLINUX=\"$(LDLINUX)\" -fvisibility=hidden \ - -Wno-unused-parameter $(GCCOPT) +INCLUDE += -I$(EFIINCDIR) -I$(EFIINCDIR)/$(EFI_SUBARCH) -CRT0 := $(LIBDIR)/crt0-efi-$(EFI_SUBARCH).o -LDSCRIPT := $(LIBDIR)/elf_$(EFI_SUBARCH)_efi.lds +CRT0 = $(LIBDIR)/crt0-efi-$(EFI_SUBARCH).o +LDSCRIPT = $(LIBDIR)/elf_$(EFI_SUBARCH)_efi.lds -LDFLAGS = -T $(SRC)/$(ARCH)/syslinux.ld -Bsymbolic -pie -nostdlib -znocombreloc \ +MAIN_LDFLAGS += -T $(EFILIBSRC)/$(ARCH)/syslinux.ld -Bsymbolic -pie -nostdlib -znocombreloc \ -L$(LIBDIR) --hash-style=gnu -m elf_$(ARCH) $(CRT0) -E -SFLAGS = $(GCCOPT) $(GCCWARN) $(ARCHOPT) \ - -fomit-frame-pointer -D__COM32__ -D__FIRMWARE_$(FIRMWARE)__ \ - -nostdinc -iwithprefix include \ - -I$(com32)/libutil/include -I$(com32)/include -I$(com32)/include/sys $(GPLINCLUDE) - -LIBEFI = $(objdir)/lib/libefi.a +SFLAGS = $(CFLAGS) -D__ASSEMBLY__ -$(LIBEFI): - @echo Building gnu-efi for $(EFI_SUBARCH) - $(topdir)/efi/check-gnu-efi.sh $(EFI_SUBARCH) $(objdir) +LIBEFI = $(com32)/efi/lib/libefi.a %.o: %.S # Cancel old rule @@ -59,7 +37,3 @@ $(LIBEFI): %.o: %.c $(LIBEFI) $(CC) $(CFLAGS) -c -o $@ $< - -#%.efi: %.so -# $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \ -# -j .rela -j .reloc --target=$(FORMAT) $*.so $@ @@ -14,22 +14,28 @@ ## ELF common configurables ## +# Needs to start out as null otherwise we get a recursive error +GCCOPT := + include $(MAKEDIR)/syslinux.mk +include $(MAKEDIR)/$(fwclass).mk # Support IA32 and x86_64 platforms with one build # Set up architecture specifics; for cross compilation, set ARCH as apt -GCCOPT := $(call gcc_ok,-std=gnu99,) +GCCOPT += $(call gcc_ok,-std=gnu99,) ifeq ($(ARCH),i386) - GCCOPT += $(call gcc_ok,-m32,) - GCCOPT += $(call gcc_ok,-march=i386) + GCCOPT += -m32 -march=i386 GCCOPT += $(call gcc_ok,-mpreferred-stack-boundary=2,) + NASMFLAGS += -f elf endif ifeq ($(ARCH),x86_64) - GCCOPT += $(call gcc_ok,-m64,) + GCCOPT += -m64 -march=x86-64 GCCOPT += $(call gcc_ok,-march=x86-64) - #let preferred-stack-boundary be default (=4) +# let preferred-stack-boundary be default (=4) + NASMFLAGS += -f elf64 endif GCCOPT += -Os -fomit-frame-pointer +GCCOPT += $(call gcc_ok,-mtune=generic,) GCCOPT += $(call gcc_ok,-fno-stack-protector,) GCCOPT += $(call gcc_ok,-fwrapv,) GCCOPT += $(call gcc_ok,-freg-struct-return,) @@ -44,12 +50,6 @@ GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0) GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0) GCCOPT += $(call gcc_ok,-DNO_PLT -fno-plt -fvisibility=protected) -ifeq ($(FWCLASS),EFI) -GCCOPT += -mno-red-zone -else -GCCOPT += -mregparm=3 -DREGPARM=3 -endif - com32 = $(topdir)/com32 core = $(topdir)/core @@ -70,10 +70,10 @@ LIBLDLINUX = $(objdir)/ldlinux/$(LDLINUX) LIBCOM32 = $(objdir)/com32/lib/libcom32.c32 LIBUTIL = $(objdir)/com32/libutil/libutil.c32 -INCLUDE = -nostdinc -iwithprefix include -I$(SRC) \ +INCLUDE += -nostdinc -iwithprefix include -I$(SRC) \ -I$(com32)/libutil/include -I$(com32)/include \ - -I$(com32)/include/sys $(GPLINCLUDE) -I$(core)/include \ - -I$(objdir) + -I$(com32)/include/sys $(GPLINCLUDE) \ + -I$(core)/include -I$(core)/$(fwclass)/include -I$(objdir) OPTFLAGS = -Os -march=$(ARCH) -falign-functions=0 -falign-jumps=0 \ -falign-labels=0 -ffast-math -fomit-frame-pointer @@ -83,7 +83,7 @@ WARNFLAGS = $(GCCWARN) -Wpointer-arith -Wwrite-strings \ REQFLAGS = $(GCCOPT) -g -D__COM32__ -D__FIRMWARE_$(FIRMWARE)__ \ -DLDLINUX=\"$(LDLINUX)\" $(INCLUDE) -CFLAGS = $(REQFLAGS) $(OPTFLAGS) $(WARNFLAGS) +CFLAGS = $(REQFLAGS) $(OPTFLAGS) $(WARNFLAGS) $(FWFLAGS) SFLAGS = $(REQFLAGS) -D__ASSEMBLY__ LDSCRIPT = $(com32)/lib/$(ARCH)/elf.ld @@ -94,9 +94,7 @@ MAIN_LDFLAGS = -m elf_$(ARCH) -Bsymbolic --hash-style=gnu \ LDFLAGS = $(MAIN_LDFLAGS) -T $(LDSCRIPT) ifeq ($(ARCH),i386) -NASMFLAGS += -f elf else -NASMFLAGS += -f elf64 endif NASMDEBUG = -g -F dwarf NASMFLAGS += $(NASMDEBUG) -D__$(ARCH)__ -I$(SRC)/ $(filter -D%,$(CFLAGS)) diff --git a/mk/syslinux.mk b/mk/syslinux.mk index 7154ceb4..bf0c4310 100644 --- a/mk/syslinux.mk +++ b/mk/syslinux.mk @@ -75,6 +75,8 @@ MKISOFS = mkisofs SED = sed WGET = wget +CC_FOR_BUILD ?= $(CC) + com32 = $(topdir)/com32 # Architecture definition diff --git a/lzo/.gitignore b/prepcore/bios/.gitignore index 04202daf..04202daf 100644 --- a/lzo/.gitignore +++ b/prepcore/bios/.gitignore diff --git a/lzo/Makefile b/prepcore/bios/Makefile index 29f1fa62..7175bc03 100644 --- a/lzo/Makefile +++ b/prepcore/bios/Makefile @@ -13,9 +13,8 @@ VPATH = $(SRC) include $(MAKEDIR)/build.mk -INCLUDES += -I$(SRC)/include - -LIBOBJS = $(patsubst %.c,%.o,$(subst $(SRC)/,,$(sort $(wildcard $(SRC)/src/*.c)))) +LIBSRCS = $(sort $(wildcard $(SRC)/src/*.c)) +LIBOBJS = $(LIBSRCS:$(SRC)/%.c=%.o) LIB = lzo.a BINS = prepcore @@ -29,8 +28,7 @@ $(LIB) : $(LIBOBJS) $(AR) cq $@ $^ $(RANLIB) $@ -prepcore : prepcore.o $(LIB) - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) +prepcore: prepcore.o $(LIB) tidy dist clean spotless: rm -f $(BINS) diff --git a/lzo/doc/LZO.TXT b/prepcore/bios/doc/LZO.TXT index 2d3b5aa7..2d3b5aa7 100644 --- a/lzo/doc/LZO.TXT +++ b/prepcore/bios/doc/LZO.TXT diff --git a/lzo/include/lzo/lzo1.h b/prepcore/bios/include/lzo/lzo1.h index 433d91d9..433d91d9 100644 --- a/lzo/include/lzo/lzo1.h +++ b/prepcore/bios/include/lzo/lzo1.h diff --git a/lzo/include/lzo/lzo1a.h b/prepcore/bios/include/lzo/lzo1a.h index 46d7e75d..46d7e75d 100644 --- a/lzo/include/lzo/lzo1a.h +++ b/prepcore/bios/include/lzo/lzo1a.h diff --git a/lzo/include/lzo/lzo1b.h b/prepcore/bios/include/lzo/lzo1b.h index 3295b9e7..3295b9e7 100644 --- a/lzo/include/lzo/lzo1b.h +++ b/prepcore/bios/include/lzo/lzo1b.h diff --git a/lzo/include/lzo/lzo1c.h b/prepcore/bios/include/lzo/lzo1c.h index 6fa3cf92..6fa3cf92 100644 --- a/lzo/include/lzo/lzo1c.h +++ b/prepcore/bios/include/lzo/lzo1c.h diff --git a/lzo/include/lzo/lzo1f.h b/prepcore/bios/include/lzo/lzo1f.h index adc6b0d9..adc6b0d9 100644 --- a/lzo/include/lzo/lzo1f.h +++ b/prepcore/bios/include/lzo/lzo1f.h diff --git a/lzo/include/lzo/lzo1x.h b/prepcore/bios/include/lzo/lzo1x.h index ef591db7..ef591db7 100644 --- a/lzo/include/lzo/lzo1x.h +++ b/prepcore/bios/include/lzo/lzo1x.h diff --git a/lzo/include/lzo/lzo1y.h b/prepcore/bios/include/lzo/lzo1y.h index 37370c78..37370c78 100644 --- a/lzo/include/lzo/lzo1y.h +++ b/prepcore/bios/include/lzo/lzo1y.h diff --git a/lzo/include/lzo/lzo1z.h b/prepcore/bios/include/lzo/lzo1z.h index b097e119..b097e119 100644 --- a/lzo/include/lzo/lzo1z.h +++ b/prepcore/bios/include/lzo/lzo1z.h diff --git a/lzo/include/lzo/lzo2a.h b/prepcore/bios/include/lzo/lzo2a.h index 1c9ef2e9..1c9ef2e9 100644 --- a/lzo/include/lzo/lzo2a.h +++ b/prepcore/bios/include/lzo/lzo2a.h diff --git a/lzo/include/lzo/lzo_asm.h b/prepcore/bios/include/lzo/lzo_asm.h index d5f6ff63..d5f6ff63 100644 --- a/lzo/include/lzo/lzo_asm.h +++ b/prepcore/bios/include/lzo/lzo_asm.h diff --git a/lzo/include/lzo/lzoconf.h b/prepcore/bios/include/lzo/lzoconf.h index 02fb202d..02fb202d 100644 --- a/lzo/include/lzo/lzoconf.h +++ b/prepcore/bios/include/lzo/lzoconf.h diff --git a/lzo/include/lzo/lzodefs.h b/prepcore/bios/include/lzo/lzodefs.h index f4ae9487..f4ae9487 100644 --- a/lzo/include/lzo/lzodefs.h +++ b/prepcore/bios/include/lzo/lzodefs.h diff --git a/lzo/include/lzo/lzoutil.h b/prepcore/bios/include/lzo/lzoutil.h index 23ea5229..23ea5229 100644 --- a/lzo/include/lzo/lzoutil.h +++ b/prepcore/bios/include/lzo/lzoutil.h diff --git a/lzo/prepcore.c b/prepcore/bios/prepcore.c index b5ebe88b..b5ebe88b 100644 --- a/lzo/prepcore.c +++ b/prepcore/bios/prepcore.c diff --git a/lzo/src/compr1b.h b/prepcore/bios/src/compr1b.h index 32b22669..32b22669 100644 --- a/lzo/src/compr1b.h +++ b/prepcore/bios/src/compr1b.h diff --git a/lzo/src/compr1c.h b/prepcore/bios/src/compr1c.h index 566ba447..566ba447 100644 --- a/lzo/src/compr1c.h +++ b/prepcore/bios/src/compr1c.h diff --git a/lzo/src/config1x.h b/prepcore/bios/src/config1x.h index cbbc1672..cbbc1672 100644 --- a/lzo/src/config1x.h +++ b/prepcore/bios/src/config1x.h diff --git a/lzo/src/lzo1_d.ch b/prepcore/bios/src/lzo1_d.ch index e4dff04e..e4dff04e 100644 --- a/lzo/src/lzo1_d.ch +++ b/prepcore/bios/src/lzo1_d.ch diff --git a/lzo/src/lzo1x_1.c b/prepcore/bios/src/lzo1x_1.c index 2bdecce0..2bdecce0 100644 --- a/lzo/src/lzo1x_1.c +++ b/prepcore/bios/src/lzo1x_1.c diff --git a/lzo/src/lzo1x_1k.c b/prepcore/bios/src/lzo1x_1k.c index cbfa2344..cbfa2344 100644 --- a/lzo/src/lzo1x_1k.c +++ b/prepcore/bios/src/lzo1x_1k.c diff --git a/lzo/src/lzo1x_1l.c b/prepcore/bios/src/lzo1x_1l.c index ee857bce..ee857bce 100644 --- a/lzo/src/lzo1x_1l.c +++ b/prepcore/bios/src/lzo1x_1l.c diff --git a/lzo/src/lzo1x_1o.c b/prepcore/bios/src/lzo1x_1o.c index 28fdaffc..28fdaffc 100644 --- a/lzo/src/lzo1x_1o.c +++ b/prepcore/bios/src/lzo1x_1o.c diff --git a/lzo/src/lzo1x_9x.c b/prepcore/bios/src/lzo1x_9x.c index 9de75df0..9de75df0 100644 --- a/lzo/src/lzo1x_9x.c +++ b/prepcore/bios/src/lzo1x_9x.c diff --git a/lzo/src/lzo1x_c.ch b/prepcore/bios/src/lzo1x_c.ch index 805f71d3..805f71d3 100644 --- a/lzo/src/lzo1x_c.ch +++ b/prepcore/bios/src/lzo1x_c.ch diff --git a/lzo/src/lzo1x_d.ch b/prepcore/bios/src/lzo1x_d.ch index aa0a8e08..aa0a8e08 100644 --- a/lzo/src/lzo1x_d.ch +++ b/prepcore/bios/src/lzo1x_d.ch diff --git a/lzo/src/lzo1x_d1.c b/prepcore/bios/src/lzo1x_d1.c index 2342afdb..2342afdb 100644 --- a/lzo/src/lzo1x_d1.c +++ b/prepcore/bios/src/lzo1x_d1.c diff --git a/lzo/src/lzo1x_d2.c b/prepcore/bios/src/lzo1x_d2.c index 477522cb..477522cb 100644 --- a/lzo/src/lzo1x_d2.c +++ b/prepcore/bios/src/lzo1x_d2.c diff --git a/lzo/src/lzo1x_d3.c b/prepcore/bios/src/lzo1x_d3.c index 8da06923..8da06923 100644 --- a/lzo/src/lzo1x_d3.c +++ b/prepcore/bios/src/lzo1x_d3.c diff --git a/lzo/src/lzo1x_o.c b/prepcore/bios/src/lzo1x_o.c index 5b3dbafd..5b3dbafd 100644 --- a/lzo/src/lzo1x_o.c +++ b/prepcore/bios/src/lzo1x_o.c diff --git a/lzo/src/lzo1x_oo.ch b/prepcore/bios/src/lzo1x_oo.ch index ebb406ff..ebb406ff 100644 --- a/lzo/src/lzo1x_oo.ch +++ b/prepcore/bios/src/lzo1x_oo.ch diff --git a/lzo/src/lzo_conf.h b/prepcore/bios/src/lzo_conf.h index 3543b140..3543b140 100644 --- a/lzo/src/lzo_conf.h +++ b/prepcore/bios/src/lzo_conf.h diff --git a/lzo/src/lzo_crc.c b/prepcore/bios/src/lzo_crc.c index adb72381..adb72381 100644 --- a/lzo/src/lzo_crc.c +++ b/prepcore/bios/src/lzo_crc.c diff --git a/lzo/src/lzo_dict.h b/prepcore/bios/src/lzo_dict.h index c3dd52bf..c3dd52bf 100644 --- a/lzo/src/lzo_dict.h +++ b/prepcore/bios/src/lzo_dict.h diff --git a/lzo/src/lzo_dll.ch b/prepcore/bios/src/lzo_dll.ch index 3b80edff..3b80edff 100644 --- a/lzo/src/lzo_dll.ch +++ b/prepcore/bios/src/lzo_dll.ch diff --git a/lzo/src/lzo_func.h b/prepcore/bios/src/lzo_func.h index f11f2ae3..f11f2ae3 100644 --- a/lzo/src/lzo_func.h +++ b/prepcore/bios/src/lzo_func.h diff --git a/lzo/src/lzo_init.c b/prepcore/bios/src/lzo_init.c index 4128a602..4128a602 100644 --- a/lzo/src/lzo_init.c +++ b/prepcore/bios/src/lzo_init.c diff --git a/lzo/src/lzo_mchw.ch b/prepcore/bios/src/lzo_mchw.ch index 8273612a..8273612a 100644 --- a/lzo/src/lzo_mchw.ch +++ b/prepcore/bios/src/lzo_mchw.ch diff --git a/lzo/src/lzo_ptr.c b/prepcore/bios/src/lzo_ptr.c index 2896b70b..2896b70b 100644 --- a/lzo/src/lzo_ptr.c +++ b/prepcore/bios/src/lzo_ptr.c diff --git a/lzo/src/lzo_ptr.h b/prepcore/bios/src/lzo_ptr.h index 1e23548f..1e23548f 100644 --- a/lzo/src/lzo_ptr.h +++ b/prepcore/bios/src/lzo_ptr.h diff --git a/lzo/src/lzo_str.c b/prepcore/bios/src/lzo_str.c index a7ca638f..a7ca638f 100644 --- a/lzo/src/lzo_str.c +++ b/prepcore/bios/src/lzo_str.c diff --git a/lzo/src/lzo_supp.h b/prepcore/bios/src/lzo_supp.h index f7d0351e..f7d0351e 100644 --- a/lzo/src/lzo_supp.h +++ b/prepcore/bios/src/lzo_supp.h diff --git a/lzo/src/lzo_swd.ch b/prepcore/bios/src/lzo_swd.ch index 566aca45..566aca45 100644 --- a/lzo/src/lzo_swd.ch +++ b/prepcore/bios/src/lzo_swd.ch diff --git a/lzo/src/lzo_util.c b/prepcore/bios/src/lzo_util.c index 1f2a4d54..1f2a4d54 100644 --- a/lzo/src/lzo_util.c +++ b/prepcore/bios/src/lzo_util.c diff --git a/lzo/src/miniacc.h b/prepcore/bios/src/miniacc.h index 315a20b2..315a20b2 100644 --- a/lzo/src/miniacc.h +++ b/prepcore/bios/src/miniacc.h diff --git a/lzo/src/stats1a.h b/prepcore/bios/src/stats1a.h index 5c2af38c..5c2af38c 100644 --- a/lzo/src/stats1a.h +++ b/prepcore/bios/src/stats1a.h diff --git a/lzo/src/stats1b.h b/prepcore/bios/src/stats1b.h index 453e7ab3..453e7ab3 100644 --- a/lzo/src/stats1b.h +++ b/prepcore/bios/src/stats1b.h diff --git a/lzo/src/stats1c.h b/prepcore/bios/src/stats1c.h index 7f1f4cd9..7f1f4cd9 100644 --- a/lzo/src/stats1c.h +++ b/prepcore/bios/src/stats1c.h diff --git a/prepcore/efi/Makefile b/prepcore/efi/Makefile new file mode 100644 index 00000000..bfce0c4b --- /dev/null +++ b/prepcore/efi/Makefile @@ -0,0 +1,30 @@ +## -*- makefile -*- ------------------------------------------------------ +## +## Copyright 2019 Intel Corporation; author: H. Peter Anvin +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, Inc., 53 Temple Place Ste 330, +## Boston MA 02111-1307, USA; either version 2 of the License, or +## (at your option) any later version; incorporated herein by reference. +## +## ----------------------------------------------------------------------- + +include $(MAKEDIR)/build.mk + +INCLUDES += -I$(SRC)/include + +BINS = prepcore + +all : $(BINS) + +tidy dist clean spotless: + rm -f $(BINS) + rm -f *.o *.a .*.d + rm -f */*.o */*.a */.*.d + +installer: + +prepcore: prepcore.o + +-include .*.d */.*.d diff --git a/efi/wrapper.c b/prepcore/efi/prepcore.c index 19881248..04033464 100644 --- a/efi/wrapper.c +++ b/prepcore/efi/prepcore.c @@ -14,7 +14,7 @@ * point. Once the Syslinux ELF shared object has control we can do * whatever we want. */ -#include <linux/elf.h> +#include <elf.h> #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> @@ -22,17 +22,7 @@ #include <string.h> #include <unistd.h> -#include "wrapper.h" - -#if __SIZEOF_POINTER__ == 4 -typedef Elf32_Ehdr Elf_Ehdr; -typedef Elf32_Addr Elf_Addr; -#elif __SIZEOF_POINTER__ == 8 -typedef Elf64_Ehdr Elf_Ehdr; -typedef Elf64_Addr Elf_Addr; -#else -#error "unsupported architecture" -#endif +#include "prepcore.h" /* * 'so_memsz' is the size of the ELF shared object once loaded. @@ -163,10 +153,10 @@ int main(int argc, char **argv) { Elf32_Ehdr e32_hdr; Elf64_Ehdr e64_hdr; - __uint32_t entry; - __uint8_t class; - __uint64_t phoff = 0; - __uint16_t phnum = 0, phentsize = 0; + uint32_t entry; + uint8_t class; + uint64_t phoff = 0; + uint16_t phnum = 0, phentsize = 0; unsigned char *id; FILE *f_in, *f_out; void *buf; diff --git a/efi/wrapper.h b/prepcore/efi/prepcore.h index 0e6b38ea..0e6b38ea 100644 --- a/efi/wrapper.h +++ b/prepcore/efi/prepcore.h |