SPDX: Convert all of our single license tags to Linux Kernel style
[platform/kernel/u-boot.git] / board / k+p / bootscripts / tpcboot.cmd
1 # SPDX-License-Identifier: GPL-2.0+
2 #
3 # Copyright (C) 2018
4 # Lukasz Majewski, DENX Software Engineering, lukma@denx.de
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 #
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}"
26 setenv boot_fitImage "
27         setenv fdt_conf 'conf@${boardsoc}-${boardname}.dtb';
28         setenv itbcfg "\"#\${fdt_conf}\"";
29         print itbcfg;
30         bootm '${loadaddr}${itbcfg}';"
31
32 #------------------------------------------------------------
33 #
34 # Provide default 'bootcmd' command
35 #------------------------------------------------------------
36 setenv bootcmd "
37 if test -e ${devtype} ${devnum}:${distro_bootpart} ${kernel_file}; then
38         echo Found kernel image: ${kernel_file};
39         if load ${devtype} ${devnum}:${distro_bootpart} ${loadaddr} \
40            ${kernel_file}; then
41                 run mmcargs;
42                 run boot_fitImage;
43         fi;
44 fi;"
45
46 #------------------------------------------------------------
47 #
48 # Provide 'boot_tftp_kernel' command
49 #------------------------------------------------------------
50 setenv download_kernel "tftpboot ${loadaddr} ${kernel_file}"
51
52 setenv boot_tftp_kernel "
53 if run download_kernel; then
54         run mmcargs;
55         run boot_fitImage;
56 fi"
57
58 #------------------------------------------------------------
59 #
60 # Provide 'boot_nfs' command
61 #------------------------------------------------------------
62 setenv rootpath "/srv/tftp/KP/rootfs"
63 setenv nfsargs "setenv bootargs root=/dev/nfs rw \
64        nfsroot=${serverip}:${rootpath},nolock,nfsvers=3"
65 setenv addip "setenv bootargs ${bootargs} \
66        ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:\
67        ${hostname}:eth0:on"
68
69 setenv boot_nfs "
70 if run download_kernel; then
71         run nfsargs;
72         run addip;
73         setenv bootargs ${bootargs} console=${console};
74
75         run boot_fitImage;
76 fi"
77
78 #------------------------------------------------------------
79 #
80 # Set correct boot flow
81 #------------------------------------------------------------
82
83 setenv bcmd "
84 if test ! -n ${bootcmd_force}; then
85         run bootcmd;
86 fi;
87 if test ${bootcmd_force} = nfs; then
88         run boot_nfs;
89 else if test ${bootcmd_force} = tftp_kernel; then
90         run boot_tftp_kernel;
91      fi;
92 fi"
93
94 run bcmd