TQMa6ULx - PTXdist Linux BSP documentation
How-To
Copy Firmware from SD card to eMMC using U-Boot on TQMa6UL
The size of eMMC/SD image exceeds TQMa6ULx RAM size so it is not possible to copy the image into the RAM.
Nevertheless copying is possible by splitting Rootfs into several parts during the process.
- Set Starterkit to boot from SD, please see DIP Switch Settings
- Interrupt the boot process to get to the U-Boot prompt
- The U-Boot environment has to be expanded to copy the content from the SD Card to the eMMC therefore create the following u-boot env variables has to be created.
- Create U-boot env variable install_firmware
setenv install_firmware 'echo MBR... && mmc dev 1 && mmc read $loadaddr 0 1 && mmc dev 0 && mmc write $loadaddr 0 1 && echo U-Boot... && mmc dev 1 && mmc read $loadaddr 2 7fe && mmc dev 0 && mmc write $loadaddr 2 7fe && echo U-Boot environment... && mmc dev 1 && mmc read $loadaddr 800 800 && mmc dev 0 && mmc write $loadaddr 800 800 && echo Firmware Partition... && mmc dev 1 && mmc read $loadaddr 2000 A000 && mmc dev 0 && mmc write $loadaddr 2000 A000 && echo Root FS... && run root_loop'
- Create U-boot env variable root_loop
setenv root_loop 'setenv start 0xC000 && setenv r1 $rootblks16 && while itest $r1 -gt 0; do if itest $r1 -gt 0x2D000; then setenv count 2D000; else setenv count $r1; fi && mmc dev 1 && mmc read $loadaddr $start $count && mmc dev 0 && mmc write $loadaddr $start $count && setexpr start $start + $count && setexpr r1 $r1 - $count; done; setenv r1; setenv start; setenv count'
- create rootblks16 and set a value
setenv rootblks16 0x80000
- save changes
saveenv
- Use the new commands to copy the SD-Card image to eMMC
run install_firmware
Load / Change / Save the Device Tree under U-Boot
Devicetree can be edit with the fdt commands under U-Boot.
Therefore you can have a look at the following tutorial.
1) At first the fdt file has to be loaded from the current boot medium (mmc) into RAM.
=> run loadfdt
2) Next step is to set the predefined U-Boot environment variable fdt_addr through the fdt addr command.
=> fdt addr $fdt_addr
3) Afterwards the size of the fdt has to be increased (to the next 4K divider) in order to have some space for modifications. This is simply done by entering:
=> fdt resize
4) List device in the tree you want to change to have a look at the default settings.
5) To modify a value of a propertie use the fdt set command.
=> fdt set <path> <property> <value>
6) Optional: If you want to save your modified Devicetree back to mmc you'll have to run the following command:
=> fatwrite mmc $mmcdev:$firmwarepart $fdt_addr $fdt_file <totalsize>
You can find out <totalsize> of the modified fdt by entering the command fdt header
Otherwise you can boot your module with the changed Devicetree right after the modification.
TQ-Systems GmbH provides the Board Support Packages (BSP) free of charge. The software included in the shipment has been configured individually for the starter kits. The software is only intended to evaluate the module. The use of the Board Support Packages (BSP) is only allowed within the scope of functionality described by TQ-Systems GmbH. TQ-Systems GmbH does not accept any liability for all further changes of the Board Support Package and for any damage resulting from its use.