Nerveware


Boot commands

The following commands aren't solely usefull for U-Boot, but target the Linux kernel command line parameters.

Boot into single user mode

Single user mode is mostly used to reset forgotten passwords, but the command below might be usefull for debug purposes as well (omit init). U-Boot > setenv bootargs "${bootargs} reboot=cold,hard emergency init=/bin/sh"

For embedded devices, the root partition is frequently mounted read only.

$ mount -t proc none /proc $ mount -o remount,rw / $ passwd root Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully $ sync

NFS boot

NFS boot tested on Linux kernel 4,9 and 4.19, distribution Debian 7, 8 and 9. U-Boot > setenv loadaddr 0x10800000; U-Boot > setenv fdtaddr 0x18000000 U-Boot > setenv ethaddr 00:11:22:33:44:66; U-Boot > setenv serverip '192.168.138.1'; U-Boot > setenv ipaddr '192.168.138.2'; U-Boot > setenv netmask '255.255.255.0'; U-Boot > setenv iface 'eth0'; U-Boot > setenv nfspath '/srv/nfs/wheezy' U-Boot > tftpboot ${loadaddr} /uImage; U-Boot > tftpboot ${fdtaddr} /device-tree.dtb; U-Boot > setenv bootargs ${bootargs} rw rootwait nfsroot=${serverip}:${nfspath},v4,tcp \ ip=${ipaddr}:${serverip}:${serverip}:${netmask}::${iface} root=/dev/nfs; U-Boot > bootm ${loadaddr} - ${fdtaddr};

Ramdisk boot

U-Boot > setenv ramfsaddr '0x11000000' U-Boot > setenv initrd_high 0x7f700000 U-Boot > tftpboot ${ramfsaddr} /uRamdisk U-Boot > setenv bootargs console=${console},${baudrate} rdinit=/sbin/init root=/dev/ram rw \ vmalloc=192M video=mxcfb0:dev=ldb,1280x800M@60,if=RGB24,bpp=32 U-Boot > bootm ${loadaddr} ${ramfsaddr} ${fdtaddr};

FIT image boot

Read this. U-Boot > setenv initrd_high 0xffffffff U-Boot > setenv loadaddr 0x14000000 U-Boot > tftpboot ${loadaddr} /flattened-image-tree.itb U-Boot > bootm ${loadaddr} U-Boot > bootm ${loadaddr}#boot_entry

Flash commands

Flash non-volatile storage peripherals.

Flash SPI NOR

Write a U-Boot binrary to SPI nor on a i.MX6 processor. Detailed description here: Flash U-Boot on target.

U-Boot > setenv ipaddr 192.168.138.1; setenv serverip 192.168.138.2; setenv ethaddr 00:11:22:33:44:55; U-Boot > tftpboot ${loadaddr} u-boot.imx; U-Boot > sf probe; sf erase 0 0xc0000 U-Boot > sf write ${loadaddr} 0x400 ${filesize}; U-Boot > reset

Check signature in FDT

When setting up verified boot (i.MX8MP) I had to verify if the signature was added correctly. Below how to do so. (Note, key below is self signed, never upload yours..)

u-boot=> fdt addr $fdtcontroladdr u-boot=> fdt print /signature signature { key-dev { required = "conf"; algo = "sha256,rsa2048"; rsa,r-squared = * 0x00000000adbe8268 [0x00000100]; rsa,modulus = * 0x00000000adbe8374 [0x00000100]; rsa,exponent = <0x00000000 0x00010001>; rsa,n0-inverse = <0x0c0d8a77>; rsa,num-bits = <0x00000800>; key-name-hint = "dev"; }; }; u-boot=> md.b 0xadbe8268 0x100 adbe8268: 60 5e 0c 5a 8f 37 77 82 a7 9f ce f9 12 94 8a db `^.Z.7w......... [ .. ] adbe8358: 23 a1 30 79 95 0c 4e ef 3b 57 43 63 db 58 4f 88 #.0y..N.;WCc.XO. u-boot=> md.b 0xadbe8374 0x100 adbe8374: b9 b1 67 96 12 39 1e cb 40 38 39 a3 d3 3e ed 47 ..g..9..@89..>.G [ .. ] adbe8464: be 89 02 e1 55 8e 1f 94 ba 6e 71 fb 37 4c 90 b9 ....U....nq.7L..