From 0cad06d6e5acb36408832608426408ec723fc12f Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Tue, 5 Apr 2011 14:51:08 +0200 Subject: [PATCH 1/3] take mpfr from the gnu.org mirror since the current url no longer works --- packages/toolchain/math/mpfr/meta | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/toolchain/math/mpfr/meta b/packages/toolchain/math/mpfr/meta index f1be4ee08b..4e37333db3 100644 --- a/packages/toolchain/math/mpfr/meta +++ b/packages/toolchain/math/mpfr/meta @@ -24,7 +24,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="LGPL" PKG_SITE="http://www.mpfr.org/" -PKG_URL="http://www.mpfr.org/mpfr-current/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_URL="http://ftp.gnu.org/gnu/mpfr/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" PKG_BUILD_DEPENDS="ccache gmp" PKG_PRIORITY="optional" From 1e42a73c7cdab8fa245205400655870a4506a7b4 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Tue, 5 Apr 2011 01:21:26 +0200 Subject: [PATCH 2/3] implement booting from an nbd root with an nfs overlay. adds 5 new kernel cmdline options: * netboot set this option on cmdline to boot from an nbd root device on the network. * nbdroot=host:portnumber short for nbdserver=host nbdport=portnumber * nbdserver=host the hostname or ip address to mount the root device from. if nbdroot and nbdserver aren't set, 192.168.1.1 will be used. * nbdport=portnumber the port number to mount the root device from. if nbdroot and nbdport aren't set, port number 2000 will be used. * nfsoverlay=host:/path/to/overlay the path to mount the writable overlay directory from. if not set, 192.168.1.1:/var/lib/overlay will be used. --- .../sysutils/busybox-initramfs/scripts/init | 123 ++++++++++++++---- 1 file changed, 96 insertions(+), 27 deletions(-) diff --git a/packages/sysutils/busybox-initramfs/scripts/init b/packages/sysutils/busybox-initramfs/scripts/init index 8953a4eef4..3d31325b3d 100755 --- a/packages/sysutils/busybox-initramfs/scripts/init +++ b/packages/sysutils/busybox-initramfs/scripts/init @@ -27,9 +27,15 @@ 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 @@ -49,6 +55,23 @@ REBOOT="0" 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 @@ -85,7 +108,12 @@ REBOOT="0" progress "trying to mount $1 ..." for i in 1 2 3 4 5 6 7 8 9 10; do ERR_ENV=1 - $IONICE /bin/busybox mount -o $3 $1 $2 > /dev/null 2>&1 + if [ -z "$4" ]; then + mount_opts="-o $3 $1 $2" + else + mount_opts="-t $4 -o $3 $1 $2" + fi + $IONICE /bin/busybox mount $mount_opts > /dev/null 2>&1 [ "$?" -eq "0" ] && ERR_ENV=0 && break /bin/busybox usleep 1000000 done @@ -103,39 +131,80 @@ REBOOT="0" fi } + 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/sleep 1 + + [ ${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() { + mount_part "$boot" "/flash" "ro,noatime" + + if [ -n "$disk" ]; then + mount_part "$disk" "/storage" "rw,noatime" + 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 + } + show_splash - mount_part "$boot" "/flash" "ro,noatime" - - if [ -n "$disk" ]; then - mount_part "$disk" "/storage" "rw,noatime" - 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 + if [ -z "$NETBOOT" ]; then + mount_disk else - error "INIT_2" "Could not find system." - debug_shell + mount_nbd 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 - -# unmount all other filesystems + # unmount all other filesystems /bin/busybox umount /dev /bin/busybox umount /proc + /bin/busybox umount /sys # switch to new sysroot and start real init exec /bin/busybox switch_root /sysroot /sbin/init From 326888b02830c502affc6a3ed3addf0a2343880a Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Tue, 5 Apr 2011 19:58:29 +0200 Subject: [PATCH 3/3] replace call to /bin/sleep with /bin/busybox usleep --- packages/sysutils/busybox-initramfs/scripts/init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sysutils/busybox-initramfs/scripts/init b/packages/sysutils/busybox-initramfs/scripts/init index 3d31325b3d..f385e1ce1d 100755 --- a/packages/sysutils/busybox-initramfs/scripts/init +++ b/packages/sysutils/busybox-initramfs/scripts/init @@ -143,7 +143,7 @@ NFS_OVERLAY="192.168.1.1:/var/lib/overlay" retry_nr=$(( ${retry_nr} + 1 )) - [ ! -e /sysroot/sbin/init ] && /bin/sleep 1 + [ ! -e /sysroot/sbin/init ] && /bin/busybox usleep 1000000 [ ${retry_nr} -gt 0 ] done