Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2010-2012 |
| 3 | * NVIDIA Corporation <www.nvidia.com> |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA |
| 22 | */ |
| 23 | |
| 24 | #ifndef __TEGRA2_COMMON_POST_H |
| 25 | #define __TEGRA2_COMMON_POST_H |
| 26 | |
| 27 | #ifdef CONFIG_BOOTCOMMAND |
| 28 | |
| 29 | #define BOOTCMDS_COMMON "" |
| 30 | |
| 31 | #else |
| 32 | |
| 33 | #ifdef CONFIG_CMD_EXT2 |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame^] | 34 | #define BOOT_FSTYPE_EXT2 "ext2 " |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 35 | #else |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame^] | 36 | #define BOOT_FSTYPE_EXT2 "" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 37 | #endif |
| 38 | |
| 39 | #ifdef CONFIG_CMD_FAT |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame^] | 40 | #define BOOT_FSTYPE_FAT "fat" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 41 | #else |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame^] | 42 | #define BOOT_FSTYPE_FAT "" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 43 | #endif |
| 44 | |
| 45 | #ifdef CONFIG_CMD_MMC |
| 46 | #define BOOTCMDS_MMC \ |
| 47 | "mmc_boot=" \ |
| 48 | "setenv devtype mmc; " \ |
| 49 | "if mmc dev ${devnum}; then " \ |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame^] | 50 | "run scan_boot; " \ |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 51 | "fi\0" \ |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame^] | 52 | "bootcmd_mmc0=setenv devnum 0; run mmc_boot;\0" \ |
| 53 | "bootcmd_mmc1=setenv devnum 1; run mmc_boot;\0" |
| 54 | #define BOOT_TARGETS_MMC "mmc1 mmc0" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 55 | #else |
| 56 | #define BOOTCMDS_MMC "" |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame^] | 57 | #define BOOT_TARGETS_MMC "" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 58 | #endif |
| 59 | |
| 60 | #ifdef CONFIG_CMD_USB |
| 61 | #define BOOTCMDS_USB \ |
| 62 | "usb_boot=" \ |
| 63 | "setenv devtype usb; " \ |
| 64 | "if usb dev ${devnum}; then " \ |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame^] | 65 | "run scan_boot; " \ |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 66 | "fi\0" \ |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame^] | 67 | "bootcmd_usb0=setenv devnum 0; run usb_boot;\0" |
| 68 | #define BOOT_TARGETS_USB "usb0" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 69 | #define BOOTCMD_INIT_USB "usb start 0; " |
| 70 | #else |
| 71 | #define BOOTCMDS_USB "" |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame^] | 72 | #define BOOT_TARGETS_USB "" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 73 | #define BOOTCMD_INIT_USB "" |
| 74 | #endif |
| 75 | |
| 76 | #ifdef CONFIG_CMD_DHCP |
| 77 | #define BOOTCMDS_DHCP \ |
| 78 | "bootcmd_dhcp=" \ |
| 79 | "if dhcp ${scriptaddr} boot.scr.uimg; then "\ |
| 80 | "source ${scriptaddr}; " \ |
| 81 | "fi\0" |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame^] | 82 | #define BOOT_TARGETS_DHCP "dhcp" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 83 | #else |
| 84 | #define BOOTCMDS_DHCP "" |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame^] | 85 | #define BOOT_TARGETS_DHCP "" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 86 | #endif |
| 87 | |
| 88 | #define BOOTCMDS_COMMON \ |
| 89 | "scriptaddr=0x400000\0" \ |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame^] | 90 | \ |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 91 | "rootpart=1\0" \ |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame^] | 92 | \ |
| 93 | "script_boot=" \ |
| 94 | "if ${fs}load ${devtype} ${devnum}:${rootpart} " \ |
| 95 | "${scriptaddr} ${prefix}${script}; then " \ |
| 96 | "echo ${script} found! Executing ...;" \ |
| 97 | "source ${scriptaddr};" \ |
| 98 | "fi;\0" \ |
| 99 | \ |
| 100 | "scan_boot=" \ |
| 101 | "echo Scanning ${devtype} ${devnum}...; " \ |
| 102 | "for fs in ${boot_fstypes}; do " \ |
| 103 | "for prefix in ${boot_prefixes}; do " \ |
| 104 | "for script in ${boot_scripts}; do " \ |
| 105 | "run script_boot; " \ |
| 106 | "done; " \ |
| 107 | "done; " \ |
| 108 | "done;\0" \ |
| 109 | \ |
| 110 | "boot_targets=" \ |
| 111 | BOOT_TARGETS_MMC " " \ |
| 112 | BOOT_TARGETS_USB " " \ |
| 113 | BOOT_TARGETS_DHCP " " \ |
| 114 | "\0" \ |
| 115 | \ |
| 116 | "boot_fstypes=" \ |
| 117 | BOOT_FSTYPE_EXT2 " " \ |
| 118 | BOOT_FSTYPE_FAT " " \ |
| 119 | "\0" \ |
| 120 | \ |
| 121 | "boot_prefixes=/ /boot/\0" \ |
| 122 | \ |
| 123 | "boot_scripts=boot.scr.uimg boot.scr\0" \ |
| 124 | \ |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 125 | BOOTCMDS_MMC \ |
| 126 | BOOTCMDS_USB \ |
| 127 | BOOTCMDS_DHCP |
| 128 | |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame^] | 129 | #define CONFIG_BOOTCOMMAND \ |
| 130 | BOOTCMD_INIT_USB \ |
| 131 | "for target in ${boot_targets}; do run bootcmd_${target}; done" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 132 | |
| 133 | #endif |
| 134 | |
| 135 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 136 | TEGRA2_DEVICE_SETTINGS \ |
| 137 | BOOTCMDS_COMMON |
| 138 | |
| 139 | #endif /* __TEGRA2_COMMON_POST_H */ |