From dc7d6b204d8ef2178a8fd4f0da28ec1ff6967913 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 20 Apr 2017 17:09:42 +0200 Subject: [PATCH] make.sh: Cleanup of polluted environment The build environment is using a number of variables which occasionally conflicted with some other build systems. This patch cleans that up by renaming some variables and later unexporting them in the lfs files. Signed-off-by: Michael Tremer --- lfs/Config | 11 ++-- lfs/backports | 6 +- lfs/binutils | 12 ++-- lfs/cdrom | 14 ++--- lfs/clamav | 2 +- lfs/core-updates | 2 +- lfs/flash-images | 14 ++--- lfs/gcc | 8 +-- lfs/glibc | 33 +++++----- lfs/gmp | 6 +- lfs/gmp-compat | 2 +- lfs/initscripts | 2 +- lfs/installer | 2 +- lfs/linux | 34 +++------- lfs/memtest | 2 +- lfs/openssl | 8 +-- lfs/pakfire | 4 +- lfs/php | 2 +- lfs/sources-iso | 2 +- lfs/stage2 | 2 +- lfs/strongswan | 2 +- lfs/unzip | 2 +- lfs/vdr_dvbapi | 2 +- lfs/xen-image | 2 +- make.sh | 52 ++++++++-------- src/scripts/archive.files | 4 +- tools/make-functions | 127 +++++++++++++++++++------------------- 27 files changed, 176 insertions(+), 183 deletions(-) diff --git a/lfs/Config b/lfs/Config index 3101d8b5a6..c9f6a88ddd 100644 --- a/lfs/Config +++ b/lfs/Config @@ -30,6 +30,9 @@ # # ############################################################################### +# Cleanup environment from any variables +unexport BUILD_ARCH BUILD_PLATFORM BUILDTARGET CROSSTARGET TOOLCHAIN + # URLs that are common sources of downloads. If you're having trouble with # a site you should change its URL to that of a suitable mirror site. # @@ -117,13 +120,13 @@ define POSTBUILD if [ -s "$(TARGET)_diff" ]; then \ LFS_SCRIPT=$(firstword $(MAKEFILE_LIST))$(KCFG); \ echo $(LFS_SCRIPT); \ - ROOTFILE=$$(find $(DIR_SRC)/config/rootfiles/{common,packages}/{$(MACHINE),} -maxdepth 1 -type f -name $$LFS_SCRIPT 2>/dev/null | head -1); \ + ROOTFILE=$$(find $(DIR_SRC)/config/rootfiles/{common,packages}/{$(BUILD_ARCH),} -maxdepth 1 -type f -name $$LFS_SCRIPT 2>/dev/null | head -1); \ if [ "$$ROOTFILE" = "" ]; then \ touch $(TARGET)_missing_rootfile; \ ROOTFILE=$(TARGET)_missing_rootfile ; \ echo "error $$LFS_SCRIPT not found in config/rootfiles"; \ fi; \ - sed -e "s/BUILDTARGET/$(BUILDTARGET)/g" -e "s/KVER/$(KVER)/g" -e "s/MACHINE/$(MACHINE)/g" $$ROOTFILE > $(TARGET)_rootfile; \ + sed -e "s/BUILDTARGET/$(BUILDTARGET)/g" -e "s/KVER/$(KVER)/g" -e "s/MACHINE/$(BUILD_ARCH)/g" $$ROOTFILE > $(TARGET)_rootfile; \ for line in `cat $(TARGET)_diff`; do \ if grep -qG "^#$$line$$" $(TARGET)_rootfile; then echo "#$$line" >> $(TARGET); \ elif grep -qG "^$$line$$" $(TARGET)_rootfile ; then echo "$$line" >> $(TARGET); \ @@ -178,13 +181,13 @@ define PAK cp -f /usr/src/src/paks/default/{,un}install.sh /usr/src/src/paks/default/update.sh \ /install/packages/package; \ fi - for i in $(DIR_SRC)/config/rootfiles/packages/{$(MACHINE),}/$(PROG); do \ + for i in $(DIR_SRC)/config/rootfiles/packages/{$(BUILD_ARCH),}/$(PROG); do \ if [ -e "$${i}" ]; then \ cp -v $${i} /install/packages/package/ROOTFILES; \ break; \ fi; \ done - sed -e 's/BUILDTARGET/$(BUILDTARGET)/g' -e 's/KVER/$(KVER)/g' -e 's/MACHINE/$(MACHINE)/g' -i /install/packages/package/ROOTFILES + sed -e 's/BUILDTARGET/$(BUILDTARGET)/g' -e 's/KVER/$(KVER)/g' -e 's/MACHINE/$(BUILD_ARCH)/g' -i /install/packages/package/ROOTFILES sed -e 's/xxxKVERxxx/$(KVER)/g' -i /install/packages/package/install.sh chmod 755 /install/packages/package/{{,un}install,update}.sh cd / && tar cf /install/packages/package/files.tmp --files-from=/install/packages/package/ROOTFILES --exclude='#*' \ diff --git a/lfs/backports b/lfs/backports index 5706b753c0..5f43ff4d6f 100644 --- a/lfs/backports +++ b/lfs/backports @@ -34,7 +34,7 @@ DL_FROM = $(URL_IPFIRE) DIR_APP = $(DIR_SRC)/$(THISAPP) TARGET = $(DIR_INFO)/$(THISAPP)-kmod-$(KVER)-$(VERSUFIX) -#ifeq "$(MACHINE_TYPE)" "arm" +#ifeq "$(BUILD_PLATFORM)" "arm" CFLAGS += -fno-PIC #endif @@ -87,7 +87,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/backports-3.18.1-1-ipfire-build.patch cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/backports-4.2.6-1-grsecurity.patch cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/backports-4.2.6-1-add_usbnet_modules.patch -ifeq "$(MACHINE)" "x86_64" +ifeq "$(BUILD_ARCH)" "x86_64" cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/backports-3.18.1-1_no_dma_sgtable_on_x86_64.patch endif @@ -126,7 +126,7 @@ endif cd $(DIR_APP) && sed -i -e "s/CPTCFG_CFG80211_DEFAULT_PS=y/# CPTCFG_CFG80211_DEFAULT_PS is not set/g" .config cd $(DIR_APP) && sed -i -e "s/CPTCFG_NFC=m/# CPTCFG_NFC is not set/g" .config -ifeq "$(MACHINE)" "x86_64" +ifeq "$(BUILD_ARCH)" "x86_64" cd $(DIR_APP) && sed -i -e "s/CPTCFG_LIBERTAS_UAP=m/# CPTCFG_LIBERTAS_UAP is not set/g" .config endif diff --git a/lfs/binutils b/lfs/binutils index 7f5ef79ec5..be890a88a5 100644 --- a/lfs/binutils +++ b/lfs/binutils @@ -72,7 +72,7 @@ else endif endif -ifeq "$(MACHINE)" "armv5tel" +ifeq "$(BUILD_ARCH)" "armv5tel" EXTRA_CONFIG += \ --with-abi=aapcs-linux \ --with-float=soft @@ -124,15 +124,15 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) # Prevent installing libiberty to lib64. cd $(DIR_APP) && sed -i 's%\(^MULTIOSDIR = \).*%\1 ../lib%' libiberty/Makefile.in - cd $(DIR_SRC)/binutils-build && $(EXTRA_ENV) MACHINE= $(DIR_APP)/configure $(EXTRA_CONFIG) - cd $(DIR_SRC)/binutils-build && make $(EXTRA_MAKE) $(MAKETUNING) MACHINE= - cd $(DIR_SRC)/binutils-build && make $(EXTRA_INSTALL) install MACHINE= + cd $(DIR_SRC)/binutils-build && $(EXTRA_ENV) $(DIR_APP)/configure $(EXTRA_CONFIG) + cd $(DIR_SRC)/binutils-build && make $(EXTRA_MAKE) $(MAKETUNING) + cd $(DIR_SRC)/binutils-build && make $(EXTRA_INSTALL) install ifeq "$(ROOT)" "" cp -v $(DIR_APP)/include/libiberty.h /usr/include else ifeq "$(PASS)" "2" - cd $(DIR_SRC)/binutils-build && make -C ld clean MACHINE= - cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/usr/lib:/lib MACHINE= + cd $(DIR_SRC)/binutils-build && make -C ld clean + cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/usr/lib:/lib cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new /tools/bin endif endif diff --git a/lfs/cdrom b/lfs/cdrom index 79920b8ddb..58e754f87b 100644 --- a/lfs/cdrom +++ b/lfs/cdrom @@ -29,7 +29,7 @@ VER = ipfire THISAPP = cdrom TARGET = $(DIR_INFO)/$(THISAPP) -ifeq "$(MACHINE_TYPE)" "arm" +ifeq "$(BUILD_PLATFORM)" "arm" TAR_OPTIONS = else TAR_OPTIONS = --lzma @@ -64,7 +64,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) echo > /etc/mtab # Create filelist for packaging. - BUILDTARGET="$(BUILDTARGET)" MACHINE="$(MACHINE)" KVER="$(KVER)" \ + BUILDTARGET="$(BUILDTARGET)" BUILD_ARCH="$(BUILD_ARCH)" KVER="$(KVER)" \ $(DIR_SRC)/src/scripts/archive.files \ $(DIR_SRC)/config/rootfiles/common \ > /tmp/ROOTFILES @@ -89,7 +89,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) # Make the ISO mkdir -p /install/cdrom/boot/isolinux dd if=/dev/zero bs=1k count=2 > /install/cdrom/boot/isolinux/boot.catalog -ifneq "$(MACHINE_TYPE)" "arm" +ifneq "$(BUILD_PLATFORM)" "arm" cp /boot/vmlinuz-$(KVER)-ipfire /install/cdrom/boot/isolinux/vmlinuz dracut --force -a "installer" --strip --xz /install/cdrom/boot/isolinux/instroot $(KVER)-ipfire cp $(DIR_SRC)/config/syslinux/boot.png /install/cdrom/boot/isolinux/boot.png @@ -106,12 +106,12 @@ endif xargs md5sum > md5sum.txt mkdir -p /install/images -ifeq "$(MACHINE_TYPE)" "arm" +ifeq "$(BUILD_PLATFORM)" "arm" cd /install/cdrom && mkisofs -J -r -V "$(NAME)_$(VERSION)" \ - . > /install/images/$(SNAME)-$(VERSION).$(MACHINE)-full-core$(CORE).iso + . > /install/images/$(SNAME)-$(VERSION).$(BUILD_ARCH)-full-core$(CORE).iso else cd /install/cdrom && mkisofs -J -r -V "$(NAME)_$(VERSION)" \ -b boot/isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table \ - -c boot/isolinux/boot.catalog . > /install/images/$(SNAME)-$(VERSION).$(MACHINE)-full-core$(CORE).iso - isohybrid /install/images/$(SNAME)-$(VERSION).$(MACHINE)-full-core$(CORE).iso + -c boot/isolinux/boot.catalog . > /install/images/$(SNAME)-$(VERSION).$(BUILD_ARCH)-full-core$(CORE).iso + isohybrid /install/images/$(SNAME)-$(VERSION).$(BUILD_ARCH)-full-core$(CORE).iso endif diff --git a/lfs/clamav b/lfs/clamav index 650faecbeb..7ba8b8342f 100644 --- a/lfs/clamav +++ b/lfs/clamav @@ -36,7 +36,7 @@ PAK_VER = 34 DEPS = "" -ifeq "$(MACHINE_TYPE)" "arm" +ifeq "$(BUILD_PLATFORM)" "arm" CONFIGURE_FLAGS = --disable-fanotify endif diff --git a/lfs/core-updates b/lfs/core-updates index b40de13e06..75a8415f6f 100644 --- a/lfs/core-updates +++ b/lfs/core-updates @@ -59,7 +59,7 @@ core/%: $(DIR_SRC)/src/scripts/archive.files \ $(DIR_SRC)/config/rootfiles/$@/filelists \ $(DIR_SRC)/config/rootfiles/$@/files \ - $(DIR_SRC)/config/rootfiles/$@/files.$(MACHINE) \ + $(DIR_SRC)/config/rootfiles/$@/files.$(BUILD_ARCH) \ > /tmp/ROOTFILES.tmp #remove excluded files from ROOTFILES diff --git a/lfs/flash-images b/lfs/flash-images index 4a1a4d6aab..554c046621 100644 --- a/lfs/flash-images +++ b/lfs/flash-images @@ -34,9 +34,9 @@ PART_BOOT = /dev/mapper/$(patsubst /dev/%,%,$(DEVICE))p1 PART_ROOT = /dev/mapper/$(patsubst /dev/%,%,$(DEVICE))p3 ifeq "$(SCON)" "1" - IMAGE_FILE = /install/images/$(SNAME)-$(VERSION).1gb-ext4-scon.$(MACHINE)-full-core$(CORE).img.gz + IMAGE_FILE = /install/images/$(SNAME)-$(VERSION).1gb-ext4-scon.$(BUILD_ARCH)-full-core$(CORE).img.gz else - IMAGE_FILE = /install/images/$(SNAME)-$(VERSION).1gb-ext4.$(MACHINE)-full-core$(CORE).img.gz + IMAGE_FILE = /install/images/$(SNAME)-$(VERSION).1gb-ext4.$(BUILD_ARCH)-full-core$(CORE).img.gz endif FSTAB_FMT = UUID=%s %-8s %-4s %-10s %d %d\n @@ -60,7 +60,7 @@ MNThdd := /install/harddisk IMG := /install/images/image.img # All sizes in blocks -ifeq "$(MACHINE_TYPE)" "arm" +ifeq "$(BUILD_PLATFORM)" "arm" BOOTLOADER = S_OFFSET = 8192 @@ -117,7 +117,7 @@ endif mount $(PART_BOOT) $(MNThdd)/boot # Install Pandaboard MLO and uboot first -ifeq "$(MACHINE_TYPE)" "arm" +ifeq "$(BUILD_PLATFORM)" "arm" cp -v /boot/MLO $(MNThdd)/boot/ cp -v /boot/u-boot.img $(MNThdd)/boot/ cp -v /boot/zImage-ipfire-multi $(MNThdd)/boot/ @@ -135,7 +135,7 @@ ifeq "$(MACHINE_TYPE)" "arm" endif # Install IPFire -ifneq "$(MACHINE_TYPE)" "arm" +ifneq "$(BUILD_PLATFORM)" "arm" tar -x --lzma -C $(MNThdd)/ -f /install/cdrom/distro.img else tar -x -C $(MNThdd)/ -f /install/cdrom/distro.img @@ -154,7 +154,7 @@ ifeq "$(SCON)" "1" sed -i -e "s|6:2345:respawn:|#6:2345:respawn:|g" $(MNThdd)/etc/inittab sed -i -e "s|#7:2345:respawn:|7:2345:respawn:|g" $(MNThdd)/etc/inittab -ifeq "$(MACHINE_TYPE)" "arm" +ifeq "$(BUILD_PLATFORM)" "arm" sed -i -e "s| console=tty1 | console=ttyAMA0,115200n8 |g" $(MNThdd)/boot/cmdline.txt sed -i -e "s| console=tty1 | console=ttyO2,115200n8 |g" $(MNThdd)/boot/uEnv.txt endif @@ -228,7 +228,7 @@ endif # not copied to a block device) dd if=/dev/zero bs=1M count=$(PADDING) >> $(IMG) -ifeq "$(MACHINE_TYPE)" "arm" +ifeq "$(BUILD_PLATFORM)" "arm" # Install u-boot for LeMaker Banana Pi into image 8KB dd if=/usr/share/u-boot/banana_pi/u-boot-sunxi-with-spl.bin of=$(IMG) bs=1K seek=8 conv=notrunc endif diff --git a/lfs/gcc b/lfs/gcc index 3c6cb63cd9..e898d6a8fe 100644 --- a/lfs/gcc +++ b/lfs/gcc @@ -133,24 +133,24 @@ endif endif endif -ifeq "$(MACHINE)" "armv7hl" +ifeq "$(BUILD_ARCH)" "armv7hl" EXTRA_CONFIG += \ --with-float=hard endif -ifeq "$(MACHINE)" "armv5tel" +ifeq "$(BUILD_ARCH)" "armv5tel" EXTRA_CONFIG += \ --with-float=soft \ --disable-sjlj-exceptions endif -ifeq "$(MACHINE)" "i586" +ifeq "$(BUILD_ARCH)" "i586" EXTRA_CONFIG += \ --with-arch=i586 \ --with-tune=generic endif -ifeq "$(MACHINE)" "x86_64" +ifeq "$(BUILD_ARCH)" "x86_64" EXTRA_CONFIG += \ --disable-multilib endif diff --git a/lfs/glibc b/lfs/glibc index 67f13a3fb3..6cb73119fe 100644 --- a/lfs/glibc +++ b/lfs/glibc @@ -53,16 +53,16 @@ endif # Enable some extra optimization for the glibc code CFLAGS = -O3 -DNDEBUG -fasynchronous-unwind-tables -fPIC -DPIC -ifeq "$(MACHINE)" "armv7hl" +ifeq "$(BUILD_ARCH)" "armv7hl" CFLAGS += -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard endif -ifeq "$(MACHINE)" "i586" +ifeq "$(BUILD_ARCH)" "i586" CFLAGS += -march=i586 -mtune=generic -mno-tls-direct-seg-refs endif # Disable hardware FP for armv5tel -ifeq "$(MACHINE)" "armv5tel" +ifeq "$(BUILD_ARCH)" "armv5tel" EXTRA_CONFIG += \ --without-fp endif @@ -117,19 +117,21 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE) @mkdir $(DIR_SRC)/glibc-build -ifeq "$(ROOT)" "" -ifeq "$(MACHINE_TYPE)" "arm" - cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=/lib/ld-linux.so.3 -o|' \ - scripts/test-installation.pl -else -ifeq "$(MACHINE)" "x86_64" +ifneq "$(TOOLCHAIN)" "1" + ifeq "$(BUILD_ARCH)" "x86_64" cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib64 -Wl,-dynamic-linker=/lib64/ld-linux-x86-64.so.2 -o|' \ scripts/test-installation.pl -else + endif + + ifeq "$(BUILD_ARCH)" "i586" cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=/lib/ld-linux.so.2 -o|' \ scripts/test-installation.pl -endif -endif + endif + + ifeq "$(BUILD_ARCH)" "armv5tel" + cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=/lib/ld-linux.so.3 -o|' \ + scripts/test-installation.pl + endif endif cd $(DIR_SRC)/glibc-build && \ @@ -141,15 +143,16 @@ endif cd $(DIR_SRC)/glibc-build && make install -ifeq "$(ROOT)" "" +ifeq "$(TOOLCHAIN)" "1" + ln -svf lib /tools/lib64 +else # Creating the locales mkdir -p /usr/lib/locale cd $(DIR_SRC)/glibc-build && make localedata/install-locales # Timezone data will be shipped by tzdata. rm -rfv /usr/share/zoneinfo -else - ln -svf lib /tools/lib64 endif + @rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build @$(POSTBUILD) diff --git a/lfs/gmp b/lfs/gmp index f8dd6bb196..8dc9b73509 100644 --- a/lfs/gmp +++ b/lfs/gmp @@ -32,9 +32,9 @@ DL_FROM = $(URL_IPFIRE) DIR_APP = $(DIR_SRC)/$(THISAPP) TARGET = $(DIR_INFO)/$(THISAPP) -ifeq "$(MACHINE)" "i586" +ifeq "$(BUILD_ARCH)" "i586" CONFIGURE_ARGS = ABI=32 - BUILDTARGET_PENTIUM4 = $(patsubst $(MACHINE)-%,pentium4-%,$(BUILDTARGET)) + BUILDTARGET_PENTIUM4 = $(patsubst $(BUILD_ARCH)-%,pentium4-%,$(BUILDTARGET)) endif CONFIGURE_OPTIONS = \ @@ -89,7 +89,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) cd $(DIR_APP) && make $(MAKETUNING) cd $(DIR_APP) && make install -ifeq "$(MACHINE)" "i586" +ifeq "$(BUILD_ARCH)" "i586" # Build SSE/SSE2 optimised version for x86 cd $(DIR_APP) && make clean cd $(DIR_APP) && \ diff --git a/lfs/gmp-compat b/lfs/gmp-compat index 438e9578d3..1e483f6c04 100644 --- a/lfs/gmp-compat +++ b/lfs/gmp-compat @@ -32,7 +32,7 @@ DL_FROM = $(URL_IPFIRE) DIR_APP = $(DIR_SRC)/$(THISAPP) TARGET = $(DIR_INFO)/$(THISAPP) -ifeq "$(MACHINE)" "i586" +ifeq "$(BUILD_ARCH)" "i586" CONFIGURE_ARGS = ABI=32 endif diff --git a/lfs/initscripts b/lfs/initscripts index ef7114c90e..7d07b8ab39 100644 --- a/lfs/initscripts +++ b/lfs/initscripts @@ -199,7 +199,7 @@ $(TARGET) : done # ARM does not need acpid, intel no swconfig -ifeq "$(MACHINE_TYPE)" "arm" +ifeq "$(BUILD_PLATFORM)" "arm" rm -vf /etc/rc.d/init.d/acpid ln -sf ../init.d/swconfig /etc/rc.d/rcsysinit.d/S73swconfig else diff --git a/lfs/installer b/lfs/installer index 3364a4d7fd..347d90e70b 100644 --- a/lfs/installer +++ b/lfs/installer @@ -31,7 +31,7 @@ DIR_APP = $(DIR_SRC)/$(THISAPP) TARGET = $(DIR_INFO)/$(THISAPP) SLOGAN = An Open Source Firewall Solution -DOWNLOAD_URL = http://downloads.ipfire.org/releases/ipfire-2.x/$(VERSION)-core$(CORE)/$(SNAME)-$(VERSION).$(MACHINE)-full-core$(CORE).iso +DOWNLOAD_URL = http://downloads.ipfire.org/releases/ipfire-2.x/$(VERSION)-core$(CORE)/$(SNAME)-$(VERSION).$(BUILD_ARCH)-full-core$(CORE).iso ############################################################################### # Top-level Rules diff --git a/lfs/linux b/lfs/linux index 8ced5dda18..5be7ab1252 100644 --- a/lfs/linux +++ b/lfs/linux @@ -40,10 +40,16 @@ CXXFLAGS = PAK_VER = 73 DEPS = "" -ifeq "$(MACHINE)" "i586" +ifeq "$(BUILD_ARCH)" "i586" KERNEL_ARCH = i386 else - KERNEL_ARCH = $(MACHINE) + KERNEL_ARCH = $(BUILD_ARCH) +endif + +ifeq "$(BUILD_ARCH)" "aarch64" + HEADERS_ARCH = arm64 +else + HEADERS_ARCH = $(BUILD_PLATFORM) endif VERSUFIX=ipfire$(KCFG) @@ -56,26 +62,6 @@ else HEADERS_PREFIX = /usr endif -ifeq "$(MACHINE)" "armv7hl" - HEADERS_ARCH=arm -endif - -ifeq "$(MACHINE)" "armv5tel" - HEADERS_ARCH=arm -endif - -ifeq "$(MACHINE)" "aarch64" - HEADERS_ARCH=arm64 -endif - -ifeq "$(MACHINE)" "x86_64" - HEADERS_ARCH=x86 -endif - -ifeq "$(MACHINE)" "i586" - HEADERS_ARCH=x86 -endif - ifeq "$(KCFG)" "" LASTKERNEL=1 endif @@ -264,7 +250,7 @@ else drivers/video/logo/logo_linux_clut224.ppm # Cleanup kernel source - cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-$(VERSUFIX) $(DIR_APP)/.config + cp $(DIR_SRC)/config/kernel/kernel.config.$(BUILD_ARCH)-$(VERSUFIX) $(DIR_APP)/.config cd $(DIR_APP) && make oldconfig cd $(DIR_APP) && make clean cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile @@ -295,7 +281,7 @@ endif cd $(DIR_APP) && make $(MAKETUNING) modules_install cd $(DIR_APP) && make $(MAKETUNING) firmware_install -ifeq "$(MACHINE_TYPE)" "arm" +ifeq "$(BUILD_PLATFORM)" "arm" cd $(DIR_APP) && make $(MAKETUNING) dtbs cd $(DIR_APP) && for f in $$(find arch/arm/boot/dts/ -name *.dtb); do \ mkdir -p /boot/dtb-$(VER)-$(VERSUFIX) ; \ diff --git a/lfs/memtest b/lfs/memtest index c92fab63b5..a1d6e2c5fe 100644 --- a/lfs/memtest +++ b/lfs/memtest @@ -76,7 +76,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) # gcc-4.9.3 produce a corrupted version of memtest # we use the precomp version at the moment -#ifeq "$(MACHINE)" "i586" +#ifeq "$(BUILD_ARCH)" "i586" # # Enable SMP as default # cd $(DIR_APP) && sed -i -e "s|CONSERVATIVE_SMP 1|CONSERVATIVE_SMP 0|g" config.h # cd $(DIR_APP) && sed -i -e "s|scp |echo |g" Makefile diff --git a/lfs/openssl b/lfs/openssl index cece0074ef..2fc710dc2f 100644 --- a/lfs/openssl +++ b/lfs/openssl @@ -63,11 +63,11 @@ CONFIGURE_OPTIONS = \ no-srp \ -DSSL_FORBID_ENULL -ifeq "$(MACHINE)" "x86_64" +ifeq "$(BUILD_ARCH)" "x86_64" CONFIGURE_OPTIONS += linux-x86_64 endif -ifeq "$(MACHINE)" "i586" +ifeq "$(BUILD_ARCH)" "i586" CONFIGURE_OPTIONS += linux-elf ifneq "$(KCFG)" "-sse2" @@ -75,7 +75,7 @@ ifneq "$(KCFG)" "-sse2" endif endif -ifeq "$(MACHINE)" "armv5tel" +ifeq "$(BUILD_ARCH)" "armv5tel" CONFIGURE_OPTIONS += linux-generic32 endif @@ -123,7 +123,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/openssl-1.0.2g-disable-sslv2v3.patch # i586 specific patches -ifeq "$(MACHINE)" "i586" +ifeq "$(BUILD_ARCH)" "i586" cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/openssl-1.0.2a_auto_enable_padlock.patch cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/openssl-1.0.2a_disable_ssse3_for_amd.patch endif diff --git a/lfs/pakfire b/lfs/pakfire index 00d1bb1c0d..b584cc5611 100644 --- a/lfs/pakfire +++ b/lfs/pakfire @@ -30,10 +30,10 @@ THISAPP = pakfire DIR_APP = /opt/$(THISAPP) TARGET = $(DIR_INFO)/$(THISAPP) -ifeq "$(MACHINE)" "i586" +ifeq "$(BUILD_ARCH)" "i586" PAKFIRE_VERSION = $(VERSION) else - PAKFIRE_VERSION = $(VERSION)-$(MACHINE) + PAKFIRE_VERSION = $(VERSION)-$(BUILD_ARCH) endif ############################################################################### diff --git a/lfs/php b/lfs/php index 1f33f0d7ea..8717ccac14 100644 --- a/lfs/php +++ b/lfs/php @@ -32,7 +32,7 @@ DL_FROM = $(URL_IPFIRE) DIR_APP = $(DIR_SRC)/$(THISAPP) TARGET = $(DIR_INFO)/$(THISAPP) -ifeq "$(MACHINE_TYPE)" "arm" +ifeq "$(BUILD_PLATFORM)" "arm" CFLAGS := $(patsubst -march=%,,$(CFLAGS)) endif diff --git a/lfs/sources-iso b/lfs/sources-iso index 9df159e72c..4f658cf540 100644 --- a/lfs/sources-iso +++ b/lfs/sources-iso @@ -48,5 +48,5 @@ install : $(DIR_INFO)/_build.othersrc-list.log # make the sources CDROM iso cd /install/cdrom && mkisofs -J -r -V "$(NAME)_$(VERSION)" \ - . > /install/images/$(SNAME)-sources-cd-$(VERSION).$(MACHINE).iso + . > /install/images/$(SNAME)-sources-cd-$(VERSION).$(BUILD_ARCH).iso rm -rf /install/cdrom/* diff --git a/lfs/stage2 b/lfs/stage2 index 1256fd365e..b548c0c6c7 100644 --- a/lfs/stage2 +++ b/lfs/stage2 @@ -64,7 +64,7 @@ $(TARGET) : # Symlink /var/run -> /run. ln -svf ../run /var/run -ifeq "$(MACHINE)" "x86_64" +ifeq "$(BUILD_ARCH)" "x86_64" ln -svf lib /lib64 ln -svf lib /usr/lib64 endif diff --git a/lfs/strongswan b/lfs/strongswan index 7f6a95b6e3..32f549219b 100644 --- a/lfs/strongswan +++ b/lfs/strongswan @@ -32,7 +32,7 @@ DL_FROM = $(URL_IPFIRE) DIR_APP = $(DIR_SRC)/strongswan-$(VER) TARGET = $(DIR_INFO)/$(THISAPP) -ifeq "$(MACHINE)" "i586" +ifeq "$(BUILD_ARCH)" "i586" CONFIGURE_OPTIONS = \ --enable-padlock else diff --git a/lfs/unzip b/lfs/unzip index 7853dd0b4f..793890d287 100644 --- a/lfs/unzip +++ b/lfs/unzip @@ -72,7 +72,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) cd $(DIR_APP) && make -f unix/Makefile clean cd $(DIR_APP)/unix && ./configure -ifeq "$(MACHINE)" "i586" +ifeq "$(BUILD_ARCH)" "i586" cd $(DIR_APP) && make -f unix/Makefile LOCAL_UNZIP=-D_FILE_OFFSET_BITS=64 generic else # ARM/x86_64 cannot use the x86 32 bit assembly code. diff --git a/lfs/vdr_dvbapi b/lfs/vdr_dvbapi index 2cf34e73df..f9339e6b84 100644 --- a/lfs/vdr_dvbapi +++ b/lfs/vdr_dvbapi @@ -102,7 +102,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP)* && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE) -ifeq "$(MACHINE)" "i586" +ifeq "$(BUILD_ARCH)" "i586" # Build an SSE enabled version. $(call BUILD,-sse) endif diff --git a/lfs/xen-image b/lfs/xen-image index d5a747bcd3..78c242bf82 100644 --- a/lfs/xen-image +++ b/lfs/xen-image @@ -47,7 +47,7 @@ md5 : ############################################################################### # Installation Details ############################################################################### -IMGinst := /install/images/$(SNAME)-$(VERSION).xen.$(MACHINE)-downloader-core$(CORE).tar.bz2 +IMGinst := /install/images/$(SNAME)-$(VERSION).xen.$(BUILD_ARCH)-downloader-core$(CORE).tar.bz2 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) rm -rf /install/images/$(SNAME) $(IMGinst) && mkdir -p /install/images/$(SNAME) diff --git a/make.sh b/make.sh index 3a62c4f771..7b0249928d 100755 --- a/make.sh +++ b/make.sh @@ -39,8 +39,7 @@ GIT_LASTCOMMIT=$(git log | head -n1 | cut -d" " -f2 |head -c8) # Last commit TOOLCHAINVER=12 # New architecture variables -BUILD_ARCH="$(uname -m)" -BUILDMACHINE="${BUILD_ARCH}" +HOST_ARCH="$(uname -m)" # Debian specific settings if [ ! -e /etc/debian_version ]; then @@ -69,10 +68,13 @@ if [ -f .config ]; then . .config fi -if [ -n "${TARGET_ARCH}" ]; then - configure_target "${TARGET_ARCH}" +if [ -n "${BUILD_ARCH}" ]; then + configure_build "${BUILD_ARCH}" +elif [ -n "${TARGET_ARCH}" ]; then + configure_build "${TARGET_ARCH}" + unset TARGET_ARCH else - configure_target "default" + configure_build "default" fi if [ -z $EDITOR ]; then @@ -221,13 +223,13 @@ prepareenv() { # Run LFS static binary creation scripts one by one export CCACHE_DIR=$BASEDIR/ccache export CCACHE_COMPRESS=1 - export CCACHE_COMPILERCHECK="string:toolchain-${TOOLCHAINVER} ${TARGET_ARCH}" + export CCACHE_COMPILERCHECK="string:toolchain-${TOOLCHAINVER} ${BUILD_ARCH}" # Remove pre-install list of installed files in case user erase some files before rebuild rm -f $BASEDIR/build/usr/src/lsalr 2>/dev/null # Prepare string for /etc/system-release. - SYSTEM_RELEASE="${NAME} ${VERSION} (${MACHINE})" + SYSTEM_RELEASE="${NAME} ${VERSION} (${BUILD_ARCH})" if [ "$(git status -s | wc -l)" == "0" ]; then GIT_STATUS="" else @@ -245,7 +247,7 @@ prepareenv() { buildtoolchain() { local error=false - case "${TARGET_ARCH}:${BUILD_ARCH}" in + case "${BUILD_ARCH}:${HOST_ARCH}" in # x86_64 x86_64:x86_64) # This is working. @@ -273,7 +275,7 @@ buildtoolchain() { esac ${error} && \ - exiterror "Cannot build ${MACHINE} toolchain on $(uname -m). Please use the download if any." + exiterror "Cannot build ${BUILD_ARCH} toolchain on $(uname -m). Please use the download if any." local gcc=$(type -p gcc) if [ -z "${gcc}" ]; then @@ -426,7 +428,7 @@ buildipfire() { ipfiremake libnetfilter_cttimeout ipfiremake iptables - case "${TARGET_ARCH}" in + case "${BUILD_ARCH}" in x86_64) ipfiremake linux KCFG="" ipfiremake backports KCFG="" @@ -484,7 +486,7 @@ buildipfire() { esac ipfiremake xtables-addons USPACE="1" ipfiremake openssl - [ "${TARGET_ARCH}" = "i586" ] && ipfiremake openssl KCFG='-sse2' + [ "${BUILD_ARCH}" = "i586" ] && ipfiremake openssl KCFG='-sse2' ipfiremake libgpg-error ipfiremake libgcrypt ipfiremake libassuan @@ -947,7 +949,7 @@ buildpackages() { cd $BASEDIR # remove not useable iso on armv5tel (needed to build flash images) - [ "${TARGET_ARCH}" = "armv5tel" ] && rm -rf *.iso + [ "${BUILD_ARCH}" = "armv5tel" ] && rm -rf *.iso for i in `ls *.bz2 *.img.gz *.iso`; do md5sum $i > $i.md5 @@ -978,7 +980,7 @@ ipfirepackages() { ipfiremake core-updates local i - for i in $(find $BASEDIR/config/rootfiles/packages{/${MACHINE},} -maxdepth 1 -type f); do + for i in $(find $BASEDIR/config/rootfiles/packages{/${BUILD_ARCH},} -maxdepth 1 -type f); do i=$(basename ${i}) if [ -e $BASEDIR/lfs/$i ]; then ipfiredist $i @@ -1012,7 +1014,7 @@ done case "$1" in build) clear - PACKAGE=`ls -v -r $BASEDIR/cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-$MACHINE.tar.gz 2> /dev/null | head -n 1` + PACKAGE=`ls -v -r $BASEDIR/cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.gz 2> /dev/null | head -n 1` #only restore on a clean disk if [ ! -f log/cleanup-toolchain-2-tools ]; then if [ ! -n "$PACKAGE" ]; then @@ -1106,7 +1108,7 @@ downloadsrc) if [ -f "$i" -a "$i" != "Config" ]; then lfsmakecommoncheck ${i} || continue - make -s -f $i LFS_BASEDIR=$BASEDIR MACHINE=$MACHINE \ + make -s -f $i LFS_BASEDIR=$BASEDIR BUILD_ARCH="${BUILD_ARCH}" \ MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1 if [ $? -ne 0 ]; then beautify message FAIL @@ -1124,7 +1126,7 @@ downloadsrc) for i in *; do if [ -f "$i" -a "$i" != "Config" ]; then lfsmakecommoncheck ${i} > /dev/null || continue - make -s -f $i LFS_BASEDIR=$BASEDIR MACHINE=$MACHINE \ + make -s -f $i LFS_BASEDIR=$BASEDIR BUILD_ARCH="${BUILD_ARCH}" \ MESSAGE="$i\t " md5 >> $LOGFILE 2>&1 if [ $? -ne 0 ]; then echo -ne "MD5 difference in lfs/$i" @@ -1147,25 +1149,25 @@ toolchain) prepareenv beautify build_stage "Toolchain compilation - Native GCC: `gcc --version | grep GCC | awk {'print $3'}`" buildtoolchain - echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for $MACHINE" | tee -a $LOGFILE + echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for ${BUILD_ARCH}" | tee -a $LOGFILE test -d $BASEDIR/cache/toolchains || mkdir -p $BASEDIR/cache/toolchains - cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-$MACHINE.tar.gz \ + cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.gz \ build/tools build/bin/sh log >> $LOGFILE - md5sum cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-$MACHINE.tar.gz \ - > cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-$MACHINE.md5 + md5sum cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.gz \ + > cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.md5 stdumount ;; gettoolchain) # arbitrary name to be updated in case of new toolchain package upload - PACKAGE=$SNAME-$VERSION-toolchain-$TOOLCHAINVER-$MACHINE + PACKAGE=$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH} if [ ! -f $BASEDIR/cache/toolchains/$PACKAGE.tar.gz ]; then URL_TOOLCHAIN=`grep URL_TOOLCHAIN lfs/Config | awk '{ print $3 }'` test -d $BASEDIR/cache/toolchains || mkdir -p $BASEDIR/cache/toolchains - echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for $MACHINE" | tee -a $LOGFILE + echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for ${BUILD_ARCH}" | tee -a $LOGFILE cd $BASEDIR/cache/toolchains wget -U "IPFireSourceGrabber/2.x" $URL_TOOLCHAIN/$PACKAGE.tar.gz $URL_TOOLCHAIN/$PACKAGE.md5 >& /dev/null if [ $? -ne 0 ]; then - echo "`date -u '+%b %e %T'`: error downloading $PACKAGE toolchain for $MACHINE machine" | tee -a $LOGFILE + echo "`date -u '+%b %e %T'`: error downloading $PACKAGE toolchain for ${BUILD_ARCH} machine" | tee -a $LOGFILE else if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE @@ -1179,11 +1181,11 @@ gettoolchain) ;; othersrc) prepareenv - echo -ne "`date -u '+%b %e %T'`: Build sources iso for $MACHINE" | tee -a $LOGFILE + echo -ne "`date -u '+%b %e %T'`: Build sources iso for ${BUILD_ARCH}" | tee -a $LOGFILE chroot $LFS /tools/bin/env -i HOME=/root \ TERM=$TERM PS1='\u:\w\$ ' \ PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \ - VERSION=$VERSION NAME="$NAME" SNAME="$SNAME" MACHINE=$MACHINE \ + VERSION=$VERSION NAME="$NAME" SNAME="$SNAME" BUILD_ARCH="${BUILD_ARCH}" \ /bin/bash -x -c "cd /usr/src/lfs && make -f sources-iso LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1 mv $LFS/install/images/ipfire-* $BASEDIR >> $LOGFILE 2>&1 if [ $? -eq "0" ]; then diff --git a/src/scripts/archive.files b/src/scripts/archive.files index ca0ee51b68..0ed237bfcb 100755 --- a/src/scripts/archive.files +++ b/src/scripts/archive.files @@ -31,7 +31,7 @@ for dir in $@; do continue fi - for exclude in ${dir}/${MACHINE}/*; do + for exclude in ${dir}/${BUILD_ARCH}/*; do [ -f "${exclude}" ] || continue EXCLUDE="$EXCLUDE $exclude" done @@ -52,4 +52,4 @@ for dir in $@; do done cat ${FILELIST} 2>/dev/null | grep -v ^# | sort | uniq | \ - sed -e "s/KVER/${KVER}/g" -e "s/MACHINE/${MACHINE}/g" -e "s/BUILDTARGET/${BUILDTARGET}/g" + sed -e "s/KVER/${KVER}/g" -e "s/MACHINE/${BUILD_ARCH}/g" -e "s/BUILDTARGET/${BUILDTARGET}/g" diff --git a/tools/make-functions b/tools/make-functions index 8ae50b4f07..7417350a76 100644 --- a/tools/make-functions +++ b/tools/make-functions @@ -60,65 +60,66 @@ WARN="\\033[1;35m" FAIL="\\033[1;31m" NORMAL="\\033[0;39m" -configure_target() { - local target_arch="${1}" +configure_build() { + local build_arch="${1}" - if [ "${target_arch}" = "default" ]; then - target_arch="$(configure_target_guess)" + if [ "${build_arch}" = "default" ]; then + build_arch="$(configure_build_guess)" fi - case "${target_arch}" in + case "${build_arch}" in x86_64) - BUILDTARGET="${target_arch}-unknown-linux-gnu" - CROSSTARGET="${target_arch}-cross-linux-gnu" + BUILDTARGET="${build_arch}-unknown-linux-gnu" + CROSSTARGET="${build_arch}-cross-linux-gnu" + BUILD_PLATFORM="x86" CFLAGS_ARCH="-m64 -mtune=generic" ;; i586) - BUILDTARGET="${target_arch}-pc-linux-gnu" - CROSSTARGET="${target_arch}-cross-linux-gnu" + BUILDTARGET="${build_arch}-pc-linux-gnu" + CROSSTARGET="${build_arch}-cross-linux-gnu" + BUILD_PLATFORM="x86" CFLAGS_ARCH="-march=i586 -mtune=generic -fomit-frame-pointer" ;; aarch64) - BUILDTARGET="${target_arch}-unknown-linux-gnu" - CROSSTARGET="${target_arch}-cross-linux-gnu" + BUILDTARGET="${build_arch}-unknown-linux-gnu" + CROSSTARGET="${build_arch}-cross-linux-gnu" + BUILD_PLATFORM="arm" CFLAGS_ARCH="" ;; armv7hl) - BUILDTARGET="${target_arch}-unknown-linux-gnueabi" - CROSSTARGET="${target_arch}-cross-linux-gnueabi" + BUILDTARGET="${build_arch}-unknown-linux-gnueabi" + CROSSTARGET="${build_arch}-cross-linux-gnueabi" + BUILD_PLATFORM="arm" CFLAGS_ARCH="-march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard" ;; armv5tel) - BUILDTARGET="${target_arch}-unknown-linux-gnueabi" - CROSSTARGET="${target_arch}-cross-linux-gnueabi" + BUILDTARGET="${build_arch}-unknown-linux-gnueabi" + CROSSTARGET="${build_arch}-cross-linux-gnueabi" + BUILD_PLATFORM="arm" CFLAGS_ARCH="-march=armv5te -mfloat-abi=soft -fomit-frame-pointer" - MACHINE_TYPE="arm" ;; *) - exiterror "Cannot build for architure ${target_arch}" + exiterror "Cannot build for architure ${build_arch}" ;; esac # Check if the QEMU helper is available if needed. - if qemu_is_required "${target_arch}"; then - local qemu_target_helper="$(qemu_find_target_helper_name "${target_arch}")" + if qemu_is_required "${build_arch}"; then + local qemu_build_helper="$(qemu_find_build_helper_name "${build_arch}")" - if [ -n "${qemu_target_helper}" ]; then - QEMU_TARGET_HELPER="${qemu_target_helper}" + if [ -n "${qemu_build_helper}" ]; then + QEMU_TARGET_HELPER="${qemu_build_helper}" else - exiterror "Could not find a binfmt_misc helper entry for ${target_arch}" + exiterror "Could not find a binfmt_misc helper entry for ${build_arch}" fi fi - TARGET_ARCH="${target_arch}" - - # Old variable names - MACHINE="${TARGET_ARCH}" + BUILD_ARCH="${build_arch}" # Enables hardening HARDENING_CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4" @@ -127,8 +128,8 @@ configure_target() { CXXFLAGS="${CFLAGS}" } -configure_target_guess() { - case "${BUILD_ARCH}" in +configure_build_guess() { + case "${HOST_ARCH}" in x86_64|i686|i586) echo "i586" ;; @@ -146,7 +147,7 @@ configure_target_guess() { ;; *) - exiterror "Cannot guess target architecture" + exiterror "Cannot guess build architecture" ;; esac } @@ -359,7 +360,7 @@ fake_environ() { env="${env} UTS_RELEASE=${KVER}" # Fake machine version. - env="${env} UTS_MACHINE=${TARGET_ARCH}" + env="${env} UTS_MACHINE=${BUILD_ARCH}" echo "${env}" } @@ -373,7 +374,7 @@ qemu_environ() { fi # Set default qemu options - case "${TARGET_ARCH}" in + case "${BUILD_ARCH}" in arm*) QEMU_CPU="${QEMU_CPU:-cortex-a9}" @@ -388,13 +389,13 @@ qemu_environ() { } qemu_is_required() { - local target_arch="${1}" + local build_arch="${1}" - if [ -z "${target_arch}" ]; then - target_arch="${TARGET_ARCH}" + if [ -z "${build_arch}" ]; then + build_arch="${BUILD_ARCH}" fi - case "${BUILD_ARCH},${target_arch}" in + case "${HOST_ARCH},${build_arch}" in x86_64,arm*|i?86,arm*|i?86,x86_64) return 0 ;; @@ -448,11 +449,11 @@ qemu_install_helper() { exiterror "Could not find a statically-linked QEMU emulator: ${QEMU_TARGET_HELPER}" } -qemu_find_target_helper_name() { - local target_arch="${1}" +qemu_find_build_helper_name() { + local build_arch="${1}" local magic - case "${target_arch}" in + case "${build_arch}" in arm*) magic="7f454c4601010100000000000000000002002800" ;; @@ -510,8 +511,7 @@ entershell() { KVER=$KVER \ BUILDTARGET="$BUILDTARGET" \ CROSSTARGET="${CROSSTARGET}" \ - MACHINE="$MACHINE" \ - MACHINE_TYPE="$MACHINE_TYPE" \ + BUILD_ARCH="${BUILD_ARCH}" \ $(fake_environ) \ $(qemu_environ) \ /tools/bin/bash -i @@ -548,8 +548,8 @@ lfsmakecommoncheck() # Check if this package is supported by our architecture. # If no SUP_ARCH is found, we assume the package can be built for all. if grep "^SUP_ARCH" ${BASEDIR}/lfs/${1} >/dev/null; then - # Check if package supports ${MACHINE} or all architectures. - if ! grep -E "^SUP_ARCH.*${MACHINE}|^SUP_ARCH.*all" ${BASEDIR}/lfs/${1} >/dev/null; then + # Check if package supports ${BUILD_ARCH} or all architectures. + if ! grep -E "^SUP_ARCH.*${BUILD_ARCH}|^SUP_ARCH.*all" ${BASEDIR}/lfs/${1} >/dev/null; then beautify result SKIP return 1 fi @@ -567,15 +567,13 @@ lfsmakecommoncheck() echo -ne "`date -u '+%b %e %T'`: Building $* " >> $LOGFILE - cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MACHINE=$MACHINE \ - MACHINE_TYPE="$MACHINE_TYPE" \ + cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR BUILD_ARCH="${BUILD_ARCH}" \ MESSAGE="$1\t " download >> $LOGFILE 2>&1 if [ $? -ne 0 ]; then exiterror "Download error in $1" fi - cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MACHINE=$MACHINE \ - MACHINE_TYPE="$MACHINE_TYPE" \ + cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR BUILD_ARCH="${BUILD_ARCH}" \ MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1 if [ $? -ne 0 ]; then exiterror "md5sum error in $1, check file in cache or signature" @@ -590,17 +588,22 @@ lfsmake1() { local PKG_TIME_START=`date +%s` - cd $BASEDIR/lfs && \ + cd $BASEDIR/lfs && env -i \ PATH="/tools/ccache/bin:/tools/bin:$PATH" \ - make -f $* TOOLCHAIN=1 BUILDTARGET=$BUILDTARGET \ - CROSSTARGET="${CROSSTARGET}" \ - MACHINE=$MACHINE \ - MACHINE_TYPE=$MACHINE_TYPE \ - LFS_BASEDIR=$BASEDIR \ - ROOT=$LFS \ - KVER=$KVER \ - MAKETUNING=$MAKETUNING \ - install >> $LOGFILE 2>&1 + make -f $* \ + TOOLCHAIN=1 \ + CROSSTARGET="${CROSSTARGET}" \ + BUILDTARGET="${BUILDTARGET}" \ + BUILD_ARCH="${BUILD_ARCH}" \ + BUILD_PLATFORM="${BUILD_PLATFORM}" \ + CFLAGS="${CFLAGS}" \ + CXXFLAGS="${CXXFLAGS}" \ + LFS_BASEDIR="${BASEDIR}" \ + ROOT="${LFS}" \ + KVER="${KVER}" \ + MAKETUNING="${MAKETUNING}" \ + install >> $LOGFILE 2>&1 + local COMPILE_SUCCESS=$? local PKG_TIME_END=`date +%s` @@ -637,8 +640,7 @@ lfsmake2() { KVER=$KVER MAKETUNING=$MAKETUNING \ BUILDTARGET="$BUILDTARGET" \ CROSSTARGET="${CROSSTARGET}" \ - MACHINE="$MACHINE" \ - MACHINE_TYPE="$MACHINE_TYPE" \ + BUILD_ARCH="${BUILD_ARCH}" \ $(qemu_environ) \ $(fake_environ) \ /tools/bin/bash -x -c "cd /usr/src/lfs && \ @@ -680,8 +682,7 @@ ipfiremake() { KVER=$KVER MAKETUNING=$MAKETUNING \ BUILDTARGET="$BUILDTARGET" \ CROSSTARGET="${CROSSTARGET}" \ - MACHINE="$MACHINE" \ - MACHINE_TYPE="$MACHINE_TYPE" \ + BUILD_ARCH="${BUILD_ARCH}" \ $(qemu_environ) \ $(fake_environ) \ /bin/bash -x -c "cd /usr/src/lfs && \ @@ -721,8 +722,7 @@ ipfiredist() { KVER=$KVER \ BUILDTARGET="$BUILDTARGET" \ CROSSTARGET="${CROSSTARGET}" \ - MACHINE="$MACHINE" \ - MACHINE_TYPE="$MACHINE_TYPE" \ + BUILD_ARCH="${BUILD_ARCH}" \ $(qemu_environ) \ $(fake_environ) \ /bin/bash -x -c "cd /usr/src/lfs && \ @@ -761,8 +761,7 @@ installmake() { KVER=$KVER \ BUILDTARGET="$BUILDTARGET" \ CROSSTARGET="${CROSSTARGET}" \ - MACHINE="$MACHINE" \ - MACHINE_TYPE="$MACHINE_TYPE" \ + BUILD_ARCH="${BUILD_ARCH}" \ LD_LIBRARY_PATH=/tools/lib \ /tools/bin/bash -x -c "cd /usr/src/lfs && \ /tools/bin/make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1 -- 2.39.2