Last active
May 18, 2017 14:29
-
-
Save jonatw/50c48dee3e3ec8ec67c0 to your computer and use it in GitHub Desktop.
LinkIt7688 use sdcard as rootfs after factory reset ref: http://labs.mediatek.com/forums/posts/list/3619.page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ash | |
# ref http://labs.mediatek.com/forums/posts/list/3619.page | |
opkg update | |
opkg install block-mount kmod-fs-ext4 kmod-usb-storage-extras e2fsprogs | |
umount /tmp/run/mountd/mmcblk0p1 | |
mkfs.ext4 -F /dev/mmcblk0p1 | |
mount /dev/mmcblk0p1 /mnt | |
tar -C /overlay -cvf - . | tar -C /mnt -xf - | |
umount /dev/mmcblk0p1 | |
block detect > /etc/config/fstab | |
sed -i 's|/mnt/mmcblk0p1|/overlay|g' /etc/config/fstab | |
head -n -2 /etc/config/fstab > /etc/config/fstab.head | |
tail -n -2 /etc/config/fstab > /etc/config/fstab.tail | |
sed -i 's|0|1|g' /etc/config/fstab.tail | |
cat /etc/config/fstab.head > /etc/config/fstab | |
cat /etc/config/fstab.tail >> /etc/config/fstab | |
rm /etc/config/fstab.head /etc/config/fstab.tail |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment