busybox-initramfs: init: cleanup (/flash is actual root filesystem?)

This commit is contained in:
Stefan Saraev 2013-05-25 19:01:31 +03:00 committed by Stephan Raue
parent 6bd144cfdc
commit daaef706f2

View File

@ -315,21 +315,18 @@
} }
update_bootloader() { update_bootloader() {
if [ -f "/flash/$IMAGE_SYSTEM" ]; then export BOOT_ROOT="/flash"
# /flash is filesystem with system image file export SYSTEM_ROOT="/sysroot"
export BOOT_ROOT="/flash"
export SYSTEM_ROOT="/sysroot"
mount_part "/flash/$IMAGE_SYSTEM" "/sysroot" "ro,loop" mount_part "/flash/$IMAGE_SYSTEM" "/sysroot" "ro,loop"
if [ -f $SYSTEM_ROOT/usr/share/bootloader/update.sh ]; then if [ -f $SYSTEM_ROOT/usr/share/bootloader/update.sh ]; then
echo "updating Bootloader..." echo "updating Bootloader..."
/bin/busybox sh $SYSTEM_ROOT/usr/share/bootloader/update.sh /bin/busybox sh $SYSTEM_ROOT/usr/share/bootloader/update.sh
/bin/busybox sync /bin/busybox sync
fi
umount /sysroot
fi fi
umount /sysroot
} }
load_modules() { load_modules() {
@ -408,24 +405,13 @@
fi fi
fi fi
if [ -f "/flash/$IMAGE_SYSTEM" ]; then mount_part "/flash/$IMAGE_SYSTEM" "/sysroot" "ro,loop"
# /flash is filesystem with system image file echo "Creating empty file, this can take a long time..."
# use dd and mkfs.ext4 from system /sysroot/bin/busybox dd if=/dev/zero of="$storage_loop_file" bs=1M count=$STORAGE_USE &>/dev/null
mount_part "/flash/$IMAGE_SYSTEM" "/sysroot" "ro,loop" echo "Formating to EXT4 filesystem, this can take a long time..."
echo "Creating empty file, this can take a long time..." LD_LIBRARY_PATH=/sysroot/usr/lib /sysroot/sbin/mkfs.ext4 -F -L StorageLive "$storage_loop_file" &>/dev/null
/sysroot/bin/busybox dd if=/dev/zero of="$storage_loop_file" bs=1M count=$STORAGE_USE &>/dev/null /bin/busybox sync
echo "Formating to EXT4 filesystem, this can take a long time..." umount /sysroot
LD_LIBRARY_PATH=/sysroot/usr/lib /sysroot/sbin/mkfs.ext4 -F -L StorageLive "$storage_loop_file" &>/dev/null
/bin/busybox sync
umount /sysroot
else
# /flash is actual root filesystem
echo "Creating empty file, this can take a long time..."
/flash/bin/busybox dd if=/dev/zero of="$storage_loop_file" bs=1M count=$STORAGE_USE &>/dev/null
echo "Formating to EXT4 filesystem, this can take a long time..."
LD_LIBRARY_PATH=/flash/usr/lib /flash/sbin/mkfs.ext4 -F -L StorageLive "$storage_loop_file" &>/dev/null
/bin/busybox sync
fi
echo "Done..." echo "Done..."
/bin/busybox usleep 2000000 /bin/busybox usleep 2000000
@ -538,21 +524,15 @@
prepare_sysroot() { prepare_sysroot() {
progress "Preparing system" progress "Preparing system"
if [ -f "/flash/$IMAGE_SYSTEM" ]; then if [ "$SYSTEM_TORAM" = "no" -o "$INSTALLED_MEMORY" -lt "$SYSTEM_TORAM_LIMIT" ]; then
# /flash is filesystem with system image file mount_part "/flash/$IMAGE_SYSTEM" "/sysroot" "ro,loop"
if [ "$SYSTEM_TORAM" = "no" -o "$INSTALLED_MEMORY" -lt "$SYSTEM_TORAM_LIMIT" ]; then
mount_part "/flash/$IMAGE_SYSTEM" "/sysroot" "ro,loop"
else
cp /flash/$IMAGE_SYSTEM /dev/$IMAGE_SYSTEM
mount_part "/dev/$IMAGE_SYSTEM" "/sysroot" "ro,loop"
fi
/bin/busybox mount --move /flash /sysroot/flash
else else
# /flash is actual root filesystem cp /flash/$IMAGE_SYSTEM /dev/$IMAGE_SYSTEM
/bin/busybox mount --move /flash /sysroot mount_part "/dev/$IMAGE_SYSTEM" "/sysroot" "ro,loop"
fi fi
/bin/busybox mount --move /flash /sysroot/flash
if [ -n "$disk" ]; then if [ -n "$disk" ]; then
/bin/busybox mount --move /storage /sysroot/storage /bin/busybox mount --move /storage /sysroot/storage
fi fi