This tutorial describes a way to boot an Edison board with the Root Filesystem on an external storage (SD card). The kernel and bootloader remain on the local eMMC. For now, we are not able to boot a kernel from an external storage.
SD Card Format
You need to have a SD card formatted with ext4 file system to store your root file system (do not use FAT/FAT32 for that). You can use gparted or Intel Edison as follows:
root@edison:~#dmesg[420794.481542] mmc1: new high speed SDHC card at address 1234[420794.482480] mmcblk1: mmc1:1234 SA16G 14.4 GiB[420794.484152] mmcblk1: p1
root@edison:~#mkfs.ext4/dev/mmcblk1p1mke2fs1.42.9 (28-Dec-2013) Discardingdeviceblocks:doneFilesystemlabel=OStype:LinuxBlocksize=4096 (log=2) Fragmentsize=4096 (log=2) Stride=0blocks,Stripewidth=0blocks950272inodes,3794944blocks189747blocks (5.00%) reserved for the super user Firstdatablock=0Maximumfilesystemblocks=3888119808116blockgroups32768blockspergroup,32768fragmentspergroup8192inodespergroupSuperblockbackupsstoredonblocks:32768,98304,163840,229376,294912,819200,884736,1605632,2654208Allocatinggrouptables:doneWritinginodetables:doneCreatingjournal (32768 blocks): doneWritingsuperblocksandfilesystemaccountinginformation:doneroot@edison:~#
Edison Ext 4 Image Writing
Download and unpack the Edison OS image from the Software Downloads section of the community.
user@linux:~/Downloads/unpacked-image$sudomount./edison-image-edison.ext4Rootfs[sudo] password for user:
user@linux:~/Downloads/unpacked-image$ sudo cp -a Rootfs/* /media/8f88dd49-95ac-4d0c-8c3a-abd445f87fa1/ (or whatever folder name your pc gave to your SD card)
user@linux:~/Downloads/unpacked-image$sync
Your SD card is now ready to boot. Find out the SD card device name
On a running Edison board, plug your formatted SD card and get the device name:
root@edison:~#dmesg|tail-n10[ 6.387683] g_multi gadget: high-speed config #2: Multifunction with CDC ECM[ 6.522733] EXT4-fs (mmcblk0p5): mounted filesystem without journal. Opts: discard,barrier=1,data=ordered,noauto_da_ac
[ 7.375959] systemd-fstab-generator[174]: Checking was requested for"rootfs", but it is not a device.[ 10.098201] systemd-fstab-generator[223]: Checking was requested for"rootfs", but it is not a device.[ 20.372477] EXT4-fs (mmcblk0p10): mounted filesystem with ordered data mode. Opts: discard,barrier=1,data=ordered,noac
[ 767.952993] mmc1: new high speed SDHC card at address 0007[ 767.953999] mmcblk1: mmc1:0007 SD16G 14.4 GiB [ 767.956822] mmcblk1: p1[ 768.275336] EXT4-fs (mmcblk1p1): mounted filesystem with ordered data mode. Opts: (null)
Here, the SD card device is “/dev/mmcblk1” and the partition we’ve created is "/dev/mmcblk1p1". To boot using the external device, you need to modify the U-Boot environment variable named "mmc-bootargs" with kernel boot arguments. In the simplest case you can just change the "root=..." part, but here’s a more elaborated approach, which will help you to switch between booting from eMMC and the SD card more easily. In the Edison Linux console set the U-Boot environment variables like the below:
# the below is a single line, make sure you write down the bootargs somewhere else to later being able to boot from our flash device
root@edison:~#fw_printenv|grepmmc-bootargs=mmc-bootargs=setenv bootargs root=PARTUUID=${uuid_rootfs} rootfstype=ext4 ${bootargs_console} ${bootargs_debug} systemd.unit=${bootargs_target}.target hardware_id=${hardware_id} g_multi.iSerialNumber=${serial#} g_multi.dev_addr=${usb0addr}
# the below is a single command lineroot@edison:~# fw_setenv mmc-bootargs 'setenv bootargs root=${myrootfs} rootdelay=3 rootfstype=ext4 ${bootargs_console} ${bootargs_debug} systemd.unit=${bootargs_target}.target hardware_id=${hardware_id} g_multi.iSerialNumber=${serial#} g_multi.dev_addr=${usb0addr}'
# get the UUID for the eMMC rootfs partitionroot@edison:~#fw_printenvuuid_rootfs
# use the UUID obtained aboveroot@edison:~#fw_setenvmyrootfs_emmc'PARTUUID=012b3303-34ac-284d-99b4-34e03a2335f4'
# this will set the default, use the value we’ve used for myrootfs_emmc# if you want to boot from eMMC by defaultroot@edison:~#fw_setenvmyrootfs'/dev/mmcblk1p1'
root@edison:~#fw_setenvdo_boot_emmc'setenv myrootfs ${myrootfs_emmc}; run do_boot'
root@edison:~#fw_setenvdo_boot_sdcard'setenv myrootfs ${myrootfs_sdcard}; run do_boot'
Reboot Edison
After boot, verify that you are using rootfs stored on your external device: The root file system is now 14.1 GB (this will depend on your SD card size). The SD card will still be automounted to /media/sdcard by Edison’s automount daemon. Since it is the rootfs anyway, this m006F untpoint becomes useless, so disable the systemd service: Now, you have plenty of room to work on Edison and no unnecessary mounts: