mirror of
https://github.com/libretro/Lakka.git
synced 2024-11-23 07:49:52 +00:00
busybox: merge 'busybox-initramfs' with 'busybox', use $INSTALL_ROOT and $INSTALL_SYSTEM to seperate initramfs from system
Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
347ad522b0
commit
0cb90a2474
@ -1,53 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
|
||||
#
|
||||
# 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; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This Program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenELEC.tv; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
. config/options $1
|
||||
|
||||
$SCRIPTS/unpack busybox
|
||||
|
||||
if [ -f $PROJECT_DIR/$PROJECT/busybox/$1.conf ]; then
|
||||
BUSYBOX_CFG_FILE=$PROJECT_DIR/$PROJECT/busybox/$1.conf
|
||||
else
|
||||
BUSYBOX_CFG_FILE=$ROOT/$PKG_DIR/config/$1.conf
|
||||
fi
|
||||
|
||||
# busybox fails building with LTO support on gcc-4.6
|
||||
strip_lto
|
||||
|
||||
# optimize for size
|
||||
CFLAGS=`echo $CFLAGS | sed -e "s|-Ofast|-Os|"`
|
||||
CFLAGS=`echo $CFLAGS | sed -e "s|-O.|-Os|"`
|
||||
|
||||
LDFLAGS="$LDFLAGS -fwhole-program"
|
||||
|
||||
cd $BUILD/busybox*
|
||||
|
||||
# Build Busybox for initramfs
|
||||
make distclean
|
||||
cp $BUSYBOX_CFG_FILE .config
|
||||
make oldconfig
|
||||
|
||||
make ARCH=$TARGET_ARCH \
|
||||
HOSTCC=$HOST_CC \
|
||||
CROSS_COMPILE=$TARGET_PREFIX \
|
||||
KBUILD_VERBOSE="1" \
|
||||
install
|
File diff suppressed because it is too large
Load Diff
@ -1,49 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
|
||||
#
|
||||
# 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; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This Program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenELEC.tv; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
. config/options $1
|
||||
|
||||
mkdir -p $INSTALL/bin
|
||||
cp -PR $BUILD/busybox*/_install-initramfs/bin/busybox $INSTALL/bin
|
||||
ln -sf busybox $INSTALL/bin/sh
|
||||
chmod 4755 $INSTALL/bin/busybox
|
||||
|
||||
mkdir -p $INSTALL/etc
|
||||
touch $INSTALL/etc/fstab
|
||||
ln -sf /proc/self/mounts $INSTALL/etc/mtab
|
||||
|
||||
mkdir -p $INSTALL/splash
|
||||
if [ -f $PROJECT_DIR/$PROJECT/splash/splash.ppm ]; then
|
||||
cp $PROJECT_DIR/$PROJECT/splash/splash.ppm $INSTALL/splash
|
||||
else
|
||||
cp $PKG_DIR/splash/splash.ppm $INSTALL/splash
|
||||
fi
|
||||
|
||||
mkdir -p $INSTALL/dev
|
||||
mkdir -p $INSTALL/proc
|
||||
mkdir -p $INSTALL/sys
|
||||
mkdir -p $INSTALL/flash
|
||||
mkdir -p $INSTALL/sysroot
|
||||
mkdir -p $INSTALL/storage
|
||||
|
||||
cp $PKG_DIR/scripts/init $INSTALL
|
||||
chmod 755 $INSTALL/init
|
@ -1,36 +0,0 @@
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
|
||||
#
|
||||
# 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; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This Program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenELEC.tv; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
PKG_NAME="busybox-initramfs"
|
||||
PKG_VERSION=""
|
||||
PKG_REV="1"
|
||||
PKG_ARCH="any"
|
||||
PKG_LICENSE="GPL"
|
||||
PKG_SITE="http://www.busybox.net"
|
||||
PKG_URL=""
|
||||
PKG_DEPENDS=""
|
||||
PKG_BUILD_DEPENDS="toolchain"
|
||||
PKG_PRIORITY="required"
|
||||
PKG_SECTION="system"
|
||||
PKG_SHORTDESC="BusyBox: The Swiss Army Knife of Embedded Linux"
|
||||
PKG_LONGDESC="BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts. BusyBox provides a fairly complete environment for any small or embedded system."
|
||||
PKG_IS_ADDON="no"
|
||||
|
||||
PKG_AUTORECONF="no"
|
@ -1,261 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
|
||||
# Copyright (C) 2010-2011 Roman Weber (roman@openelec.tv)
|
||||
#
|
||||
# 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; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This Program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenELEC.tv; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
UPDATE_DIR=/storage/.update
|
||||
|
||||
IMAGE_SYSTEM="SYSTEM"
|
||||
IMAGE_KERNEL="KERNEL"
|
||||
REBOOT="0"
|
||||
|
||||
# defaults for booting from an nbd root
|
||||
NBD_ROOT_SERVER="192.168.1.1"
|
||||
NBD_ROOT_PORT="2000"
|
||||
NFS_OVERLAY="192.168.1.1:/var/lib/overlay"
|
||||
|
||||
# mount all needed special filesystems
|
||||
/bin/busybox mount -t devtmpfs none /dev
|
||||
/bin/busybox mount -t proc none /proc
|
||||
/bin/busybox mount -t sysfs none /sys
|
||||
|
||||
# hide kernel log messages on console
|
||||
echo '1 4 1 7' > /proc/sys/kernel/printk
|
||||
|
||||
# parse command line arguments
|
||||
for arg in $(cat /proc/cmdline); do
|
||||
case $arg in
|
||||
debugging)
|
||||
DEBUG=yes
|
||||
;;
|
||||
nosplash)
|
||||
SPLASH=no
|
||||
;;
|
||||
bootchart)
|
||||
BOOTCHART=yes
|
||||
;;
|
||||
ssh)
|
||||
SSH=yes
|
||||
;;
|
||||
progress)
|
||||
PROGRESS=yes
|
||||
;;
|
||||
fastboot)
|
||||
FASTBOOT=yes
|
||||
;;
|
||||
netboot)
|
||||
NETBOOT=yes
|
||||
;;
|
||||
nbdroot=*)
|
||||
nbdroot="${arg#nbdroot=}"
|
||||
NBD_ROOT_SERVER=$( echo "${nbdroot}" | /bin/busybox sed 's/:.*//')
|
||||
NBD_ROOT_PORT=$( echo "${nbdroot}" | /bin/busybox sed 's/.*://')
|
||||
;;
|
||||
nbdserver=*)
|
||||
NBD_ROOT_SERVER="${arg#nbdserver=}"
|
||||
;;
|
||||
nbdport=*)
|
||||
NBD_ROOT_PORT="${arg#nbdport=}"
|
||||
;;
|
||||
nfsoverlay=*)
|
||||
NFS_OVERLAY="${arg#nfsoverlay=}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test "$FASTBOOT" = "yes"; then
|
||||
IONICE="/bin/busybox ionice -c 1 -n 0"
|
||||
fi
|
||||
|
||||
progress() {
|
||||
if test "$PROGRESS" = "yes"; then
|
||||
echo "### $1 ###"
|
||||
fi
|
||||
}
|
||||
|
||||
show_splash() {
|
||||
if [ ! -e /dev/fb0 ]; then
|
||||
SPLASH=no
|
||||
fi
|
||||
|
||||
if [ -f /flash/oemsplash.ppm ]; then
|
||||
SPLASHIMAGE="/flash/oemsplash.ppm"
|
||||
elif [ -f /splash/splash.ppm ]; then
|
||||
SPLASHIMAGE="/splash/splash.ppm"
|
||||
else
|
||||
SPLASH=no
|
||||
fi
|
||||
|
||||
if [ "$SPLASH" = "no" ]; then
|
||||
break
|
||||
else
|
||||
/bin/busybox fbsplash -c -s "$SPLASHIMAGE" -d /dev/fb0
|
||||
fi
|
||||
}
|
||||
|
||||
error() {
|
||||
echo "Error Code: $1 that means: $2"
|
||||
}
|
||||
|
||||
debug_shell() {
|
||||
echo "### Starting debugging shell... type exit to quit ###"
|
||||
/bin/busybox sh </dev/tty1 >/dev/tty1 2>&1
|
||||
}
|
||||
|
||||
mount_part() {
|
||||
# progress "check filesystem $1 ..."
|
||||
# /sbin/fsck -M -T -a $1 > /dev/null 2>&1
|
||||
|
||||
for i in 1 2 3 4 5 6 7 8 9 10; do
|
||||
ERR_ENV=1
|
||||
MOUNT_OPTIONS="-o $3 $1 $2"
|
||||
|
||||
if [ -n "$4" ]; then
|
||||
MOUNT_OPTIONS="-t $4 $MOUNT_OPTIONS"
|
||||
fi
|
||||
|
||||
progress "mount filesystem $1 ..."
|
||||
$IONICE /bin/busybox mount $MOUNT_OPTIONS > /dev/null 2>&1
|
||||
[ "$?" -eq "0" ] && ERR_ENV=0 && break
|
||||
|
||||
/bin/busybox usleep 1000000
|
||||
done
|
||||
[ "$ERR_ENV" -ne "0" ] && error "INIT_4" "Could not mount $1" && debug_shell
|
||||
}
|
||||
|
||||
update() {
|
||||
if [ -f "$UPDATE_DIR/$2" ]; then
|
||||
echo "updating $1..."
|
||||
$IONICE /bin/busybox mount -o remount,rw /flash
|
||||
$IONICE /bin/busybox mv $UPDATE_DIR/$2 $3
|
||||
$IONICE /bin/busybox mount -o remount,ro /flash
|
||||
$IONICE /bin/busybox sync
|
||||
[ "$2" = "$IMAGE_KERNEL" ] && REBOOT="1"
|
||||
fi
|
||||
}
|
||||
|
||||
hfsdiskprep() {
|
||||
for DEVICE in /dev/sd*; do
|
||||
for device in $(/bin/busybox blkid $DEVICE); do
|
||||
case $device in
|
||||
TYPE=*)
|
||||
FS_TYPE=${device#TYPE=}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$FS_TYPE" = "\"hfs\"" -o "$FS_TYPE" = "\"hfsplus\"" ]; then
|
||||
progress "check filesystem $DEVICE [$FS_TYPE]..."
|
||||
/bin/fsck_hfs -r -y $DEVICE > /dev/null 2>&1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
mount_nbd() {
|
||||
retry_nr=0
|
||||
retry_delay=20
|
||||
OVERLAY_DIR=`cat /sys/class/net/eth0/address | /bin/busybox tr -d :`
|
||||
|
||||
while [ ${retry_nr} -lt ${retry_delay} ] && [ ! -e /sysroot/sbin/init ]; do
|
||||
[ ${retry_nr} -gt 0 ] && \
|
||||
$IONICE /bin/busybox nbd-client $NBD_ROOT_SERVER $NBD_ROOT_PORT /dev/nbd0 && \
|
||||
mount_part "/dev/nbd0" "/sysroot" "ro" "squashfs"
|
||||
|
||||
retry_nr=$(( ${retry_nr} + 1 ))
|
||||
|
||||
[ ! -e /sysroot/sbin/init ] && /bin/busybox usleep 1000000
|
||||
|
||||
[ ${retry_nr} -gt 0 ]
|
||||
done
|
||||
|
||||
if [ ! -e /sysroot/sbin/init ]; then
|
||||
error "INIT_2" "Could not mount NBD root from $NBD_ROOT_SERVER port $NBD_ROOT_PORT"
|
||||
debug_shell
|
||||
fi
|
||||
|
||||
mount_part "$NFS_OVERLAY" "/sysroot/storage" "rw,nolock,retrans=10" "nfs"
|
||||
|
||||
if [ ! -d /sysroot/storage/$OVERLAY_DIR ]; then
|
||||
mkdir /sysroot/storage/$OVERLAY_DIR
|
||||
fi
|
||||
|
||||
/bin/busybox umount /sysroot/storage
|
||||
mount_part "$NFS_OVERLAY/$OVERLAY_DIR" "/sysroot/storage" "rw,nolock" "nfs"
|
||||
}
|
||||
|
||||
mount_disk() {
|
||||
|
||||
# deal with hfs partitions
|
||||
if [ -x /sbin/fsck_hfs ]; then
|
||||
hfsdiskprep
|
||||
fi
|
||||
|
||||
mount_part "$boot" "/flash" "ro,noatime"
|
||||
show_splash
|
||||
|
||||
if [ -n "$disk" ]; then
|
||||
mount_part "$disk" "/storage" "rw,noatime"
|
||||
|
||||
if [ -f "/flash/MACH_KERNEL" ]; then
|
||||
IMAGE_KERNEL="MACH_KERNEL"
|
||||
fi
|
||||
|
||||
update "Kernel" "$IMAGE_KERNEL" "/flash/$IMAGE_KERNEL"
|
||||
update "System" "$IMAGE_SYSTEM" "/flash/$IMAGE_SYSTEM"
|
||||
|
||||
if test "$REBOOT" -eq "1"; then
|
||||
echo "System reboots now..." && \
|
||||
/bin/busybox reboot
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f "/flash/$IMAGE_SYSTEM" ]; then
|
||||
mount_part "/flash/$IMAGE_SYSTEM" "/sysroot" "ro,loop"
|
||||
[ "$ERR_ENV" -ne "0" ] && debug_shell
|
||||
else
|
||||
error "INIT_2" "Could not find system."
|
||||
debug_shell
|
||||
fi
|
||||
|
||||
# move /flash and /storage to /sysroot
|
||||
/bin/busybox mount --move /flash /sysroot/flash
|
||||
|
||||
if [ -n "$disk" ]; then
|
||||
/bin/busybox mount --move /storage /sysroot/storage
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -z "$NETBOOT" ]; then
|
||||
mount_disk
|
||||
else
|
||||
mount_nbd
|
||||
fi
|
||||
|
||||
# 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
|
||||
|
||||
# switch to new sysroot and start real init
|
||||
exec /bin/busybox switch_root /sysroot /sbin/init
|
||||
|
||||
error "INIT_3" "Error in initramfs. Could not switch to new root"
|
||||
debug_shell
|
@ -176,7 +176,7 @@ CONFIG_FEATURE_DATE_COMPAT=y
|
||||
CONFIG_ID=y
|
||||
CONFIG_GROUPS=y
|
||||
CONFIG_TEST=y
|
||||
# CONFIG_FEATURE_TEST_64 is not set
|
||||
CONFIG_FEATURE_TEST_64=y
|
||||
CONFIG_TOUCH=y
|
||||
CONFIG_TR=y
|
||||
CONFIG_FEATURE_TR_CLASSES=y
|
||||
@ -671,7 +671,7 @@ CONFIG_FEATURE_CROND_DIR=""
|
||||
# CONFIG_DEVMEM is not set
|
||||
CONFIG_EJECT=y
|
||||
CONFIG_FEATURE_EJECT_SCSI=y
|
||||
# CONFIG_FBSPLASH is not set
|
||||
CONFIG_FBSPLASH=y
|
||||
# CONFIG_FLASHCP is not set
|
||||
# CONFIG_FLASH_LOCK is not set
|
||||
# CONFIG_FLASH_UNLOCK is not set
|
||||
|
@ -1,27 +0,0 @@
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
|
||||
#
|
||||
# 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; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This Program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenELEC.tv; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# mounting needed filesystems
|
||||
#
|
||||
# runlevels: openelec, installer, textmode
|
||||
|
||||
progress "mounting needed filesystems"
|
||||
mount -n -t ramfs none /var
|
@ -24,11 +24,18 @@
|
||||
# runlevels: openelec, installer, textmode
|
||||
|
||||
progress "make variable directory structure"
|
||||
|
||||
mkdir -p /media
|
||||
mkdir -p /run
|
||||
mkdir -p /tmp
|
||||
|
||||
mkdir -p /var
|
||||
ln -sf /run /var/run
|
||||
|
||||
mkdir -p /var/cache \
|
||||
/var/lib \
|
||||
/var/lock \
|
||||
/var/media \
|
||||
/var/run \
|
||||
/var/tmp \
|
||||
/var/run/sepermit \
|
||||
/var/run/lirc
|
||||
|
@ -32,44 +32,57 @@ USER_PWD="`$ROOT/$TOOLCHAIN/bin/cryptpw -m sha512 $USER_PASSWORD`"
|
||||
add_user $USER_NAME "$USER_PWD" 1000 1000 "User" "/storage" "/bin/sh"
|
||||
add_group $USER_GROUP 1000
|
||||
|
||||
cp -PR $BUILD/busybox*/_install-system/* $INSTALL
|
||||
echo "chmod 4755 $INSTALL/bin/busybox" >> $FAKEROOT_SCRIPT
|
||||
cp -PR $BUILD/busybox*/_install-system/* $INSTALL_ROOT
|
||||
echo "chmod 4755 $INSTALL_ROOT/bin/busybox" >> $FAKEROOT_SCRIPT
|
||||
|
||||
mkdir -p $INSTALL/usr/bin
|
||||
cp $PKG_DIR/scripts/createlog $INSTALL/usr/bin/
|
||||
cp $PKG_DIR/scripts/lsb_release $INSTALL/usr/bin/
|
||||
ln -sf /bin/busybox $INSTALL/usr/bin/env #/usr/bin/env is needed for most python scripts
|
||||
mkdir -p $INSTALL_ROOT
|
||||
cp $PKG_DIR/scripts/init $INSTALL_ROOT
|
||||
|
||||
mkdir -p $INSTALL/sbin
|
||||
cp $PKG_DIR/scripts/init $INSTALL/sbin/
|
||||
|
||||
mkdir -p $INSTALL/etc
|
||||
cp $PKG_DIR/config/profile $INSTALL/etc
|
||||
cp $PKG_DIR/config/syslog.conf $INSTALL/etc
|
||||
cp $PKG_DIR/config/httpd.conf $INSTALL/etc
|
||||
echo "chmod 000 $INSTALL/etc/shadow" >> $FAKEROOT_SCRIPT
|
||||
|
||||
# /etc/fstab is needed by...
|
||||
touch $INSTALL/etc/fstab
|
||||
|
||||
# /etc/hosts must be writeable
|
||||
ln -sf /var/cache/hosts $INSTALL/etc/hosts
|
||||
mkdir -p $INSTALL_ROOT/etc
|
||||
touch $INSTALL_ROOT/etc/fstab
|
||||
|
||||
# /etc/mtab is needed by udisks etc...
|
||||
ln -sf /proc/self/mounts $INSTALL/etc/mtab
|
||||
ln -sf /proc/self/mounts $INSTALL_ROOT/etc/mtab
|
||||
|
||||
mkdir -p $INSTALL_SYSTEM/bin
|
||||
cp $PKG_DIR/scripts/createlog $INSTALL_SYSTEM/bin/
|
||||
cp $PKG_DIR/scripts/lsb_release $INSTALL_SYSTEM/bin/
|
||||
ln -sf /bin/busybox $INSTALL_SYSTEM/bin/env #/usr/bin/env is needed for most python scripts
|
||||
|
||||
mkdir -p $INSTALL_SYSTEM/etc
|
||||
cp $PKG_DIR/config/profile $INSTALL_SYSTEM/etc
|
||||
cp $PKG_DIR/config/syslog.conf $INSTALL_SYSTEM/etc
|
||||
cp $PKG_DIR/config/httpd.conf $INSTALL_SYSTEM/etc
|
||||
echo "chmod 000 $INSTALL_SYSTEM/etc/shadow" >> $FAKEROOT_SCRIPT
|
||||
|
||||
# /etc/fstab is needed by...
|
||||
touch $INSTALL_SYSTEM/etc/fstab
|
||||
|
||||
# /etc/hosts must be writeable
|
||||
ln -sf /var/cache/hosts $INSTALL_SYSTEM/etc/hosts
|
||||
|
||||
# /etc/mtab is needed by udisks etc...
|
||||
ln -sf /proc/self/mounts $INSTALL_SYSTEM/etc/mtab
|
||||
|
||||
# create /etc/hostname
|
||||
ln -sf /proc/sys/kernel/hostname $INSTALL/etc/hostname
|
||||
ln -sf /proc/sys/kernel/hostname $INSTALL_SYSTEM/etc/hostname
|
||||
|
||||
mkdir -p $INSTALL/etc/modprobe.d
|
||||
cp $PKG_DIR/modprobe.d/* $INSTALL/etc/modprobe.d
|
||||
mkdir -p $INSTALL_SYSTEM/etc/modprobe.d
|
||||
cp $PKG_DIR/modprobe.d/* $INSTALL_SYSTEM/etc/modprobe.d
|
||||
|
||||
mkdir -p $INSTALL_ROOT/lib/splash
|
||||
if [ -f $PROJECT_DIR/$PROJECT/splash/splash.ppm ]; then
|
||||
cp $PROJECT_DIR/$PROJECT/splash/splash.ppm $INSTALL_ROOT/lib/splash
|
||||
else
|
||||
cp $PKG_DIR/splash/splash.ppm $INSTALL_ROOT/lib/splash
|
||||
fi
|
||||
|
||||
# add user modprobe.d dir
|
||||
mkdir -p $INSTALL/usr/config/modprobe.d
|
||||
mkdir -p $INSTALL_SYSTEM/config/modprobe.d
|
||||
|
||||
# add webroot
|
||||
mkdir -p $INSTALL/usr/www
|
||||
echo "It works" > $INSTALL/usr/www/index.html
|
||||
mkdir -p $INSTALL_SYSTEM/www
|
||||
echo "It works" > $INSTALL_SYSTEM/www/index.html
|
||||
|
||||
mkdir -p $INSTALL/usr/www/error
|
||||
echo "404" > $INSTALL/usr/www/error/404.html
|
||||
mkdir -p $INSTALL_SYSTEM/www/error
|
||||
echo "404" > $INSTALL_SYSTEM/www/error/404.html
|
||||
|
@ -25,7 +25,7 @@ PKG_ARCH="any"
|
||||
PKG_LICENSE="GPL"
|
||||
PKG_SITE="http://www.busybox.net"
|
||||
PKG_URL="http://busybox.net/downloads/$PKG_NAME-$PKG_VERSION.tar.bz2"
|
||||
PKG_DEPENDS="kexec-tools grep hdparm speedcontrol pastebinit"
|
||||
PKG_DEPENDS="util-linux kmod kexec-tools grep hdparm speedcontrol pastebinit"
|
||||
PKG_BUILD_DEPENDS="toolchain busybox-hosttools"
|
||||
PKG_PRIORITY="required"
|
||||
PKG_SECTION="system"
|
||||
|
@ -3,6 +3,7 @@
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
|
||||
# Copyright (C) 2010-2011 Roman Weber (roman@openelec.tv)
|
||||
#
|
||||
# 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
|
||||
@ -20,18 +21,244 @@
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
# mounting needed special filesystems
|
||||
# mount -n -t proc none /proc # mounted in initramfs
|
||||
# mount -n -t sysfs none /sys # mounted in initramfs
|
||||
# mount -n -t devtmpfs none /dev # mounted in initramfs
|
||||
UPDATE_DIR=/storage/.update
|
||||
|
||||
IMAGE_SYSTEM="SYSTEM"
|
||||
IMAGE_KERNEL="KERNEL"
|
||||
REBOOT="0"
|
||||
|
||||
# defaults for booting from an nbd root
|
||||
NBD_ROOT_SERVER="192.168.1.1"
|
||||
NBD_ROOT_PORT="2000"
|
||||
NFS_OVERLAY="192.168.1.1:/var/lib/overlay"
|
||||
|
||||
# mount all needed special filesystems
|
||||
mkdir -p /dev
|
||||
mount -t devtmpfs none /dev
|
||||
mkdir -p /dev/pts
|
||||
mount -t devpts -o gid=5,mode=620 none /dev/pts
|
||||
mkdir -p /dev/shm
|
||||
mount -t tmpfs none /dev/shm
|
||||
mkdir -p /proc
|
||||
mount -t proc none /proc
|
||||
mkdir -p /sys
|
||||
mount -t sysfs none /sys
|
||||
|
||||
# disable cursor blink
|
||||
echo 0 > /sys/devices/virtual/graphics/fbcon/cursor_blink
|
||||
|
||||
mkdir -p /dev/pts
|
||||
mount -n -t devpts -o gid=5,mode=620 none /dev/pts
|
||||
# hide kernel log messages on console
|
||||
echo '1 4 1 7' > /proc/sys/kernel/printk
|
||||
|
||||
mkdir -p /dev/shm
|
||||
mount -n -t tmpfs none /dev/shm
|
||||
# parse command line arguments
|
||||
for arg in $(cat /proc/cmdline); do
|
||||
case $arg in
|
||||
debugging)
|
||||
DEBUG=yes
|
||||
;;
|
||||
nosplash)
|
||||
SPLASH=no
|
||||
;;
|
||||
bootchart)
|
||||
BOOTCHART=yes
|
||||
;;
|
||||
ssh)
|
||||
SSH=yes
|
||||
;;
|
||||
progress)
|
||||
PROGRESS=yes
|
||||
;;
|
||||
fastboot)
|
||||
FASTBOOT=yes
|
||||
;;
|
||||
netboot)
|
||||
NETBOOT=yes
|
||||
;;
|
||||
nbdroot=*)
|
||||
nbdroot="${arg#nbdroot=}"
|
||||
NBD_ROOT_SERVER=$( echo "${nbdroot}" | /bin/busybox sed 's/:.*//')
|
||||
NBD_ROOT_PORT=$( echo "${nbdroot}" | /bin/busybox sed 's/.*://')
|
||||
;;
|
||||
nbdserver=*)
|
||||
NBD_ROOT_SERVER="${arg#nbdserver=}"
|
||||
;;
|
||||
nbdport=*)
|
||||
NBD_ROOT_PORT="${arg#nbdport=}"
|
||||
;;
|
||||
nfsoverlay=*)
|
||||
NFS_OVERLAY="${arg#nfsoverlay=}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test "$FASTBOOT" = "yes"; then
|
||||
IONICE="/bin/busybox ionice -c 1 -n 0"
|
||||
fi
|
||||
|
||||
progress() {
|
||||
if test "$PROGRESS" = "yes"; then
|
||||
echo "### $1 ###"
|
||||
fi
|
||||
}
|
||||
|
||||
show_splash() {
|
||||
if [ ! -e /dev/fb0 ]; then
|
||||
SPLASH=no
|
||||
fi
|
||||
|
||||
if [ -f /flash/oemsplash.ppm ]; then
|
||||
SPLASHIMAGE="/flash/oemsplash.ppm"
|
||||
elif [ -f /lib/splash/splash.ppm ]; then
|
||||
SPLASHIMAGE="/lib/splash/splash.ppm"
|
||||
else
|
||||
SPLASH=no
|
||||
fi
|
||||
|
||||
if [ "$SPLASH" = "no" ]; then
|
||||
break
|
||||
else
|
||||
/bin/busybox fbsplash -c -s "$SPLASHIMAGE" -d /dev/fb0
|
||||
fi
|
||||
}
|
||||
|
||||
error() {
|
||||
echo "Error Code: $1 that means: $2"
|
||||
}
|
||||
|
||||
debug_shell() {
|
||||
echo "### Starting debugging shell... type exit to quit ###"
|
||||
/bin/busybox sh </dev/tty1 >/dev/tty1 2>&1
|
||||
}
|
||||
|
||||
mount_part() {
|
||||
# progress "check filesystem $1 ..."
|
||||
# /sbin/fsck -M -T -a $1 > /dev/null 2>&1
|
||||
|
||||
for i in 1 2 3 4 5 6 7 8 9 10; do
|
||||
ERR_ENV=1
|
||||
MOUNT_OPTIONS="-o $3 $1 $2"
|
||||
|
||||
if [ -n "$4" ]; then
|
||||
MOUNT_OPTIONS="-t $4 $MOUNT_OPTIONS"
|
||||
fi
|
||||
|
||||
progress "mount filesystem $1 ..."
|
||||
$IONICE /bin/busybox mkdir -p $2
|
||||
$IONICE /bin/busybox mount $MOUNT_OPTIONS > /dev/null 2>&1
|
||||
[ "$?" -eq "0" ] && ERR_ENV=0 && break
|
||||
|
||||
/bin/busybox usleep 1000000
|
||||
done
|
||||
[ "$ERR_ENV" -ne "0" ] && error "INIT_4" "Could not mount $1" && debug_shell
|
||||
}
|
||||
|
||||
update() {
|
||||
if [ -f "$UPDATE_DIR/$2" ]; then
|
||||
echo "updating $1..."
|
||||
$IONICE /bin/busybox mount -o remount,rw /flash
|
||||
$IONICE /bin/busybox mv $UPDATE_DIR/$2 $3
|
||||
$IONICE /bin/busybox mount -o remount,ro /flash
|
||||
$IONICE /bin/busybox sync
|
||||
[ "$2" = "$IMAGE_KERNEL" ] && REBOOT="1"
|
||||
fi
|
||||
}
|
||||
|
||||
hfsdiskprep() {
|
||||
for DEVICE in /dev/sd*; do
|
||||
for device in $(/bin/busybox blkid $DEVICE); do
|
||||
case $device in
|
||||
TYPE=*)
|
||||
FS_TYPE=${device#TYPE=}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$FS_TYPE" = "\"hfs\"" -o "$FS_TYPE" = "\"hfsplus\"" ]; then
|
||||
progress "check filesystem $DEVICE [$FS_TYPE]..."
|
||||
/bin/fsck_hfs -r -y $DEVICE > /dev/null 2>&1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
mount_nbd() {
|
||||
retry_nr=0
|
||||
retry_delay=20
|
||||
OVERLAY_DIR=`cat /sys/class/net/eth0/address | /bin/busybox tr -d :`
|
||||
|
||||
while [ ${retry_nr} -lt ${retry_delay} ] && [ ! -f /usr/etc/distribution ]; do
|
||||
[ ${retry_nr} -gt 0 ] && \
|
||||
$IONICE /bin/busybox nbd-client $NBD_ROOT_SERVER $NBD_ROOT_PORT /dev/nbd0 && \
|
||||
mount_part "/dev/nbd0" "/usr" "ro" "squashfs"
|
||||
|
||||
retry_nr=$(( ${retry_nr} + 1 ))
|
||||
|
||||
[ ! -f /usr/etc/distribution ] && /bin/busybox usleep 1000000
|
||||
|
||||
[ ${retry_nr} -gt 0 ]
|
||||
done
|
||||
|
||||
if [ ! -f /usr/etc/distribution ]; then
|
||||
error "INIT_2" "Could not mount NBD root from $NBD_ROOT_SERVER port $NBD_ROOT_PORT"
|
||||
debug_shell
|
||||
fi
|
||||
|
||||
mount_part "$NFS_OVERLAY" "/storage" "rw,nolock,retrans=10" "nfs"
|
||||
|
||||
if [ ! -d /storage/$OVERLAY_DIR ]; then
|
||||
mkdir /storage/$OVERLAY_DIR
|
||||
fi
|
||||
|
||||
/bin/busybox umount /storage
|
||||
mount_part "$NFS_OVERLAY/$OVERLAY_DIR" "/storage" "rw,nolock" "nfs"
|
||||
}
|
||||
|
||||
mount_disk() {
|
||||
|
||||
# deal with hfs partitions
|
||||
if [ -x /sbin/fsck_hfs ]; then
|
||||
hfsdiskprep
|
||||
fi
|
||||
|
||||
mount_part "$boot" "/flash" "ro,noatime"
|
||||
show_splash
|
||||
|
||||
if [ -n "$disk" ]; then
|
||||
mount_part "$disk" "/storage" "rw,noatime"
|
||||
|
||||
if [ -f "/flash/MACH_KERNEL" ]; then
|
||||
IMAGE_KERNEL="MACH_KERNEL"
|
||||
fi
|
||||
|
||||
update "Kernel" "$IMAGE_KERNEL" "/flash/$IMAGE_KERNEL"
|
||||
update "System" "$IMAGE_SYSTEM" "/flash/$IMAGE_SYSTEM"
|
||||
|
||||
if test "$REBOOT" -eq "1"; then
|
||||
echo "System reboots now..." && \
|
||||
/bin/busybox reboot
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f "/flash/$IMAGE_SYSTEM" ]; then
|
||||
mount_part "/flash/$IMAGE_SYSTEM" "/usr" "ro,loop"
|
||||
[ "$ERR_ENV" -ne "0" ] && debug_shell
|
||||
else
|
||||
error "INIT_2" "Could not find system."
|
||||
debug_shell
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -z "$NETBOOT" ]; then
|
||||
mount_disk
|
||||
else
|
||||
mount_nbd
|
||||
fi
|
||||
|
||||
# mount-bind
|
||||
mount_part "/usr/etc" "/etc" "bind"
|
||||
# mount_part "/usr/lib/firmware" "/lib/firmware" "bind"
|
||||
# mount_part "/usr/lib/modules" "/lib/modules" "bind"
|
||||
ln -sf /usr/lib/firmware /lib/firmware
|
||||
ln -sf /usr/lib/modules /lib/modules
|
||||
|
||||
# showing version
|
||||
lsb_release
|
||||
@ -54,3 +281,6 @@ fi
|
||||
test $S_RET -ge $RET && RET=$S_RET
|
||||
fi
|
||||
done
|
||||
|
||||
error "INIT_3" "Error in initramfs. Could not start system"
|
||||
debug_shell
|
||||
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 71 KiB |
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 93 KiB |
@ -30,7 +30,7 @@ $SCRIPTS/build squashfs
|
||||
$SCRIPTS/build fakeroot
|
||||
$SCRIPTS/build module-init-tools
|
||||
|
||||
export INSTALL=$BUILD/image/system
|
||||
#export INSTALL=$BUILD/image/system
|
||||
|
||||
BUILD_DATE=`date +%Y%m%d%H%M%S`
|
||||
|
||||
@ -47,59 +47,38 @@ IMAGE_NAME="$DISTRONAME-$TARGET_VERSION"
|
||||
rm -rf $FAKEROOT_SCRIPT # remove $FAKEROOT_SCRIPT if it exist
|
||||
touch $FAKEROOT_SCRIPT # create an empty $FAKEROOT_SCRIPT
|
||||
chmod +x $FAKEROOT_SCRIPT # make $FAKEROOT_SCRIPT executable
|
||||
echo "chown -R 0:0 $INSTALL" >> $FAKEROOT_SCRIPT
|
||||
echo "chown -R 0:0 $INSTALL_SYSTEM" >> $FAKEROOT_SCRIPT
|
||||
|
||||
# clean old install dirs
|
||||
rm -rf $INSTALL
|
||||
rm -rf $INSTALL_SYSTEM
|
||||
rm -rf $STAMPS_INSTALL
|
||||
mkdir -p $INSTALL
|
||||
mkdir -p $INSTALL_SYSTEM
|
||||
ln -sf /var $INSTALL_SYSTEM/var
|
||||
|
||||
# create baselayout
|
||||
mkdir -p $INSTALL/bin
|
||||
mkdir -p $INSTALL/etc
|
||||
mkdir -p $INSTALL/lib
|
||||
mkdir -p $INSTALL/sbin
|
||||
mkdir -p $INSTALL/dev
|
||||
mkdir -p $INSTALL/proc
|
||||
# mkdir -p $INSTALL/run
|
||||
ln -sf /var/run $INSTALL/run
|
||||
mkdir -p $INSTALL/sys
|
||||
mkdir -p $INSTALL/usr
|
||||
mkdir -p $INSTALL/var
|
||||
mkdir -p $INSTALL/flash
|
||||
mkdir -p $INSTALL/storage
|
||||
ln -sf /var $INSTALL/usr/var
|
||||
ln -sf /var/tmp $INSTALL/tmp
|
||||
ln -sf /var/media $INSTALL/media
|
||||
mkdir -p $INSTALL_SYSTEM/etc
|
||||
echo "$DISTRONAME" > $INSTALL_SYSTEM/etc/distribution
|
||||
echo "$PROJECT.$TARGET_ARCH" > $INSTALL_SYSTEM/etc/arch
|
||||
echo "$OPENELEC_VERSION" > $INSTALL_SYSTEM/etc/version
|
||||
echo "$TARGET_VERSION" > $INSTALL_SYSTEM/etc/release
|
||||
echo "$DISTRONAME - Version: $OPENELEC_VERSION" > $INSTALL_SYSTEM/etc/openelec-release
|
||||
if [ -n "$GIT_HASH" ]; then
|
||||
echo "$GIT_HASH" >> $INSTALL_SYSTEM/etc/gitrev
|
||||
fi
|
||||
|
||||
if [ "$TARGET_ARCH" = "x86_64" -o "$TARGET_ARCH" = "powerpc64" ]; then
|
||||
ln -s /lib $INSTALL/lib64
|
||||
ln -s lib $INSTALL/usr/lib64
|
||||
fi
|
||||
|
||||
echo "$DISTRONAME" > $INSTALL/etc/distribution
|
||||
echo "$PROJECT.$TARGET_ARCH" > $INSTALL/etc/arch
|
||||
echo "$OPENELEC_VERSION" > $INSTALL/etc/version
|
||||
echo "$TARGET_VERSION" > $INSTALL/etc/release
|
||||
echo "$DISTRONAME - Version: $OPENELEC_VERSION" > $INSTALL/etc/openelec-release
|
||||
if [ -n "$GIT_HASH" ]; then
|
||||
echo "$GIT_HASH" >> $INSTALL/etc/gitrev
|
||||
fi
|
||||
|
||||
# create /etc/issue
|
||||
echo $GREETING0 > $INSTALL/etc/issue
|
||||
echo $GREETING1 >> $INSTALL/etc/issue
|
||||
echo $GREETING2 >> $INSTALL/etc/issue
|
||||
echo $GREETING3 >> $INSTALL/etc/issue
|
||||
echo $GREETING4 >> $INSTALL/etc/issue
|
||||
echo "$DISTRONAME Version: $OPENELEC_VERSION" >> $INSTALL/etc/issue
|
||||
if [ -n "$GIT_HASH" ]; then
|
||||
echo "$DISTRONAME git: $GIT_HASH" >> $INSTALL/etc/issue
|
||||
fi
|
||||
# create /etc/issue
|
||||
echo $GREETING0 > $INSTALL_SYSTEM/etc/issue
|
||||
echo $GREETING1 >> $INSTALL_SYSTEM/etc/issue
|
||||
echo $GREETING2 >> $INSTALL_SYSTEM/etc/issue
|
||||
echo $GREETING3 >> $INSTALL_SYSTEM/etc/issue
|
||||
echo $GREETING4 >> $INSTALL_SYSTEM/etc/issue
|
||||
echo "$DISTRONAME Version: $OPENELEC_VERSION" >> $INSTALL_SYSTEM/etc/issue
|
||||
if [ -n "$GIT_HASH" ]; then
|
||||
echo "$DISTRONAME git: $GIT_HASH" >> $INSTALL_SYSTEM/etc/issue
|
||||
fi
|
||||
|
||||
# copy project related files to filesystem
|
||||
if [ -d "$PROJECT_DIR/$PROJECT/filesystem" ]; then
|
||||
cp -PR $PROJECT_DIR/$PROJECT/filesystem/* $INSTALL
|
||||
cp -PR $PROJECT_DIR/$PROJECT/filesystem/* $INSTALL_SYSTEM
|
||||
fi
|
||||
|
||||
# Basissystem...
|
||||
@ -152,10 +131,10 @@ IMAGE_NAME="$DISTRONAME-$TARGET_VERSION"
|
||||
|
||||
# run depmod
|
||||
KVER=`ls $BUILD/linux-*/modules/lib/modules`
|
||||
$ROOT/$TOOLCHAIN/bin/depmod -b $INSTALL $KVER > /dev/null
|
||||
$ROOT/$TOOLCHAIN/bin/depmod -b $INSTALL_SYSTEM $KVER > /dev/null
|
||||
|
||||
# strip kernel modules
|
||||
for MOD in `find $INSTALL/lib/modules/ -name *.ko`; do
|
||||
for MOD in `find $INSTALL_SYSTEM/lib/modules/ -name *.ko`; do
|
||||
$STRIP --strip-debug $MOD
|
||||
done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user