blob: b81494dd1bfb1b4ceb494e3d4bc1387951c563ba [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001# SPDX-License-Identifier: GPL-2.0+
Lukasz Majewski3c21b112018-04-05 09:04:39 +02002#
3# Copyright (C) 2018
4# Lukasz Majewski, DENX Software Engineering, lukma@denx.de
Lukasz Majewski3c21b112018-04-05 09:04:39 +02005# 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 Majewski3c21b112018-04-05 09:04:39 +02009
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
22setenv mmcroot "/dev/mmcblk${devnum}p2 rootwait rw"
23setenv displayargs ""
24setenv mmcargs "setenv bootargs console=${console} ${smp} root=${mmcroot} \
25 ${displayargs}"
Lukasz Majewskic71787d2018-05-20 08:33:15 +020026setenv miscadj "
27if test '${boardsoc}' = 'imx53'; then
28 setenv bootargs '${bootargs} di=${dig_in} key1=${key1}';
29fi;"
Lukasz Majewski16a91fa2019-04-04 12:26:56 +020030setenv nfsadj "
31if test '${boardsoc}' = 'imx53'; then
32 if test '${boardtype}' = 'hsc'; then
33 setenv bootargs '${bootargs} dsa_core.blacklist=yes';
34 fi;
35fi;"
Lukasz Majewski3c21b112018-04-05 09:04:39 +020036setenv 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#------------------------------------------------------------
46setenv bootcmd "
47if 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 Majewskic71787d2018-05-20 08:33:15 +020052 run miscadj;
Lukasz Majewski3c21b112018-04-05 09:04:39 +020053 run boot_fitImage;
54 fi;
55fi;"
56
57#------------------------------------------------------------
58#
59# Provide 'boot_tftp_kernel' command
60#------------------------------------------------------------
Lukasz Majewski2ea30732018-08-31 13:58:26 +020061setenv download_kernel "dhcp ${loadaddr} ${kernel_file}"
Lukasz Majewski3c21b112018-04-05 09:04:39 +020062
63setenv boot_tftp_kernel "
64if run download_kernel; then
65 run mmcargs;
Lukasz Majewskic71787d2018-05-20 08:33:15 +020066 run miscadj;
Lukasz Majewski3c21b112018-04-05 09:04:39 +020067 run boot_fitImage;
68fi"
69
70#------------------------------------------------------------
71#
72# Provide 'boot_nfs' command
73#------------------------------------------------------------
Lukasz Majewski7f17f2c2018-08-31 13:58:28 +020074setenv nfsargs "setenv bootargs root=/dev/nfs rw nfsroot='${rootpath}',nolock,nfsvers=3"
Lukasz Majewski132ab7e2018-08-31 13:58:27 +020075setenv addip "setenv bootargs '${bootargs}' ip='${ipaddr}':'${serverip}':'${gatewayip}':'${netmask}':'${hostname}':eth0:on"
Lukasz Majewski3c21b112018-04-05 09:04:39 +020076
77setenv boot_nfs "
78if run download_kernel; then
79 run nfsargs;
80 run addip;
Lukasz Majewski16a91fa2019-04-04 12:26:56 +020081 run nfsadj;
Lukasz Majewski132ab7e2018-08-31 13:58:27 +020082 setenv bootargs '${bootargs}' console=${console};
Lukasz Majewski3c21b112018-04-05 09:04:39 +020083
84 run boot_fitImage;
85fi"
86
87#------------------------------------------------------------
88#
89# Set correct boot flow
90#------------------------------------------------------------
91
92setenv bcmd "
93if test ! -n ${bootcmd_force}; then
94 run bootcmd;
95fi;
96if test ${bootcmd_force} = nfs; then
97 run boot_nfs;
98else if test ${bootcmd_force} = tftp_kernel; then
99 run boot_tftp_kernel;
100 fi;
101fi"
102
103run bcmd