Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0+ |
Lukasz Majewski | 3c21b11 | 2018-04-05 09:04:39 +0200 | [diff] [blame] | 2 | # |
| 3 | # Copyright (C) 2018 |
| 4 | # Lukasz Majewski, DENX Software Engineering, lukma@denx.de |
Lukasz Majewski | 3c21b11 | 2018-04-05 09:04:39 +0200 | [diff] [blame] | 5 | # This is an example file to generate boot.scr - a boot script for U-Boot |
| 6 | # Generate boot.scr: |
| 7 | # ./tools/mkimage -c none -A arm -T script -d tpcboot.cmd boot.scr |
| 8 | # |
Lukasz Majewski | 3c21b11 | 2018-04-05 09:04:39 +0200 | [diff] [blame] | 9 | |
| 10 | |
| 11 | # Input envs (to be set in environment) |
| 12 | # Mandatory: |
| 13 | # kernel_file = "fitImage" |
| 14 | # boardname = "XXXX" // set automatically in u-boot |
| 15 | # boardsoc = "imx6q" // set automatically in u-boot |
| 16 | # |
| 17 | # Optional: |
| 18 | # bootcmd_force = "nfs" "tftp_kernel" |
| 19 | # If not set - eMMC/SD boot |
| 20 | |
| 21 | # Generic setup |
| 22 | setenv mmcroot "/dev/mmcblk${devnum}p2 rootwait rw" |
| 23 | setenv displayargs "" |
| 24 | setenv mmcargs "setenv bootargs console=${console} ${smp} root=${mmcroot} \ |
| 25 | ${displayargs}" |
Lukasz Majewski | c71787d | 2018-05-20 08:33:15 +0200 | [diff] [blame] | 26 | setenv miscadj " |
| 27 | if test '${boardsoc}' = 'imx53'; then |
| 28 | setenv bootargs '${bootargs} di=${dig_in} key1=${key1}'; |
| 29 | fi;" |
Lukasz Majewski | 3c21b11 | 2018-04-05 09:04:39 +0200 | [diff] [blame] | 30 | setenv boot_fitImage " |
| 31 | setenv fdt_conf 'conf@${boardsoc}-${boardname}.dtb'; |
| 32 | setenv itbcfg "\"#\${fdt_conf}\""; |
| 33 | print itbcfg; |
| 34 | bootm '${loadaddr}${itbcfg}';" |
| 35 | |
| 36 | #------------------------------------------------------------ |
| 37 | # |
| 38 | # Provide default 'bootcmd' command |
| 39 | #------------------------------------------------------------ |
| 40 | setenv bootcmd " |
| 41 | if test -e ${devtype} ${devnum}:${distro_bootpart} ${kernel_file}; then |
| 42 | echo Found kernel image: ${kernel_file}; |
| 43 | if load ${devtype} ${devnum}:${distro_bootpart} ${loadaddr} \ |
| 44 | ${kernel_file}; then |
| 45 | run mmcargs; |
Lukasz Majewski | c71787d | 2018-05-20 08:33:15 +0200 | [diff] [blame] | 46 | run miscadj; |
Lukasz Majewski | 3c21b11 | 2018-04-05 09:04:39 +0200 | [diff] [blame] | 47 | run boot_fitImage; |
| 48 | fi; |
| 49 | fi;" |
| 50 | |
| 51 | #------------------------------------------------------------ |
| 52 | # |
| 53 | # Provide 'boot_tftp_kernel' command |
| 54 | #------------------------------------------------------------ |
Lukasz Majewski | 2ea3073 | 2018-08-31 13:58:26 +0200 | [diff] [blame] | 55 | setenv download_kernel "dhcp ${loadaddr} ${kernel_file}" |
Lukasz Majewski | 3c21b11 | 2018-04-05 09:04:39 +0200 | [diff] [blame] | 56 | |
| 57 | setenv boot_tftp_kernel " |
| 58 | if run download_kernel; then |
| 59 | run mmcargs; |
Lukasz Majewski | c71787d | 2018-05-20 08:33:15 +0200 | [diff] [blame] | 60 | run miscadj; |
Lukasz Majewski | 3c21b11 | 2018-04-05 09:04:39 +0200 | [diff] [blame] | 61 | run boot_fitImage; |
| 62 | fi" |
| 63 | |
| 64 | #------------------------------------------------------------ |
| 65 | # |
| 66 | # Provide 'boot_nfs' command |
| 67 | #------------------------------------------------------------ |
Lukasz Majewski | 132ab7e | 2018-08-31 13:58:27 +0200 | [diff] [blame^] | 68 | setenv nfsargs "setenv bootargs root=/dev/nfs rw nfsroot='${serverip}':'${rootpath}',nolock,nfsvers=3" |
| 69 | setenv addip "setenv bootargs '${bootargs}' ip='${ipaddr}':'${serverip}':'${gatewayip}':'${netmask}':'${hostname}':eth0:on" |
Lukasz Majewski | 3c21b11 | 2018-04-05 09:04:39 +0200 | [diff] [blame] | 70 | |
| 71 | setenv boot_nfs " |
| 72 | if run download_kernel; then |
| 73 | run nfsargs; |
| 74 | run addip; |
Lukasz Majewski | 132ab7e | 2018-08-31 13:58:27 +0200 | [diff] [blame^] | 75 | setenv bootargs '${bootargs}' console=${console}; |
Lukasz Majewski | 3c21b11 | 2018-04-05 09:04:39 +0200 | [diff] [blame] | 76 | |
| 77 | run boot_fitImage; |
| 78 | fi" |
| 79 | |
| 80 | #------------------------------------------------------------ |
| 81 | # |
| 82 | # Set correct boot flow |
| 83 | #------------------------------------------------------------ |
| 84 | |
| 85 | setenv bcmd " |
| 86 | if test ! -n ${bootcmd_force}; then |
| 87 | run bootcmd; |
| 88 | fi; |
| 89 | if test ${bootcmd_force} = nfs; then |
| 90 | run boot_nfs; |
| 91 | else if test ${bootcmd_force} = tftp_kernel; then |
| 92 | run boot_tftp_kernel; |
| 93 | fi; |
| 94 | fi" |
| 95 | |
| 96 | run bcmd |