From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 2/2] boot: script: The boot.scr file for K+P's boards
Date: Wed, 14 Mar 2018 11:07:01 +0100 [thread overview]
Message-ID: <20180314100701.25121-2-lukma@denx.de> (raw)
In-Reply-To: <20180314100701.25121-1-lukma@denx.de>
By using this file one can avoid cluttering <board>.h file with u-boot
HUSH commands necessary for booting target device.
With such approach the commands are stored only in one place and can be
reused if needed.
Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
board/k+p/bootscripts/tpcboot.cmd | 96 +++++++++++++++++++++++++++++++++++++++
1 file changed, 96 insertions(+)
create mode 100644 board/k+p/bootscripts/tpcboot.cmd
diff --git a/board/k+p/bootscripts/tpcboot.cmd b/board/k+p/bootscripts/tpcboot.cmd
new file mode 100644
index 0000000000..f6d59a1186
--- /dev/null
+++ b/board/k+p/bootscripts/tpcboot.cmd
@@ -0,0 +1,96 @@
+#
+# Copyright (C) 2018
+# Lukasz Majewski, DENX Software Engineering, lukma at denx.de
+#
+#
+# This is an example file to generate boot.scr - a boot script for U-Boot
+# Generate boot.scr:
+# ./tools/mkimage -c none -A arm -T script -d tpcboot.cmd boot.scr
+#
+# SPDX-License-Identifier: GPL-2.0+
+
+
+# Input envs (to be set in environment)
+# Mandatory:
+# kernel_file = "fitImage"
+# boardname = "XXXX" // set automatically in u-boot
+# boardsoc = "imx6q" // set automatically in u-boot
+#
+# Optional:
+# bootcmd_force = "nfs" "tftp_kernel"
+# If not set - eMMC/SD boot
+
+# Generic setup
+setenv mmcroot "/dev/mmcblk${devnum}p2 rootwait rw"
+setenv displayargs ""
+setenv mmcargs "setenv bootargs console=${console} ${smp} root=${mmcroot} \
+ ${displayargs}"
+setenv boot_fitImage "
+ setenv fdt_conf 'conf@${boardsoc}-${boardname}.dtb';
+ setenv itbcfg "\"#\${fdt_conf}\"";
+ print itbcfg;
+ bootm '${loadaddr}${itbcfg}';"
+
+#------------------------------------------------------------
+#
+# Provide default 'bootcmd' command
+#------------------------------------------------------------
+setenv bootcmd "
+if test -e ${devtype} ${devnum}:${distro_bootpart} ${kernel_file}; then
+ echo Found kernel image: ${kernel_file};
+ if load ${devtype} ${devnum}:${distro_bootpart} ${loadaddr} \
+ ${kernel_file}; then
+ run mmcargs;
+ run boot_fitImage;
+ fi;
+fi;"
+
+#------------------------------------------------------------
+#
+# Provide 'boot_tftp_kernel' command
+#------------------------------------------------------------
+setenv download_kernel "tftpboot ${loadaddr} ${kernel_file}"
+
+setenv boot_tftp_kernel "
+if run download_kernel; then
+ run mmcargs;
+ run boot_fitImage;
+fi"
+
+#------------------------------------------------------------
+#
+# Provide 'boot_nfs' command
+#------------------------------------------------------------
+setenv rootpath "/srv/tftp/KP/rootfs"
+setenv nfsargs "setenv bootargs root=/dev/nfs rw \
+ nfsroot=${serverip}:${rootpath},nolock,nfsvers=3"
+setenv addip "setenv bootargs ${bootargs} \
+ ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:\
+ ${hostname}:eth0:on"
+
+setenv boot_nfs "
+if run download_kernel; then
+ run nfsargs;
+ run addip;
+ setenv bootargs ${bootargs} console=${console};
+
+ run boot_fitImage;
+fi"
+
+#------------------------------------------------------------
+#
+# Set correct boot flow
+#------------------------------------------------------------
+
+setenv bcmd "
+if test ! -n ${bootcmd_force}; then
+ run bootcmd;
+fi;
+if test ${bootcmd_force} = nfs; then
+ run boot_nfs;
+else if test ${bootcmd_force} = tftp_kernel; then
+ run boot_tftp_kernel;
+ fi;
+fi"
+
+run bcmd
--
2.11.0
next prev parent reply other threads:[~2018-03-14 10:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-14 10:07 [U-Boot] [PATCH v1 1/2] imx: board: Add support for the K+P's kp_imx6q_tpc board Lukasz Majewski
2018-03-14 10:07 ` Lukasz Majewski [this message]
2018-03-29 16:10 ` [U-Boot] [PATCH v1 2/2] boot: script: The boot.scr file for K+P's boards Stefano Babic
2018-03-29 16:10 ` [U-Boot] [PATCH v1 1/2] imx: board: Add support for the K+P's kp_imx6q_tpc board Stefano Babic
2018-03-29 16:43 ` Lukasz Majewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180314100701.25121-2-lukma@denx.de \
--to=lukma@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox