
TBOXINDS1
–
User Guide, Rev. 0.4
26 |
P a g e
User Guide
whole SD card and transparently store all data between device reboots. This
approach requires careful operation in conditions of unstable power source, as the
system partition can be corrupted during power loss. It is the default organization of
TrustBox firmware.
-
system is located on the internal QSPI flash on UBIFS partition. As QSPI flash is much
smaller than SD card, it requires for a stripped Linux build. For this purpose, Yocto-
based BSP can be used. It is available at
https://github.com/Scalys/bsp-yocto
. Use
of UBIFS to store system allows to have a persistent system state. This approach is
also vulnerable to sudden power loss.
-
system is stored either on SD card or on QSPI in a form of itb-image. It can be then
loaded and used from RAM. Further operation is power safe but saving state between
reboots should be implemented manually, depending on the intended use case.
Boot customization
Listed boot approaches require customization of the boot procedure. It can be done in two
ways: boot script and u-boot environment customization.
Boot script
During default boot procedure U-Boot initially looks for a file named
trustbox_boot.scr
or
trustbox_recovery.scr
on the first partition of SD card or USB drive. This file should contain a
list of commands needed to implement a custom boot. It can include a probe of internal flash
memory, loading of the Linux kernel or itb-image into RAM, customization of kernel
command line arguments and other boot parameters.
Example of boot script that loads kernel from server over TFTP and uses system root
partition from an SD card:
setenv ipaddr 192.168.1.211
setenv serverip 192.168.1.101
tftpboot $kernel_addr_r uImage
tftpboot $fdt_addr_r trustbox.dtb
mtdparts
s
etenv bootargs “console=ttyS0,115200 earlycon=uart8250,mmio,0x21c0500 lpj=250000
noinitrd root=/dev/mmcblk0p1 rootfstype=ext4 rw rootwait $mtdparts”
pfe stop
bootm $kernel_addr_r - $fdt_addr_r
To compile these instructions into a boot script store them in a script file named
trustbox_boot.cmd
and then use
mkimage
utility:
$
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -
n “Boot script”
-d
trustbox_boot.cmd trustbox_boot.scr
If the produced script is put in
/
or
/boot
of first
ext4
-formatted partition of the SD card it will
be used automatically instead of default boot procedure.