TBS2910 boot Ubuntu from SD

Run Ubuntu from sd-card or USB: This needs to be setup in the u-boot. We can do this in a rather simple way so that finally with only the edit of the variable bootcmd is needed to change what we boot from. This means that in case things won't work we can simply go back to the original state. As far as I can see now, you only can boot from (e)MMC device but you can have your rootfs on a USB-stick and maybe on SATA.

Put the SD-card and/or USB stick into the Matrix.
Connect the PC and the Matrix via the serial port as described. Start a Putty Session, choose Serial, COM1 or COM2 and speed 115200. You will get a terminal window.

Power on the matrix, you will see the boot messages in the terminal. When it stops sending messages type login.
Now you can login with "linaro" and "linaro" Type sudo fdisk -l to see what device your SD-card is, the internal card has 2 unformatted bootpartitions in my case mmcblk0boot0 and mmcblk0boot1 media. Remember the devicename.

preparing media

You can type fdisk -l to see the disks. In my case mmcblk0 = the internal SD and mmcblk1 the external SD Now type dd if=/dev/mmcblk0 of=/dev/mmcblk1 to clone the internal sd to the external SD you also can dd if=/dev/mmcblk0 of=/dev/sda to clone to USB-stick. This can take a long time but you now should have bootable media.

We only use a few u-boot commands:

- printenv shows all environmentvariables or printenv bootcmd
- setenv sets the variable setenv varname arguments
- saveenv saves the variables to flash

Now we make the changes in u-boot:

Type sudo reboot. The matrix reboots and you hit a key when it says "hit any key to stop autoboot". Now you are in the u-boot prompt, in my case "MX6Q SABRESD U-Boot >" When you type printenv you get a list of the environment variables.

You will see a variable bootargs_mmc in which root is set to mmcblk0, also there is a variable bootcmd_mmc in which you see mmc dev 3 This refers to the boot from the internal MMC (multimediacard)

Now we setup some new variables for our needs, these are
- bootargs_test
- bootcmd_test
- bootdevice
- rootfs
This is what you need to type:

setenv bootargs_test setenv 'bootargs ${bootargs} ${rootfs} rootwait video=mxcfb1:dev=ldb,LDB-XGA,if=RGB666 video=mxcfb0:dev=hdmi,1920x1080M@60 video=mxcfb1:off video=mxcfb2:off fbmem=28M consoleblank=0 quiet'

(the quotes are needed otherwise you get a too many arguments error)

setenv bootcmd_test run 'bootargs_base bootargs_test; ${bootdevice}; mmc read ${loadaddr} 0x800 0x4000; bootm'


Check: type printenv bootargs_test and printenv bootargs_mmc to compare, (should be equal except for root=...)
you can type printenv bootcmd_test and printenv bootcmd_mmc to check this too

Set the other two variables:
type setenv bootdevice mmc dev 2
type setenv rootfs root=/dev/mmcblk1p1
type saveenv to safe all

now type: run bootcmd_test

The device now boots from SD. Type login linaro linaro sudo mount. you can see that mmcblk0 is mounted to media,

if all works we can change bootcmd to run bootcmd_test.
reboot the device and get into the u-boot prompt again

type setenv bootcmd run bootcmd_test
Now we save this, type saveenv type run bootcmd to boot. Now it allways boots from SD.
When you want to go back to the original state you just edit bootcmd again. type setenv bootcmd run bootcmd_mmc Boot from emmc with rootfs on USB-stick? type setenv bootdevice mmc dev 3
type setenv rootfs root=/dev/sda1