public inbox for ipfire-scm@lists.ipfire.org
 help / color / mirror / Atom feed
From: git@ipfire.org
To: ipfire-scm@lists.ipfire.org
Subject: [git.ipfire.org] IPFire 2.x development tree branch, next, updated. 38d45f0154f828e7c9fc99149800a6f99b165d27
Date: Mon, 26 May 2014 23:46:38 +0200	[thread overview]
Message-ID: <20140526214638.F3A8920C37@argus.ipfire.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 23265 bytes --]

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPFire 2.x development tree".

The branch, next has been updated
       via  38d45f0154f828e7c9fc99149800a6f99b165d27 (commit)
       via  892c6da83941dddae4f762e12abaab9256268a70 (commit)
       via  973bcb03f12c57c889ad69feaed37e2bd14e01c8 (commit)
       via  4e6c35f77d74fc181179c23a0f4ee5db283a1e86 (commit)
       via  c8859a8213188e8e9588382c8820d92aba271b02 (commit)
       via  6f67c28d995d1dcf08cd2b874fa02aef6e5dba00 (commit)
       via  a1531946206be54d01ccb7c9266c8d6f8fcce172 (commit)
       via  bcb9dc13d72e5d1182da8b7ebca747ac0b7e587c (commit)
       via  3d02c09165cefbfbd02f6694cd8f990c2a1cf3cd (commit)
      from  05a48c2b2a09e8a5c67276dd2c372d4fbc023017 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 38d45f0154f828e7c9fc99149800a6f99b165d27
Merge: 892c6da 973bcb0
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Mon May 26 23:46:20 2014 +0200

    Merge branch 'sudo-without-pam' into next

commit 892c6da83941dddae4f762e12abaab9256268a70
Merge: 05a48c2 4e6c35f
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Mon May 26 23:46:14 2014 +0200

    Merge remote-tracking branch 'ms/native-arm-compiling' into next

commit 973bcb03f12c57c889ad69feaed37e2bd14e01c8
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Mon May 26 23:44:53 2014 +0200

    sudo: Update to 1.8.10p3.
    
    Disable linking against PAM which is not configured
    in IPFire 2.

commit 4e6c35f77d74fc181179c23a0f4ee5db283a1e86
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Sat May 24 18:22:00 2014 +0200

    make.sh: Add more information to the chroot bash prompt.

commit c8859a8213188e8e9588382c8820d92aba271b02
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Sat May 24 18:14:26 2014 +0200

    make.sh: Remove C{,XX}2FLAGS.

commit 6f67c28d995d1dcf08cd2b874fa02aef6e5dba00
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Sat May 24 18:10:14 2014 +0200

    make.sh: Remove KGCC variable.
    
    This has been unused since a long time any way.

commit a1531946206be54d01ccb7c9266c8d6f8fcce172
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Sat May 24 18:08:45 2014 +0200

    Make it a proper login shell when entering the build chroot.

commit bcb9dc13d72e5d1182da8b7ebca747ac0b7e587c
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Sat May 24 17:18:13 2014 +0200

    Support emulation of an ARM environment on Intel systems.
    
    qemu-user is used to emulate an ARM chroot environment
    that is used to compile the system for ARM target systems.

commit 3d02c09165cefbfbd02f6694cd8f990c2a1cf3cd
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Sat May 24 17:16:54 2014 +0200

    make.sh: Reformat kernel section.

-----------------------------------------------------------------------

Summary of changes:
 lfs/Config           |   2 -
 lfs/linux            |  18 ++--
 lfs/sudo             |   7 +-
 make.sh              | 138 ++++++++++++++++--------------
 tools/make-functions | 232 +++++++++++++++++++++++++++++++++++++++++++--------
 5 files changed, 289 insertions(+), 108 deletions(-)

Difference in files:
diff --git a/lfs/Config b/lfs/Config
index fb0f2e9..415766d 100644
--- a/lfs/Config
+++ b/lfs/Config
@@ -57,8 +57,6 @@ DIR_CONF    = $(LFS_BASEDIR)/config
 DIR_INFO    = $(LFS_BASEDIR)/log
 DIR_TMP     = /tmp
 
-KGCC = gcc
-
 ###############################################################################
 # Common Macro Definitions
 ###############################################################################
diff --git a/lfs/linux b/lfs/linux
index 5dd5cc0..9146ad9 100644
--- a/lfs/linux
+++ b/lfs/linux
@@ -253,26 +253,26 @@ else
 
 	# Cleanup kernel source
 	cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-$(VERSUFIX) $(DIR_APP)/.config
-	cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
-	cd $(DIR_APP) && make CC="$(KGCC)" clean
+	cd $(DIR_APP) && make oldconfig
+	cd $(DIR_APP) && make clean
 	cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile
 
 ifeq "$(KCFG)" "-kirkwood"
-	cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" uImage modules
+	cd $(DIR_APP) && make $(MAKETUNING) uImage modules
 	cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
 	cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/uImage-$(VERSUFIX)
 else
 ifeq "$(KCFG)" "-multi"
-	cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" zImage modules
+	cd $(DIR_APP) && make $(MAKETUNING) zImage modules
 	cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
 	cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/zImage-$(VERSUFIX)
 else
 ifeq "$(KCFG)" "-rpi"
-	cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" zImage modules
+	cd $(DIR_APP) && make $(MAKETUNING) zImage modules
 	cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
 	cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/kernel.img
 else
-	cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage modules
+	cd $(DIR_APP) && make $(MAKETUNING) bzImage modules
 	cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
 	ln -sf vmlinuz-$(VER)-$(VERSUFIX) /boot/vmlinuz-$(VERSUFIX)
 endif
@@ -281,11 +281,11 @@ endif
 	cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
 	cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
 	ln -sf System.map-$(VER)-$(VERSUFIX) /boot/System.map-$(VERSUFIX)
-	cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
-	cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
+	cd $(DIR_APP) && make $(MAKETUNING) modules_install
+	cd $(DIR_APP) && make $(MAKETUNING) firmware_install
 
 ifeq "$(MACHINE_TYPE)" "arm"
-	cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) dtbs
+	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) ; \
 				install -m 644 $$f /boot/dtb-$(VER)-$(VERSUFIX)/ ; \
diff --git a/lfs/sudo b/lfs/sudo
index 7c3feab..9dd72fe 100644
--- a/lfs/sudo
+++ b/lfs/sudo
@@ -24,7 +24,7 @@
 
 include Config
 
-VER        = 1.8.10p1
+VER        = 1.8.10p3
 
 THISAPP    = sudo-$(VER)
 DL_FILE    = $(THISAPP).tar.gz
@@ -40,7 +40,7 @@ objects = $(DL_FILE)
 
 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
 
-$(DL_FILE)_MD5 = 1d9c2bc5aaf02608343d17b9a666e8e1
+$(DL_FILE)_MD5 = fcd8d0d9f9f0397d076ee901e242ed39
 
 install : $(TARGET)
 
@@ -79,7 +79,8 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 			--with-env-editor \
 			--with-ignore-dot \
 			--with-tty-tickets \
-			--with-passpromt="[sudo] password for %p: "
+			--with-passpromt="[sudo] password for %p: " \
+			--without-pam
 	cd $(DIR_APP) && make $(MAKETUNING)
 	cd $(DIR_APP) && make install
 	@rm -rf $(DIR_APP)
diff --git a/make.sh b/make.sh
index 398c91c..37339ed 100755
--- a/make.sh
+++ b/make.sh
@@ -34,16 +34,13 @@ NICE=10								# Nice level
 MAX_RETRIES=1							# prefetch/check loop
 BUILD_IMAGES=1							# Flash and Xen Downloader
 KVER=`grep --max-count=1 VER lfs/linux | awk '{ print $3 }'`
-MACHINE=`uname -m`
 GIT_TAG=$(git tag | tail -1)					# Git Tag
 GIT_LASTCOMMIT=$(git log | head -n1 | cut -d" " -f2 |head -c8)	# Last commit
 TOOLCHAINVER=7
 
-BUILDMACHINE=$MACHINE
-    if [ "$MACHINE" = "x86_64" ]; then
-        BUILDMACHINE="i686";
-    fi
-
+# New architecture variables
+BUILD_ARCH="$(uname -m)"
+BUILDMACHINE="${BUILD_ARCH}"
 
 # Debian specific settings
 if [ ! -e /etc/debian_version ]; then
@@ -68,6 +65,8 @@ mkdir $BASEDIR/log/ 2>/dev/null
 # Include funtions
 . tools/make-functions
 
+configure_target "default"
+
 if [ -f .config ]; then
 	. .config
 fi
@@ -241,7 +240,7 @@ prepareenv() {
 
 buildtoolchain() {
     local error=false
-    case "${MACHINE}:$(uname -m)" in
+    case "${TARGET_ARCH}:${BUILD_ARCH}" in
         # x86
         i586:i586|i586:i686|i586:x86_64)
             # These are working.
@@ -399,61 +398,62 @@ buildipfire() {
   ipfiremake bc
   ipfiremake u-boot
 
-  if [ "${MACHINE_TYPE}" != "arm" ]; then
-
-    # x86-pae (Native and new XEN) kernel build
-    ipfiremake linux			KCFG="-pae"
-#    ipfiremake kvm-kmod			KCFG="-pae"
-#    ipfiremake v4l-dvb			KCFG="-pae"
-#    ipfiremake mISDN			KCFG="-pae"
-    ipfiremake cryptodev		KCFG="-pae"
-#    ipfiremake compat-drivers		KCFG="-pae"
-#    ipfiremake r8169			KCFG="-pae"
-#    ipfiremake r8168			KCFG="-pae"
-#    ipfiremake r8101			KCFG="-pae"
-    ipfiremake e1000e			KCFG="-pae"
-    ipfiremake igb			KCFG="-pae"
-
-    # x86 kernel build
-    ipfiremake linux			KCFG=""
-#    ipfiremake kvm-kmod			KCFG=""
-#    ipfiremake v4l-dvb			KCFG=""
-#    ipfiremake mISDN			KCFG=""
-    ipfiremake cryptodev		KCFG=""
-#    ipfiremake compat-drivers		KCFG=""
-#    ipfiremake r8169			KCFG=""
-#    ipfiremake r8168			KCFG=""
-#    ipfiremake r8101			KCFG=""
-    ipfiremake e1000e			KCFG=""
-    ipfiremake igb			KCFG=""
-
-  else
-    # arm-rpi (Raspberry Pi) kernel build
-    ipfiremake linux			KCFG="-rpi"
-#    ipfiremake v4l-dvb			KCFG="-rpi"
-#    ipfiremake mISDN			KCFG="-rpi" NOPCI=1
-    ipfiremake cryptodev		KCFG="-rpi"
-#    ipfiremake compat-drivers		KCFG="-rpi"
-
-    # arm multi platform (Panda, Wandboard ...) kernel build
-    ipfiremake linux			KCFG="-multi"
-    ipfiremake cryptodev		KCFG="-multi"
-    ipfiremake e1000e			KCFG="-multi"
-    ipfiremake igb			KCFG="-multi"
-
-    # arm-kirkwood (Dreamplug, ICY-Box ...) kernel build
-    ipfiremake linux			KCFG="-kirkwood"
-#    ipfiremake v4l-dvb			KCFG="-kirkwood"
-#    ipfiremake mISDN			KCFG="-kirkwood"
-    ipfiremake cryptodev		KCFG="-kirkwood"
-#    ipfiremake compat-drivers		KCFG="-kirkwood"
-#    ipfiremake r8169			KCFG="-kirkwood"
-#    ipfiremake r8168			KCFG="-kirkwood"
-#    ipfiremake r8101			KCFG="-kirkwood"
-#    ipfiremake e1000e			KCFG="-kirkwood"
-    ipfiremake igb			KCFG="-kirkwood"
+  case "${TARGET_ARCH}" in
+	i586)
+		# x86-pae (Native and new XEN) kernel build
+		ipfiremake linux			KCFG="-pae"
+#		ipfiremake kvm-kmod			KCFG="-pae"
+#		ipfiremake v4l-dvb			KCFG="-pae"
+#		ipfiremake mISDN			KCFG="-pae"
+		ipfiremake cryptodev			KCFG="-pae"
+#		ipfiremake compat-drivers		KCFG="-pae"
+#		ipfiremake r8169			KCFG="-pae"
+#		ipfiremake r8168			KCFG="-pae"
+#		ipfiremake r8101			KCFG="-pae"
+		ipfiremake e1000e			KCFG="-pae"
+		ipfiremake igb				KCFG="-pae"
+
+		# x86 kernel build
+		ipfiremake linux			KCFG=""
+#		ipfiremake kvm-kmod			KCFG=""
+#		ipfiremake v4l-dvb			KCFG=""
+#		ipfiremake mISDN			KCFG=""
+		ipfiremake cryptodev			KCFG=""
+#		ipfiremake compat-drivers		KCFG=""
+#		ipfiremake r8169			KCFG=""
+#		ipfiremake r8168			KCFG=""
+#		ipfiremake r8101			KCFG=""
+		ipfiremake e1000e			KCFG=""
+		ipfiremake igb				KCFG=""
+		;;
 
-  fi
+	armv5tel)
+		# arm-rpi (Raspberry Pi) kernel build
+		ipfiremake linux			KCFG="-rpi"
+#		ipfiremake v4l-dvb			KCFG="-rpi"
+#		ipfiremake mISDN			KCFG="-rpi" NOPCI=1
+		ipfiremake cryptodev			KCFG="-rpi"
+#		ipfiremake compat-drivers		KCFG="-rpi"
+
+		# arm multi platform (Panda, Wandboard ...) kernel build
+		ipfiremake linux			KCFG="-multi"
+		ipfiremake cryptodev			KCFG="-multi"
+		ipfiremake e1000e			KCFG="-multi"
+		ipfiremake igb				KCFG="-multi"
+
+		# arm-kirkwood (Dreamplug, ICY-Box ...) kernel build
+		ipfiremake linux			KCFG="-kirkwood"
+#		ipfiremake v4l-dvb			KCFG="-kirkwood"
+#		ipfiremake mISDN			KCFG="-kirkwood"
+		ipfiremake cryptodev			KCFG="-kirkwood"
+#		ipfiremake compat-drivers		KCFG="-kirkwood"
+#		ipfiremake r8169			KCFG="-kirkwood"
+#		ipfiremake r8168			KCFG="-kirkwood"
+#		ipfiremake r8101			KCFG="-kirkwood"
+#		ipfiremake e1000e			KCFG="-kirkwood"
+		ipfiremake igb				KCFG="-kirkwood"
+		;;
+  esac
   ipfiremake pkg-config
   ipfiremake linux-atm
   ipfiremake cpio
@@ -897,6 +897,22 @@ ipfirepackages() {
   rm -rf  $BASEDIR/build/install/packages/*
 }
 
+while [ $# -gt 0 ]; do
+	case "${1}" in
+		--target=*)
+			configure_target "${1#--target=}"
+			;;
+		-*)
+			exiterror "Unknown configuration option: ${1}"
+			;;
+		*)
+			# Found a command, so exit options parsing.
+			break
+			;;
+	esac
+	shift
+done
+
 # See what we're supposed to do
 case "$1" in 
 build)
diff --git a/tools/make-functions b/tools/make-functions
index 48fc6d4..6e9ad6c 100644
--- a/tools/make-functions
+++ b/tools/make-functions
@@ -60,6 +60,67 @@ WARN="\\033[1;35m"
 FAIL="\\033[1;31m"
 NORMAL="\\033[0;39m"
 
+configure_target() {
+	local target_arch="${1}"
+
+	if [ "${target_arch}" = "default" ]; then
+		target_arch="$(configure_target_guess)"
+	fi
+
+	case "${target_arch}" in
+		i586)
+			BUILDTARGET="${TARGET_ARCH}-pc-linux-gnu"
+			CROSSTARGET="${BUILD_ARCH}-cross-linux-gnu"
+			CFLAGS_ARCH="-march=i586 -fomit-frame-pointer"
+			;;
+
+		armv5tel)
+			BUILDTARGET="${TARGET_ARCH}-unknown-linux-gnueabi"
+			CROSSTARGET="${BUILD_ARCH}-cross-linux-gnueabi"
+			CFLAGS_ARCH="-march=armv5te -mfloat-abi=soft -fomit-frame-pointer"
+			MACHINE_TYPE="arm"
+			;;
+
+		*)
+			exiterror "Cannot build for architure ${target_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 [ -n "${qemu_target_helper}" ]; then
+			QEMU_TARGET_HELPER="${qemu_target_helper}"
+		else
+			exiterror "Could not find a binfmt_misc helper entry for ${target_arch}"
+		fi
+	fi
+
+	TARGET_ARCH="${target_arch}"
+
+	# Old variable names
+	MACHINE="${TARGET_ARCH}"
+
+	CFLAGS="-O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fPIC"
+	CFLAGS="${CFLAGS} -fstack-protector-all --param=ssp-buffer-size=4 ${CFLAGS_ARCH}"
+	CXXFLAGS="${CFLAGS}"
+}
+
+configure_target_guess() {
+	case "${BUILD_ARCH}" in
+		x86_64|i686|i586)
+			echo "i586"
+			;;
+		armv7*|armv6*|armv5*)
+			echo "armv5tel"
+			;;
+		*)
+			exiterror "Cannot guess target architecture"
+			;;
+	esac
+}
+
 evaluate() {
 	if [ "$?" -eq "0" ]; then
 		beautify message DONE
@@ -217,30 +278,6 @@ get_pkg_ver()
 	echo "$PKG_VER"
 } # End of get_pkg_ver()
 
-if [ 'x86_64' = $MACHINE -o 'i686' = $MACHINE -o 'i586' = $MACHINE ]; then
-	echo "`date -u '+%b %e %T'`: Machine is iX86 (or equivalent)" >> $LOGFILE
-	MACHINE=i586
-	CROSSTARGET=${MACHINE}-cross-linux-gnu
-	BUILDTARGET=i586-pc-linux-gnu
-	CFLAGS_ARCH="${GLOBAL_CFLAGS} -march=i586 -fomit-frame-pointer"
-elif [ 'armv5tejl' = $MACHINE -o 'armv5tel' = $MACHINE -o 'armv6l' = $MACHINE -o 'armv7l' = $MACHINE ]; then
-	echo "`date -u '+%b %e %T'`: Machine is ARM (or equivalent)" >> $LOGFILE
-	MACHINE=armv5tel
-	MACHINE_TYPE=arm
-	CROSSTARGET=${MACHINE}-cross-linux-gnueabi
-	BUILDTARGET=${MACHINE}-unknown-linux-gnueabi
-	CFLAGS_ARCH="-march=armv5te -mfloat-abi=soft -fomit-frame-pointer"
-else
-	echo "`date -u '+%b %e %T'`: Can't determine your architecture - $MACHINE"
-	exit 1
-fi
-
-CFLAGS="-O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fPIC"
-CFLAGS="${CFLAGS} -fstack-protector-all --param=ssp-buffer-size=4 ${CFLAGS_ARCH}"
-CXXFLAGS="${CFLAGS}"
-C2FLAGS="${CFLAGS}"
-CXX2FLAGS="${CXXFLAGS}"
-
 # Define immediately
 stdumount() {
 	umount $BASEDIR/build/sys			2>/dev/null;
@@ -282,22 +319,136 @@ fake_environ() {
 	env="${env} UTS_RELEASE=${KVER}"
 
 	# Fake machine version.
-	env="${env} UTS_MACHINE=${MACHINE}"
+	env="${env} UTS_MACHINE=${TARGET_ARCH}"
+
+	echo "${env}"
+}
+
+qemu_environ() {
+	local env
+
+	# Don't add anything if qemu is not used.
+	if ! qemu_is_required; then
+		return
+	fi
+
+	# Set default qemu options
+	case "${TARGET_ARCH}" in
+		arm*)
+			QEMU_CPU="${QEMU_CPU:-cortex-a9}"
+
+			env="${env} QEMU_CPU=${QEMU_CPU}"
+			;;
+	esac
+
+	# Enable QEMU strace
+	#env="${env} QEMU_STRACE=1"
 
 	echo "${env}"
 }
 
+qemu_is_required() {
+	local target_arch="${1}"
+
+	if [ -z "${target_arch}" ]; then
+		target_arch="${TARGET_ARCH}"
+	fi
+
+	case "${BUILD_ARCH},${target_arch}" in
+		x86_64,arm*|i?86,arm*)
+			return 0
+			;;
+		*)
+			return 1
+			;;
+	esac
+}
+
+qemu_install_helper() {
+	# Do nothing, if qemu is not required
+	if ! qemu_is_required; then
+		return 0
+	fi
+
+	if [ -z "${QEMU_TARGET_HELPER}" ]; then
+		exiterror "QEMU_TARGET_HELPER not set"
+	fi
+
+	# Check if the helper is already installed.
+	if [ -x "${LFS}${QEMU_TARGET_HELPER}" ]; then
+		return 0
+	fi
+
+	# Try to find a suitable binary that we can install
+	# to the build environment.
+	local file
+	for file in "${QEMU_TARGET_HELPER}" "${QEMU_TARGET_HELPER}-static"; do
+		# file must exist and be executable.
+		[ -x "${file}" ] || continue
+
+		# Must be static.
+		file_is_static "${file}" || continue
+
+		local dirname="${LFS}$(dirname "${file}")"
+		mkdir -p "${dirname}"
+
+		install -m 755 "${file}" "${LFS}${QEMU_TARGET_HELPER}"
+		return 0
+	done
+
+	exiterror "Could not find a statically-linked QEMU emulator: ${QEMU_TARGET_HELPER}"
+}
+
+qemu_find_target_helper_name() {
+	local target_arch="${1}"
+
+	local magic
+	case "${target_arch}" in
+		arm*)
+			magic="7f454c4601010100000000000000000002002800"
+			;;
+	esac
+
+	[ -z "${magic}" ] && return 1
+
+	local file
+	for file in /proc/sys/fs/binfmt_misc/*; do
+		# Search for the file with the correct magic value.
+		grep -qE "^magic ${magic}$" "${file}" || continue
+
+		local interpreter="$(grep "^interpreter" "${file}" | awk '{ print $2 }')"
+
+		[ -n "${interpreter}" ] || continue
+		[ "${interpreter:0:1}" = "/" ] || continue
+		[ -x "${interpreter}" ] || continue
+
+		echo "${interpreter}"
+		return 0
+	done
+
+	return 1
+}
+
+file_is_static() {
+	local file="${1}"
+
+	file ${file} 2>/dev/null | grep -q "statically linked"
+}
+
 entershell() {
 	if [ ! -e $BASEDIR/build/usr/src/lfs/ ]; then
 		exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/"
 	fi
 
+	# Install QEMU helper, if needed
+	qemu_install_helper
+
 	echo "Entering to a shell inside LFS chroot, go out with exit"
-	chroot $LFS /tools/bin/env -i HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
+	chroot $LFS /tools/bin/env -i HOME=/root TERM=$TERM PS1='ipfire build chroot ($(uname -m)) \u:\w\$ ' \
 		PATH=/tools/ccache/bin:/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
 		VERSION=$VERSION CONFIG_ROOT=$CONFIG_ROOT \
 		NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
-		CFLAGS="$CF2LAGS" CXXFLAGS="$CXX2FLAGS" \
+		CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" \
 		CCACHE_DIR=/usr/src/ccache \
 		CCACHE_COMPRESS=1 \
 		CCACHE_COMPILERCHECK="none" \
@@ -306,9 +457,9 @@ entershell() {
 		CROSSTARGET="${CROSSTARGET}" \
 		MACHINE="$MACHINE" \
 		MACHINE_TYPE="$MACHINE_TYPE" \
-		KGCC="ccache /usr/bin/gcc" \
 		$(fake_environ) \
-		/tools/bin/bash
+		$(qemu_environ) \
+		/tools/bin/bash -i
 	if [ $? -ne 0 ]; then
 			beautify message FAIL
 			exiterror "chroot error"
@@ -410,6 +561,9 @@ lfsmake2() {
 	lfsmakecommoncheck $*
 	[ $? == 1 ] && return 0
 
+	# Install QEMU helper, if needed
+	qemu_install_helper
+
 	local PKG_TIME_START=`date +%s`
 	chroot $LFS /tools/bin/env -i 	HOME=/root \
 						TERM=$TERM PS1='\u:\w\$ ' \
@@ -418,7 +572,7 @@ lfsmake2() {
 						SYSTEM_RELEASE="${SYSTEM_RELEASE}" \
 						CONFIG_ROOT=$CONFIG_ROOT \
 						NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
-						CFLAGS="$C2FLAGS" CXXFLAGS="$CXX2FLAGS" \
+						CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" \
 						CCACHE_DIR=/usr/src/ccache CCACHE_COMPRESS=1 \
 						CCACHE_COMPILERCHECK="none" \
 						KVER=$KVER MAKETUNING=$MAKETUNING \
@@ -426,6 +580,7 @@ lfsmake2() {
 						CROSSTARGET="${CROSSTARGET}" \
 						MACHINE="$MACHINE" \
 						MACHINE_TYPE="$MACHINE_TYPE" \
+						$(qemu_environ) \
 						$(fake_environ) \
 						/tools/bin/bash -x -c "cd /usr/src/lfs && \
 						make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
@@ -446,6 +601,9 @@ ipfiremake() {
 	lfsmakecommoncheck $*
 	[ $? == 1 ] && return 0
 
+	# Install QEMU helper, if needed
+	qemu_install_helper
+
 	local PKG_TIME_START=`date +%s`
 	chroot $LFS /tools/bin/env -i 	HOME=/root \
 						TERM=$TERM PS1='\u:\w\$ ' \
@@ -455,7 +613,7 @@ ipfiremake() {
 						CONFIG_ROOT=$CONFIG_ROOT \
 						NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
 						SYSTEM_RELEASE="$SYSTEM_RELEASE" \
-						CFLAGS="$C2FLAGS" CXXFLAGS="$CXX2FLAGS" \
+						CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" \
 						CCACHE_DIR=/usr/src/ccache CCACHE_COMPRESS=1 \
 						CCACHE_COMPILERCHECK="none" \
 						KVER=$KVER MAKETUNING=$MAKETUNING \
@@ -463,6 +621,7 @@ ipfiremake() {
 						CROSSTARGET="${CROSSTARGET}" \
 						MACHINE="$MACHINE" \
 						MACHINE_TYPE="$MACHINE_TYPE" \
+						$(qemu_environ) \
 						$(fake_environ) \
 						/bin/bash -x -c "cd /usr/src/lfs && \
 						make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
@@ -483,6 +642,9 @@ ipfiredist() {
 	lfsmakecommoncheck $*
 	[ $? == 1 ] && return 0
 	
+	# Install QEMU helper, if needed
+	qemu_install_helper
+
 	local PKG_TIME_START=`date +%s`
 	chroot $LFS /tools/bin/env -i 	HOME=/root \
 					TERM=$TERM PS1='\u:\w\$ ' \
@@ -490,7 +652,7 @@ ipfiredist() {
 					VERSION=$VERSION \
 					CONFIG_ROOT=$CONFIG_ROOT \
 					NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
-					CFLAGS="$C2FLAGS" CXXFLAGS="$CXX2FLAGS" \
+					CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" \
 					CCACHE_DIR=/usr/src/ccache CCACHE_COMPRESS=1 \
 					CCACHE_COMPILERCHECK="none" \
 					KVER=$KVER \
@@ -498,6 +660,7 @@ ipfiredist() {
 					CROSSTARGET="${CROSSTARGET}" \
 					MACHINE="$MACHINE" \
 					MACHINE_TYPE="$MACHINE_TYPE" \
+					$(qemu_environ) \
 					$(fake_environ) \
 					/bin/bash -x -c "cd /usr/src/lfs && \
 					make -f $1 LFS_BASEDIR=/usr/src dist" >>$LOGFILE 2>&1
@@ -518,6 +681,9 @@ installmake() {
 	lfsmakecommoncheck $*
 	[ $? == 1 ] && return 0
 
+	# Install QEMU helper, if needed
+	qemu_install_helper
+
 	local PKG_TIME_START=`date +%s`
 	chroot $LFS /tools/bin/env -i 	HOME=/root \
 						TERM=$TERM PS1='\u:\w\$ ' \
@@ -526,7 +692,7 @@ installmake() {
 						SYSTEM_RELEASE="${SYSTEM_RELEASE}" \
 						CONFIG_ROOT=$CONFIG_ROOT \
 						NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
-						CFLAGS="-Os" CXXFLAGS="-Os" \
+						CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" \
 						CCACHE_DIR=/usr/src/ccache CCACHE_COMPRESS=1 CCACHE_HASHDIR=1 \
 						KVER=$KVER \
 						BUILDTARGET="$BUILDTARGET" \


hooks/post-receive
--
IPFire 2.x development tree

                 reply	other threads:[~2014-05-26 21:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140526214638.F3A8920C37@argus.ipfire.org \
    --to=git@ipfire.org \
    --cc=ipfire-scm@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox