3 * NVIDIA Corporation <www.nvidia.com>
5 * Copyright 2014 Red Hat, Inc.
7 * SPDX-License-Identifier: GPL-2.0+
10 #ifndef _CONFIG_CMD_DISTRO_BOOTCMD_H
11 #define _CONFIG_CMD_DISTRO_BOOTCMD_H
13 /* We need the part command */
14 #define CONFIG_PARTITION_UUIDS
15 #define CONFIG_CMD_PART
17 #define BOOTENV_SHARED_BLKDEV_BODY(devtypel) \
18 "if " #devtypel " dev ${devnum}; then " \
19 "setenv devtype " #devtypel "; " \
20 "run scan_dev_for_boot_part; " \
23 #define BOOTENV_SHARED_BLKDEV(devtypel) \
25 BOOTENV_SHARED_BLKDEV_BODY(devtypel)
27 #define BOOTENV_DEV_BLKDEV(devtypeu, devtypel, instance) \
28 "bootcmd_" #devtypel #instance "=" \
29 "setenv devnum " #instance "; " \
30 "run " #devtypel "_boot\0"
32 #define BOOTENV_DEV_NAME_BLKDEV(devtypeu, devtypel, instance) \
33 #devtypel #instance " "
36 #define BOOTENV_SHARED_MMC BOOTENV_SHARED_BLKDEV(mmc)
37 #define BOOTENV_DEV_MMC BOOTENV_DEV_BLKDEV
38 #define BOOTENV_DEV_NAME_MMC BOOTENV_DEV_NAME_BLKDEV
40 #define BOOTENV_SHARED_MMC
41 #define BOOTENV_DEV_MMC \
42 BOOT_TARGET_DEVICES_references_MMC_without_CONFIG_CMD_MMC
43 #define BOOTENV_DEV_NAME_MMC \
44 BOOT_TARGET_DEVICES_references_MMC_without_CONFIG_CMD_MMC
47 #ifdef CONFIG_CMD_SATA
48 #define BOOTENV_SHARED_SATA BOOTENV_SHARED_BLKDEV(sata)
49 #define BOOTENV_DEV_SATA BOOTENV_DEV_BLKDEV
50 #define BOOTENV_DEV_NAME_SATA BOOTENV_DEV_NAME_BLKDEV
52 #define BOOTENV_SHARED_SATA
53 #define BOOTENV_DEV_SATA \
54 BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_CMD_SATA
55 #define BOOTENV_DEV_NAME_SATA \
56 BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_CMD_SATA
59 #ifdef CONFIG_CMD_SCSI
60 #define BOOTENV_RUN_SCSI_INIT "run scsi_init; "
61 #define BOOTENV_SET_SCSI_NEED_INIT "setenv scsi_need_init; "
62 #define BOOTENV_SHARED_SCSI \
64 "if ${scsi_need_init}; then " \
65 "setenv scsi_need_init false; " \
70 BOOTENV_RUN_SCSI_INIT \
71 BOOTENV_SHARED_BLKDEV_BODY(scsi)
72 #define BOOTENV_DEV_SCSI BOOTENV_DEV_BLKDEV
73 #define BOOTENV_DEV_NAME_SCSI BOOTENV_DEV_NAME_BLKDEV
75 #define BOOTENV_RUN_SCSI_INIT
76 #define BOOTENV_SET_SCSI_NEED_INIT
77 #define BOOTENV_SHARED_SCSI
78 #define BOOTENV_DEV_SCSI \
79 BOOT_TARGET_DEVICES_references_SCSI_without_CONFIG_CMD_SCSI
80 #define BOOTENV_DEV_NAME_SCSI \
81 BOOT_TARGET_DEVICES_references_SCSI_without_CONFIG_CMD_SCSI
85 #define BOOTENV_SHARED_IDE BOOTENV_SHARED_BLKDEV(ide)
86 #define BOOTENV_DEV_IDE BOOTENV_DEV_BLKDEV
87 #define BOOTENV_DEV_NAME_IDE BOOTENV_DEV_NAME_BLKDEV
89 #define BOOTENV_SHARED_IDE
90 #define BOOTENV_DEV_IDE \
91 BOOT_TARGET_DEVICES_references_IDE_without_CONFIG_CMD_IDE
92 #define BOOTENV_DEV_NAME_IDE \
93 BOOT_TARGET_DEVICES_references_IDE_without_CONFIG_CMD_IDE
97 #define BOOTENV_RUN_USB_INIT "usb start; "
98 #define BOOTENV_SHARED_USB \
100 BOOTENV_RUN_USB_INIT \
101 BOOTENV_SHARED_BLKDEV_BODY(usb)
102 #define BOOTENV_DEV_USB BOOTENV_DEV_BLKDEV
103 #define BOOTENV_DEV_NAME_USB BOOTENV_DEV_NAME_BLKDEV
105 #define BOOTENV_RUN_USB_INIT
106 #define BOOTENV_SHARED_USB
107 #define BOOTENV_DEV_USB \
108 BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB
109 #define BOOTENV_DEV_NAME_USB \
110 BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB
113 #if defined(CONFIG_CMD_DHCP)
114 #define BOOTENV_DEV_DHCP(devtypeu, devtypel, instance) \
116 BOOTENV_RUN_USB_INIT \
117 "if dhcp ${scriptaddr} ${boot_script_dhcp}; then " \
118 "source ${scriptaddr}; " \
120 #define BOOTENV_DEV_NAME_DHCP(devtypeu, devtypel, instance) \
123 #define BOOTENV_DEV_DHCP \
124 BOOT_TARGET_DEVICES_references_DHCP_without_CONFIG_CMD_DHCP
125 #define BOOTENV_DEV_NAME_DHCP \
126 BOOT_TARGET_DEVICES_references_DHCP_without_CONFIG_CMD_DHCP
129 #if defined(CONFIG_CMD_DHCP) && defined(CONFIG_CMD_PXE)
130 #define BOOTENV_DEV_PXE(devtypeu, devtypel, instance) \
132 BOOTENV_RUN_USB_INIT \
134 "if pxe get; then " \
137 #define BOOTENV_DEV_NAME_PXE(devtypeu, devtypel, instance) \
140 #define BOOTENV_DEV_PXE \
141 BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE
142 #define BOOTENV_DEV_NAME_PXE \
143 BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE
146 #define BOOTENV_DEV_NAME(devtypeu, devtypel, instance) \
147 BOOTENV_DEV_NAME_##devtypeu(devtypeu, devtypel, instance)
148 #define BOOTENV_BOOT_TARGETS \
149 "boot_targets=" BOOT_TARGET_DEVICES(BOOTENV_DEV_NAME) "\0"
151 #define BOOTENV_DEV(devtypeu, devtypel, instance) \
152 BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance)
156 BOOTENV_SHARED_SATA \
157 BOOTENV_SHARED_SCSI \
159 "boot_prefixes=/ /boot/\0" \
160 "boot_scripts=boot.scr.uimg boot.scr\0" \
161 "boot_script_dhcp=boot.scr.uimg\0" \
162 BOOTENV_BOOT_TARGETS \
165 "sysboot ${devtype} ${devnum}:${bootpart} any " \
166 "${scriptaddr} ${prefix}extlinux/extlinux.conf\0" \
168 "scan_dev_for_extlinux=" \
169 "if test -e ${devtype} ${devnum}:${bootpart} " \
170 "${prefix}extlinux/extlinux.conf; then " \
171 "echo Found ${prefix}extlinux/extlinux.conf; " \
172 "run boot_extlinux; " \
173 "echo SCRIPT FAILED: continuing...; " \
177 "load ${devtype} ${devnum}:${bootpart} " \
178 "${scriptaddr} ${prefix}${script}; " \
179 "source ${scriptaddr}\0" \
181 "scan_dev_for_scripts=" \
182 "for script in ${boot_scripts}; do " \
183 "if test -e ${devtype} ${devnum}:${bootpart} " \
184 "${prefix}${script}; then " \
185 "echo Found U-Boot script " \
186 "${prefix}${script}; " \
187 "run boot_a_script; " \
188 "echo SCRIPT FAILED: continuing...; " \
192 "scan_dev_for_boot=" \
193 "echo Scanning ${devtype} ${devnum}:${bootpart}...; " \
194 "for prefix in ${boot_prefixes}; do " \
195 "run scan_dev_for_extlinux; " \
196 "run scan_dev_for_scripts; " \
199 "scan_dev_for_boot_part=" \
200 "part list ${devtype} ${devnum} devplist; " \
201 "for bootpart in ${devplist}; do " \
202 "if fstype ${devtype} ${devnum}:${bootpart} " \
203 "bootfstype; then " \
204 "run scan_dev_for_boot; " \
208 BOOT_TARGET_DEVICES(BOOTENV_DEV) \
210 "distro_bootcmd=" BOOTENV_SET_SCSI_NEED_INIT \
211 "for target in ${boot_targets}; do " \
212 "run bootcmd_${target}; " \
215 #ifndef CONFIG_BOOTCOMMAND
216 #define CONFIG_BOOTCOMMAND "run distro_bootcmd"
219 #endif /* _CONFIG_CMD_DISTRO_BOOTCMD_H */