runx: allow internal and external busybox

runx knows how to build its own copy of busybox for its initrd,
adding a flag to allow us to select which mode we want.

Signed-off-by: Bruce Ashfield <bruce.ashfield@xilinx.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
This commit is contained in:
Bruce Ashfield 2020-09-22 12:37:04 -07:00
parent b40be07bf0
commit cdf6f55347
3 changed files with 1645 additions and 5 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,348 @@
From d6df537fe5098c0e9f50deecab85b2102049030a Mon Sep 17 00:00:00 2001
From: Stefano Stabellini <sstabellini@kernel.org>
Date: Mon, 21 Sep 2020 13:15:53 -0700
Subject: [PATCH 2/2] don't call busybox --install
Busybox --install is very convenient but has the problem that it only
works for native builds. If busybox is of a different arch compared to
the target, it cannot be run at build time.
Solve the problem by install busybox, and creating links to it, by hand.
Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
---
initrd/applet-list | 308 +++++++++++++++++++++++++++++++++++++++++++++
initrd/make-initrd | 5 +-
2 files changed, 312 insertions(+), 1 deletion(-)
create mode 100644 initrd/applet-list
Index: git/initrd/applet-list
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ git/initrd/applet-list 2020-09-21 18:29:35.560281087 -0700
@@ -0,0 +1,308 @@
+ipneigh
+tee
+mpstat
+lzop
+ip
+inotifyd
+rdate
+nslookup
+switch_root
+sendmail
+slattach
+sum
+od
+less
+vlock
+cmp
+dnsdomainname
+renice
+fsync
+unlzop
+xxd
+stat
+flock
+fbset
+bzip2
+fdisk
+fallocate
+deallocvt
+cat
+mkdir
+traceroute
+dc
+loadfont
+nohup
+wc
+ping6
+login
+ifdown
+shred
+false
+pwd
+uname
+hd
+hdparm
+expand
+lspci
+shuf
+time
+tunctl
+sha3sum
+sed
+ed
+makemime
+factor
+ls
+volname
+stty
+truncate
+nproc
+openvt
+hexdump
+mountpoint
+nl
+more
+wget
+traceroute6
+linuxrc
+fbsplash
+pstree
+kill
+df
+uptime
+split
+arch
+getty
+syslogd
+cpio
+unexpand
+sha512sum
+sha256sum
+clear
+rdev
+md5sum
+egrep
+lzma
+rmdir
+tail
+netstat
+mkswap
+pkill
+fstrim
+bzcat
+chmod
+mount
+paste
+rev
+fsck
+ping
+ifup
+mesg
+gzip
+setconsole
+printenv
+swapoff
+unxz
+sort
+chpasswd
+true
+linux32
+blkid
+env
+dd
+fatattr
+bc
+[[
+mkfifo
+route
+xz
+setkeycodes
+install
+mkpasswd
+awk
+rm
+nsenter
+which
+sh
+ln
+fdflush
+test
+ttysize
+fuser
+base64
+run-parts
+ntpd
+mv
+printf
+nanddump
+zcat
+basename
+xzcat
+unlzma
+ipcs
+ash
+tar
+iplink
+sysctl
+crontab
+chown
+watchdog
+partprobe
+ifconfig
+chvt
+readahead
+add-shell
+ipaddr
+link
+getopt
+reboot
+blkdiscard
+pscan
+nandwrite
+cksum
+iostat
+deluser
+du
+tty
+iprule
+setserial
+eject
+unix2dos
+free
+conspy
+pivot_root
+setfont
+kbd_mode
+strings
+groups
+ionice
+swapon
+smemcap
+brctl
+yes
+cal
+bbconfig
+uudecode
+logger
+watch
+[
+udhcpc
+acpid
+echo
+setsid
+expr
+readlink
+linux64
+sync
+uuencode
+insmod
+rmmod
+raidautorun
+nbd-client
+ipcrm
+modinfo
+adjtimex
+unzip
+cp
+killall
+delgroup
+blockdev
+halt
+modprobe
+showkey
+setlogcons
+whois
+lsof
+vi
+grep
+sha1sum
+ps
+timeout
+crond
+hwclock
+unlink
+touch
+losetup
+iptunnel
+fold
+id
+chroot
+rfkill
+mdev
+lzcat
+microcom
+chgrp
+date
+udhcpc6
+init
+su
+head
+remove-shell
+reset
+realpath
+xargs
+cut
+poweroff
+killall5
+addgroup
+logread
+resize
+pipe_progress
+findfs
+dumpkmap
+reformime
+fdformat
+arping
+nologin
+lsmod
+mkdosfs
+klogd
+dirname
+umount
+setpriv
+cryptpw
+usleep
+pgrep
+hostname
+powertop
+dos2unix
+iproute
+ether-wake
+nice
+vconfig
+gunzip
+hostid
+top
+tr
+sleep
+mkfs.vfat
+comm
+lzopcat
+depmod
+arp
+mktemp
+uniq
+dumpleases
+adduser
+mknod
+dmesg
+nmeter
+lsusb
+find
+unshare
+nameif
+whoami
+ifenslave
+pwdx
+loadkmap
+pmap
+ipcalc
+tac
+bunzip2
+beep
+pidof
+nc
+fgrep
+readprofile
+seq
+diff
Index: git/initrd/make-initrd
===================================================================
--- git.orig/initrd/make-initrd 2020-09-21 18:29:35.564281091 -0700
+++ git/initrd/make-initrd 2020-09-21 18:30:42.528356223 -0700
@@ -58,7 +58,11 @@
if [ -n "$QEMU_USER" ]; then
$QEMU_USER $tmpdir/bin/busybox --install $tmpdir/bin
else
- echo "QEMU_USER is not defined, no binary symlinks will be available"
+ echo "QEMU_USER is not defined, default binary symlinks will be available"
+ for i in `cat "$base"/applet-list`
+ do
+ ln -s /bin/busybox $tmpdir/bin/$i
+ done
fi
else
$tmpdir/bin/busybox --install $tmpdir/bin

View File

@ -14,6 +14,11 @@ SRC_URI = "\
file://0001-make-initrd-cross-install-tweaks.patch \
file://0001-runX-add-bounded-looping-timeout.patch \
"
SRC_URI += "file://0001-Add-busybox-cross-build-for-arm64.patch \
file://0002-don-t-call-busybox-install.patch \
"
SRC_URI[md5sum] = "ce9b2d974d27408a61c53a30d3f98fb9"
SRC_URI[sha256sum] = "bf338980b1670bca287f9994b7441c2361907635879169c64ae78364efc5f491"
@ -33,6 +38,7 @@ inherit kernel-arch
# we have a busybox bbappend that makes /bin available to the
# sysroot, and hence gets us the target binary that we need
DEPENDS = "busybox-initrd go-build"
DEPENDS += "resolvconf"
# for the kernel build phase
DEPENDS += "openssl-native coreutils-native util-linux-native xz-native bc-native"
@ -42,6 +48,8 @@ RDEPENDS_${PN} += " jq bash"
RDEPENDS_${PN} += " xen-tools-xl go-build socat daemonize"
RDEPENDS_${PN} += " qemu-system-i386 ca-certificates qemu qemu-keymaps"
RUNX_USE_INTERNAL_BUSYBOX ?= ""
do_compile() {
# we'll need this for the initrd later, so lets error if it isn't what
# we expect (statically linked)
@ -77,11 +85,22 @@ do_compile() {
${S}/kernel/make-kernel
# construct the initrd
echo "[INFO]: runx: constructing the initrd"
cp ${STAGING_DIR_HOST}/bin/busybox.nosuid ${WORKDIR}/busybox
export QEMU_USER="`which qemu-${HOST_ARCH}` -L ${STAGING_BASELIBDIR}/.."
export BUSYBOX="${WORKDIR}/busybox"
export CROSS_COMPILE="t"
bbnote "runx: constructing the initrd"
if [ -z "${RUNX_USE_INTERNAL_BUSYBOX}" ]; then
bbnote "runx: using external busybox"
cp ${STAGING_DIR_HOST}/bin/busybox.nosuid ${WORKDIR}/busybox
export QEMU_USER="`which qemu-${HOST_ARCH}` -L ${STAGING_BASELIBDIR}/.."
export BUSYBOX="${WORKDIR}/busybox"
export CROSS_COMPILE="${TARGET_PREFIX}"
else
bbnote "runx: using internal busybox"
export CC="${CC}"
export LD="${LD}"
export CFLAGS="${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${CFLAGS}"
export LDFLAGS="${TOOLCHAIN_OPTIONS} ${HOST_LD_ARCH} ${LDFLAGS}"
export HOSTCFLAGS="${BUILD_CFLAGS} ${BUILD_LDFLAGS}"
export CROSS_COMPILE="${TARGET_PREFIX}"
fi
${S}/initrd/make-initrd
}