Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0+ |
Lukasz Majewski | b04ff9b | 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 | b04ff9b | 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 | b04ff9b | 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 | 5ca614c | 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 | fbd6118 | 2019-04-04 12:26:56 +0200 | [diff] [blame] | 30 | setenv nfsadj " |
| 31 | if test '${boardsoc}' = 'imx53'; then |
| 32 | if test '${boardtype}' = 'hsc'; then |
| 33 | setenv bootargs '${bootargs} dsa_core.blacklist=yes'; |
| 34 | fi; |
| 35 | fi;" |
Lukasz Majewski | b04ff9b | 2018-04-05 09:04:39 +0200 | [diff] [blame] | 36 | setenv boot_fitImage " |
| 37 | setenv fdt_conf 'conf@${boardsoc}-${boardname}.dtb'; |
| 38 | setenv itbcfg "\"#\${fdt_conf}\""; |
| 39 | print itbcfg; |
| 40 | bootm '${loadaddr}${itbcfg}';" |
| 41 | |
| 42 | #------------------------------------------------------------ |
| 43 | # |
| 44 | # Provide default 'bootcmd' command |
| 45 | #------------------------------------------------------------ |
| 46 | setenv bootcmd " |
| 47 | if test -e ${devtype} ${devnum}:${distro_bootpart} ${kernel_file}; then |
| 48 | echo Found kernel image: ${kernel_file}; |
| 49 | if load ${devtype} ${devnum}:${distro_bootpart} ${loadaddr} \ |
| 50 | ${kernel_file}; then |
| 51 | run mmcargs; |
Lukasz Majewski | 5ca614c | 2018-05-20 08:33:15 +0200 | [diff] [blame] | 52 | run miscadj; |
Lukasz Majewski | b04ff9b | 2018-04-05 09:04:39 +0200 | [diff] [blame] | 53 | run boot_fitImage; |
| 54 | fi; |
| 55 | fi;" |
| 56 | |
| 57 | #------------------------------------------------------------ |
| 58 | # |
| 59 | # Provide 'boot_tftp_kernel' command |
| 60 | #------------------------------------------------------------ |
Lukasz Majewski | 2d558da | 2018-08-31 13:58:26 +0200 | [diff] [blame] | 61 | setenv download_kernel "dhcp ${loadaddr} ${kernel_file}" |
Lukasz Majewski | b04ff9b | 2018-04-05 09:04:39 +0200 | [diff] [blame] | 62 | |
| 63 | setenv boot_tftp_kernel " |
| 64 | if run download_kernel; then |
| 65 | run mmcargs; |
Lukasz Majewski | 5ca614c | 2018-05-20 08:33:15 +0200 | [diff] [blame] | 66 | run miscadj; |
Lukasz Majewski | b04ff9b | 2018-04-05 09:04:39 +0200 | [diff] [blame] | 67 | run boot_fitImage; |
| 68 | fi" |
| 69 | |
| 70 | #------------------------------------------------------------ |
| 71 | # |
| 72 | # Provide 'boot_nfs' command |
| 73 | #------------------------------------------------------------ |
Lukasz Majewski | 97657a8 | 2018-08-31 13:58:28 +0200 | [diff] [blame] | 74 | setenv nfsargs "setenv bootargs root=/dev/nfs rw nfsroot='${rootpath}',nolock,nfsvers=3" |
Lukasz Majewski | 7e6bba2 | 2018-08-31 13:58:27 +0200 | [diff] [blame] | 75 | setenv addip "setenv bootargs '${bootargs}' ip='${ipaddr}':'${serverip}':'${gatewayip}':'${netmask}':'${hostname}':eth0:on" |
Lukasz Majewski | b04ff9b | 2018-04-05 09:04:39 +0200 | [diff] [blame] | 76 | |
| 77 | setenv boot_nfs " |
| 78 | if run download_kernel; then |
| 79 | run nfsargs; |
| 80 | run addip; |
Lukasz Majewski | fbd6118 | 2019-04-04 12:26:56 +0200 | [diff] [blame] | 81 | run nfsadj; |
Lukasz Majewski | 7e6bba2 | 2018-08-31 13:58:27 +0200 | [diff] [blame] | 82 | setenv bootargs '${bootargs}' console=${console}; |
Lukasz Majewski | b04ff9b | 2018-04-05 09:04:39 +0200 | [diff] [blame] | 83 | |
| 84 | run boot_fitImage; |
| 85 | fi" |
| 86 | |
| 87 | #------------------------------------------------------------ |
| 88 | # |
| 89 | # Set correct boot flow |
| 90 | #------------------------------------------------------------ |
| 91 | |
| 92 | setenv bcmd " |
| 93 | if test ! -n ${bootcmd_force}; then |
| 94 | run bootcmd; |
| 95 | fi; |
| 96 | if test ${bootcmd_force} = nfs; then |
| 97 | run boot_nfs; |
| 98 | else if test ${bootcmd_force} = tftp_kernel; then |
| 99 | run boot_tftp_kernel; |
| 100 | fi; |
| 101 | fi" |
| 102 | |
| 103 | run bcmd |