aboutsummaryrefslogtreecommitdiffstats
path: root/usr/d710_initramfs_files/init
diff options
context:
space:
mode:
Diffstat (limited to 'usr/d710_initramfs_files/init')
-rwxr-xr-xusr/d710_initramfs_files/init31
1 files changed, 31 insertions, 0 deletions
diff --git a/usr/d710_initramfs_files/init b/usr/d710_initramfs_files/init
new file mode 100755
index 0000000..7035361
--- /dev/null
+++ b/usr/d710_initramfs_files/init
@@ -0,0 +1,31 @@
+#!/stage1/busybox sh
+export _PATH="$PATH"
+export PATH=/stage1
+BOOT_IMAGE=/dev/block/mmcblk0p5
+
+busybox cd /
+busybox date >>boot.txt
+exec >>boot.txt 2>&1
+busybox rm init
+busybox mount -t proc proc /proc
+busybox mount -t sysfs sysfs /sys
+
+eval $(read_boot_headers ${BOOT_IMAGE})
+
+load_offset=$boot_offset
+load_len=$boot_len
+
+if busybox grep -q bootmode=2 /proc/cmdline ; then
+ # recovery boot
+ load_offset=$recovery_offset
+ load_len=$recovery_len
+fi
+
+busybox dd bs=512 if=${BOOT_IMAGE} skip=$load_offset count=$load_len | busybox zcat | busybox cpio -i
+
+busybox umount /sys
+busybox umount /proc
+busybox date >>boot.txt
+busybox rm -fr /stage1 /dev/*
+export PATH="${_PATH}"
+exec /init