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 |
| 34 | #define BOOTCMD_FS_EXT2 "ext2 " |
| 35 | #else |
| 36 | #define BOOTCMD_FS_EXT2 "" |
| 37 | #endif |
| 38 | |
| 39 | #ifdef CONFIG_CMD_FAT |
| 40 | #define BOOTCMD_FS_FAT "fat" |
| 41 | #else |
| 42 | #define BOOTCMD_FS_FAT "" |
| 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 " \ |
| 50 | "run script_boot; " \ |
| 51 | "fi\0" \ |
| 52 | "mmc0_boot=setenv devnum 0; run mmc_boot;\0" \ |
| 53 | "mmc1_boot=setenv devnum 1; run mmc_boot;\0" \ |
| 54 | "bootcmd_mmc=run mmc1_boot; run mmc0_boot\0" |
| 55 | #define BOOTCMD_MMC "run bootcmd_mmc; " |
| 56 | #else |
| 57 | #define BOOTCMDS_MMC "" |
| 58 | #define BOOTCMD_MMC "" |
| 59 | #endif |
| 60 | |
| 61 | #ifdef CONFIG_CMD_USB |
| 62 | #define BOOTCMDS_USB \ |
| 63 | "usb_boot=" \ |
| 64 | "setenv devtype usb; " \ |
| 65 | "if usb dev ${devnum}; then " \ |
| 66 | "run script_boot; " \ |
| 67 | "fi\0" \ |
| 68 | "usb0_boot=setenv devnum 0; run usb_boot;\0" \ |
| 69 | "bootcmd_usb=run usb0_boot\0" |
| 70 | #define BOOTCMD_USB "run bootcmd_usb; " |
| 71 | #define BOOTCMD_INIT_USB "usb start 0; " |
| 72 | #else |
| 73 | #define BOOTCMDS_USB "" |
| 74 | #define BOOTCMD_USB "" |
| 75 | #define BOOTCMD_INIT_USB "" |
| 76 | #endif |
| 77 | |
| 78 | #ifdef CONFIG_CMD_DHCP |
| 79 | #define BOOTCMDS_DHCP \ |
| 80 | "bootcmd_dhcp=" \ |
| 81 | "if dhcp ${scriptaddr} boot.scr.uimg; then "\ |
| 82 | "source ${scriptaddr}; " \ |
| 83 | "fi\0" |
| 84 | #define BOOTCMD_DHCP "run bootcmd_dhcp; " |
| 85 | #else |
| 86 | #define BOOTCMDS_DHCP "" |
| 87 | #define BOOTCMD_DHCP "" |
| 88 | #endif |
| 89 | |
| 90 | #define BOOTCMDS_COMMON \ |
| 91 | "scriptaddr=0x400000\0" \ |
| 92 | "rootpart=1\0" \ |
| 93 | "script_boot=" \ |
| 94 | "for fs in " BOOTCMD_FS_EXT2 BOOTCMD_FS_FAT "; do " \ |
| 95 | "for prefix in / /boot/; do " \ |
| 96 | "for script in boot.scr.uimg boot.scr; do " \ |
| 97 | "echo Scanning ${devtype} ${devnum}:${rootpart} ${fs} ${prefix}${script} ...; " \ |
| 98 | "if ${fs}load ${devtype} ${devnum}:${rootpart} ${scriptaddr} ${prefix}${script}; then " \ |
| 99 | "echo ${script} found! Executing ...;" \ |
| 100 | "source ${scriptaddr};" \ |
| 101 | "fi; " \ |
| 102 | "done; " \ |
| 103 | "done; " \ |
| 104 | "done;\0" \ |
| 105 | BOOTCMDS_MMC \ |
| 106 | BOOTCMDS_USB \ |
| 107 | BOOTCMDS_DHCP |
| 108 | |
| 109 | #define CONFIG_BOOTCOMMAND BOOTCMD_INIT_USB BOOTCMD_USB BOOTCMD_MMC BOOTCMD_DHCP |
| 110 | |
| 111 | #endif |
| 112 | |
| 113 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 114 | TEGRA2_DEVICE_SETTINGS \ |
| 115 | BOOTCMDS_COMMON |
| 116 | |
| 117 | #endif /* __TEGRA2_COMMON_POST_H */ |