Filesystem from flash script: Difference between revisions
(Created page with "<source lang="bash"> #!/bin/sh #We only need unmount /mnt/root and use USB if booted from NAND/eMMC if [ "$bootmode" == "0x1" ]; then killall mdnsd >/dev/null #Required to ...") |
No edit summary |
||
Line 1: | Line 1: | ||
While there is no issue in executing filesystem_from_usb when booted from SD (provided there are no flash partitions mounted), further preparation is required in order to successfully boot from eMMC/NAND, and use the USB update functionality to update the flash. A USB device is required to have the the Debian distribution on the first partition, as well as a specific set of steps contained in the tsinit file to ensure the flash partitions are safely unmounted, and all of the tools are available. | |||
Using a linux host PC, format a USB drive with the first partition (min. 2GB) formatted ext2/3. Download the [ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7670-linux/distributions/ts7670_7400v2-debian-wheezy-arm-latest.tar.bz2 distribution tarball] and extract it to first partition of the USB drive. | |||
Next, create the file "tsinit" in the root directory of the first partition of the USB drive, make it world executable with `chmod a+x` and make sure it has the contents of the following script: | |||
<source lang="bash"> | <source lang="bash"> | ||
#!/bin/sh | #!/bin/sh |
Revision as of 14:59, 24 December 2014
While there is no issue in executing filesystem_from_usb when booted from SD (provided there are no flash partitions mounted), further preparation is required in order to successfully boot from eMMC/NAND, and use the USB update functionality to update the flash. A USB device is required to have the the Debian distribution on the first partition, as well as a specific set of steps contained in the tsinit file to ensure the flash partitions are safely unmounted, and all of the tools are available.
Using a linux host PC, format a USB drive with the first partition (min. 2GB) formatted ext2/3. Download the distribution tarball and extract it to first partition of the USB drive.
Next, create the file "tsinit" in the root directory of the first partition of the USB drive, make it world executable with `chmod a+x` and make sure it has the contents of the following script:
#!/bin/sh
#We only need unmount /mnt/root and use USB if booted from NAND/eMMC
if [ "$bootmode" == "0x1" ]; then
killall mdnsd >/dev/null #Required to cleanly umount /etc
sleep 1
if [ -e /dev/mtd0 ]; then
umount /mnt/root/ts
fi
umount /etc
umount /mnt/root
mount -obind /mnt/usbdev /mnt/root
mount -obind /mnt/root/etc /etc/
fi
echo ""
source /ts.subr
tshwctl --greenledon --redledon
echo "Flashing kernel"
kernel_from_usb >/dev/null 2>&1
if [ "$?" != "0" ]; then
echo "Failed flashing kernel"
tshwctl --greenledoff
while true; do tshwctl --redledon; sleep .5; tshwctl --redledoff; sleep .5 ; done &
return 1
fi
echo "Flashing filesystem"
eval `filesystem_from_usb`
if [ "$prog_ok" != "1" ] ; then
echo "Failed flashing filesystem"
tshwctl --greenledoff
while true; do tshwctl --redledon; sleep .5; tshwctl --redledoff; sleep .5 ; done &
return 1
fi
#We only need unmount /mnt/root and use USB if booted from NAND
if [ "$bootmode" == "0x1" ]; then
umount /etc
umount /mnt/root
fi
echo "Done"
while true; do tshwctl --greenledon; sleep .5; tshwctl --greenledoff; sleep .5 ; done &