busybox: use unified /usr

This commit is contained in:
Lukas Rusak 2016-12-04 13:23:45 -08:00
parent 169d9e2bd4
commit 725ea4f977
No known key found for this signature in database
GPG Key ID: 8C310C807E7393A3
5 changed files with 40 additions and 45 deletions

View File

@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Busybox version: 1.25.0
# Wed Jul 20 11:53:10 2016
# Busybox version: 1.25.1
# Thu Nov 24 23:29:54 2016
#
CONFIG_HAVE_DOT_CONFIG=y
@ -25,7 +25,7 @@ CONFIG_FEATURE_VERBOSE_USAGE=y
# CONFIG_FEATURE_COMPRESS_USAGE is not set
CONFIG_BUSYBOX=y
# CONFIG_FEATURE_INSTALLER is not set
# CONFIG_INSTALL_NO_USR is not set
CONFIG_INSTALL_NO_USR=y
# CONFIG_LOCALE_SUPPORT is not set
CONFIG_UNICODE_SUPPORT=y
# CONFIG_UNICODE_USING_LOCALE is not set

View File

@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Busybox version: 1.25.0
# Wed Jul 20 11:54:40 2016
# Busybox version: 1.25.1
# Thu Nov 24 23:26:05 2016
#
CONFIG_HAVE_DOT_CONFIG=y

View File

@ -97,7 +97,7 @@ configure_target() {
cp $BUSYBOX_CFG_FILE_TARGET .config
# set install dir
sed -i -e "s|^CONFIG_PREFIX=.*$|CONFIG_PREFIX=\"$INSTALL\"|" .config
sed -i -e "s|^CONFIG_PREFIX=.*$|CONFIG_PREFIX=\"$INSTALL/usr\"|" .config
if [ ! "$DEVTOOLS" = yes ]; then
sed -i -e "s|^CONFIG_DEVMEM=.*$|# CONFIG_DEVMEM is not set|" .config
@ -134,7 +134,7 @@ configure_init() {
cp $BUSYBOX_CFG_FILE_INIT .config
# set install dir
sed -i -e "s|^CONFIG_PREFIX=.*$|CONFIG_PREFIX=\"$INSTALL\"|" .config
sed -i -e "s|^CONFIG_PREFIX=.*$|CONFIG_PREFIX=\"$INSTALL/usr\"|" .config
# optimize for size
CFLAGS=`echo $CFLAGS | sed -e "s|-Ofast|-Os|"`
@ -160,7 +160,6 @@ makeinstall_target() {
cp $PKG_DIR/scripts/apt-get $INSTALL/usr/bin/
cp $PKG_DIR/scripts/passwd $INSTALL/usr/bin/
cp $PKG_DIR/scripts/sudo $INSTALL/usr/bin/
ln -sf /bin/busybox $INSTALL/usr/bin/env #/usr/bin/env is needed for most python scripts
cp $PKG_DIR/scripts/pastebinit $INSTALL/usr/bin/
ln -sf pastebinit $INSTALL/usr/bin/paste
@ -191,10 +190,6 @@ makeinstall_target() {
# create /etc/hostname
ln -sf /proc/sys/kernel/hostname $INSTALL/etc/hostname
# systemd wants /usr/bin/mkdir
mkdir -p $INSTALL/usr/bin
ln -sf /bin/busybox $INSTALL/usr/bin/mkdir
# add webroot
mkdir -p $INSTALL/usr/www
echo "It works" > $INSTALL/usr/www/index.html
@ -206,7 +201,7 @@ makeinstall_target() {
post_install() {
ROOT_PWD="`$ROOT/$TOOLCHAIN/bin/cryptpw -m sha512 $ROOT_PASSWORD`"
echo "chmod 4755 $INSTALL/bin/busybox" >> $FAKEROOT_SCRIPT
echo "chmod 4755 $INSTALL/usr/bin/busybox" >> $FAKEROOT_SCRIPT
echo "chmod 000 $INSTALL/etc/shadow" >> $FAKEROOT_SCRIPT
add_user root "$ROOT_PWD" 0 0 "Root User" "/storage" "/bin/sh"
@ -237,8 +232,8 @@ post_install() {
makeinstall_init() {
mkdir -p $INSTALL/bin
ln -sf busybox $INSTALL/bin/sh
chmod 4755 $INSTALL/bin/busybox
ln -sf busybox $INSTALL/usr/bin/sh
chmod 4755 $INSTALL/usr/bin/busybox
mkdir -p $INSTALL/etc
touch $INSTALL/etc/fstab

View File

@ -17,8 +17,8 @@
################################################################################
export HOME="/storage"
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
export LD_LIBRARY_PATH="/usr/lib:/lib"
export PATH="/usr/bin:/usr/sbin"
export LD_LIBRARY_PATH="/usr/lib"
export HOSTNAME=`cat /etc/hostname`
export PS1="\[\e[1;32m\]\h\[\e[1;32m\]:\[\e[1;34m\]\w \[\e[0m\]\\$ "
# k0p

View File

@ -21,24 +21,24 @@
################################################################################
# create directories
/bin/busybox mkdir -p /dev
/bin/busybox mkdir -p /proc
/bin/busybox mkdir -p /sys
/bin/busybox mkdir -p /tmp
/bin/busybox mkdir -p /flash
/bin/busybox mkdir -p /sysroot
/bin/busybox mkdir -p /storage
/usr/bin/busybox mkdir -p /dev
/usr/bin/busybox mkdir -p /proc
/usr/bin/busybox mkdir -p /sys
/usr/bin/busybox mkdir -p /tmp
/usr/bin/busybox mkdir -p /flash
/usr/bin/busybox mkdir -p /sysroot
/usr/bin/busybox mkdir -p /storage
# mount all needed special filesystems
/bin/busybox mount -t devtmpfs devtmpfs /dev
/bin/busybox mount -t proc proc /proc
/bin/busybox mount -t sysfs sysfs /sys
/usr/bin/busybox mount -t devtmpfs devtmpfs /dev
/usr/bin/busybox mount -t proc proc /proc
/usr/bin/busybox mount -t sysfs sysfs /sys
# common functions
. /functions
# set needed variables
MODULE_DIR=/lib/modules
MODULE_DIR=/usr/lib/modules
UPDATE_ROOT=/storage/.update
UPDATE_DIR="$UPDATE_ROOT"
@ -271,19 +271,19 @@
ISCSI_DEV="${1##*,}"
ISCSI_OPTIONS="${1%,*}"
if [ ! -f "/sbin/iscsistart" ]; then
if [ ! -f "/usr/sbin/iscsistart" ]; then
error "iscsistart" "iSCSI support not available"
fi
if [ "$ISCSI_OPTIONS" = "auto" ]; then
progress "Network configuration based on iBFT"
/sbin/iscsistart -N >&$SILENT_OUT 2>&1 || \
/usr/sbin/iscsistart -N >&$SILENT_OUT 2>&1 || \
error "iscsistart" "Unable to configure network"
progress "iSCSI auto connect based on iBFT"
/sbin/iscsistart -b >&$SILENT_OUT 2>&1 || \
/usr/sbin/iscsistart -b >&$SILENT_OUT 2>&1 || \
error "iscsistart" "Unable to auto connect"
else
/sbin/iscsistart $(get_iscsistart_options "$ISCSI_OPTIONS") >&$SILENT_OUT 2>&1 || \
/usr/sbin/iscsistart $(get_iscsistart_options "$ISCSI_OPTIONS") >&$SILENT_OUT 2>&1 || \
error "iscsistart" "Unable to connect to ISCSI target"
fi
@ -554,16 +554,16 @@
sync
# unmount filesystems
if /bin/busybox mountpoint -q /flash ; then
/bin/busybox umount /flash
if /usr/bin/busybox mountpoint -q /flash ; then
/usr/bin/busybox umount /flash
fi
if /bin/busybox mountpoint -q /storage ; then
/bin/busybox umount /storage
if /usr/bin/busybox mountpoint -q /storage ; then
/usr/bin/busybox umount /storage
fi
usleep 2000000
/bin/busybox reboot
/usr/bin/busybox reboot
}
force_fsck() {
@ -577,7 +577,7 @@
if [ "$?" -ne "0" -o "$?" -gt "128" ] ; then
echo "Repairing filesystem..."
echo ""
/sbin/fsck -T -M -y $RUN_FSCK_DISKS
/usr/sbin/fsck -T -M -y $RUN_FSCK_DISKS
FSCK_RET="$?"
if [ "$(( $FSCK_RET & 8 ))" = 8 ] ; then
# fubar
@ -601,7 +601,7 @@
check_disks() {
if [ "$RUN_FSCK" = "yes" -a -n "$RUN_FSCK_DISKS" ]; then
progress "Checking disk(s): $RUN_FSCK_DISKS"
/sbin/fsck -T -M -p -a $RUN_FSCK_DISKS > /dev/null 2>&1
/usr/sbin/fsck -T -M -p -a $RUN_FSCK_DISKS > /dev/null 2>&1
FSCK_RET="$?"
# FSCK_RET is the bit-wise OR of the exit codes for each filesystem that is checked.
@ -991,7 +991,7 @@
mount --move /flash /sysroot/flash
mount --move /storage /sysroot/storage
if [ ! -d "/sysroot/lib/modules/$(uname -r)/" -a -f "/sysroot/usr/lib/systemd/systemd" ]; then
if [ ! -d "/sysroot/usr/lib/modules/$(uname -r)/" -a -f "/sysroot/usr/lib/systemd/systemd" ]; then
echo ""
echo "NEVER TOUCH boot= in extlinux.conf / cmdline.txt!"
echo "If you don't know what you are doing,"
@ -1040,10 +1040,10 @@
fi
done
# move some special filesystems
/bin/busybox mount --move /dev /sysroot/dev
/bin/busybox mount --move /proc /sysroot/proc
/bin/busybox mount --move /sys /sysroot/sys
/bin/busybox rm -fr /tmp
/usr/bin/busybox mount --move /dev /sysroot/dev
/usr/bin/busybox mount --move /proc /sysroot/proc
/usr/bin/busybox mount --move /sys /sysroot/sys
/usr/bin/busybox rm -fr /tmp
# tell OE settings addon to disable updates
if [ "$UPDATE_DISABLED" = "yes" ] ; then
@ -1068,6 +1068,6 @@
fi
# switch to new sysroot and start real init
exec /bin/busybox switch_root /sysroot /usr/lib/systemd/systemd $INIT_ARGS $INIT_UNIT
exec /usr/bin/busybox switch_root /sysroot /usr/lib/systemd/systemd $INIT_ARGS $INIT_UNIT
error "switch_root" "Error in initramfs. Could not switch to new root"