From c17b07d4dc35fc9f8b424229ef4d1a3390f1dbe8 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 1 Aug 2014 09:12:53 +0200 Subject: sunxi-common.h: Remove CONFIG_SYS_BOOT_GET_CMDLINE sunxi does not need this and it should never have been enabled for it in the first place. Signed-off-by: Hans de Goede Acked-by: Ian Campbell --- include/configs/sunxi-common.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 6a3044f..e3dc9c4 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -126,8 +126,6 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ "bootm_size=0x10000000\0" -#define CONFIG_SYS_BOOT_GET_CMDLINE - #include #define CONFIG_FAT_WRITE /* enable write access */ -- cgit v1.1 From ad0fd965f7ac938923391667d2db5caa88d7bc6d Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 1 Aug 2014 09:16:47 +0200 Subject: sunxi-common.h: Remove dead #ifdef CONFIG_CMD_NET code block We undef CONFIG_CMD_NET at line 167, and there is nothing re-defining it between line 167 and the #ifdef CONFIG_CMD_NET, so remove this effectively dead block. Signed-off-by: Hans de Goede Acked-by: Ian Campbell --- include/configs/sunxi-common.h | 8 -------- 1 file changed, 8 deletions(-) (limited to 'include') diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index e3dc9c4..9d4801a 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -205,14 +205,6 @@ #define CONFIG_PHYLIB #endif -#ifdef CONFIG_CMD_NET -#define CONFIG_CMD_NFS -#define CONFIG_CMD_DNS -#define CONFIG_NETCONSOLE -#define CONFIG_BOOTP_DNS2 -#define CONFIG_BOOTP_SEND_HOSTNAME -#endif - #ifdef CONFIG_USB_EHCI #define CONFIG_CMD_USB #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 1 -- cgit v1.1 From 85a4455c517b15e7f08700d3e1f2523ac64aae35 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 1 Aug 2014 09:18:20 +0200 Subject: sunxi-common.h: Don't undefine CONFIG_CMD_NFS I see no reason to override the choice to include this from config_cmd_defauls.h . Signed-off-by: Hans de Goede Acked-by: Ian Campbell --- include/configs/sunxi-common.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 9d4801a..cbe8b40 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -168,7 +168,6 @@ #undef CONFIG_CMD_FPGA #undef CONFIG_CMD_NET -#undef CONFIG_CMD_NFS /* I2C */ #define CONFIG_SPL_I2C_SUPPORT -- cgit v1.1 From b9fb3b94cbb76884df4e8425abc2a95bb7aa6a56 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 1 Aug 2014 09:19:55 +0200 Subject: sunxi-common.h: Don't undef CONFIG_CMD_NET only to redefine it again later config_distro_defaults.h which is include later will redefine CONFIG_CMD_NET, drop the useless / meaningless undef of it. While at also move the undef of CONFIG_CMD_FPGA up to directly under the include of config_cmd_defaults.h, to make it clear that it overwrites the setting done from config_cmd_defaults.h . Signed-off-by: Hans de Goede Acked-by: Ian Campbell --- include/configs/sunxi-common.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'include') diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index cbe8b40..4c712f3 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -127,6 +127,7 @@ "bootm_size=0x10000000\0" #include +#undef CONFIG_CMD_FPGA #define CONFIG_FAT_WRITE /* enable write access */ @@ -166,9 +167,6 @@ #define CONFIG_SYS_SPL_MALLOC_START 0x4ff00000 #define CONFIG_SYS_SPL_MALLOC_SIZE 0x00080000 /* 512 KiB */ -#undef CONFIG_CMD_FPGA -#undef CONFIG_CMD_NET - /* I2C */ #define CONFIG_SPL_I2C_SUPPORT #define CONFIG_SYS_I2C -- cgit v1.1 From 8cc96848f0a467922820895b6b2363b0c64163b5 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Wed, 30 Jul 2014 16:37:14 -0600 Subject: config: introduce a generic $bootcmd This generic $bootcmd, and associated support macros, automatically searches a defined set of storage devices (or network protocols) for an extlinux configuration file or U-Boot boot script in various standardized locations. Distros that install such a boot config file/script in those standard locations will get easy-to-set-up booting on HW that enables this generic $bootcmd. Boards can define the set of devices from which boot is attempted, and the order in which they are attempted. Users may later customize this set/order by edting $boot_targets. Users may interrupt the boot process and boot from a specific device simply by executing e.g.: $ run bootcmd_mmc1 or: $ run bootcmd_pxe This patch was originally written by Dennis Gilmore based on Tegra and rpi_b boot scripts. I have made the following modifications since then: * Boards must define the BOOT_TARGET_DEVICES macro in order to specify the set of devices (and order) from which to attempt boot. If needed, we can define a default directly in config_distro_bootcmd.h. * Removed $env_import and related variables; nothing used them, and I think it's better for boards to pre-load an environment customization file using CONFIG_PREBOOT if they need. * Renamed a bunch of variables to suit my whims:-) Signed-off-by: Dennis Gilmore Signed-off-by: Stephen Warren Reviewed-by: Marek Vasut Acked-by: Simon Glass --- include/config_distro_bootcmd.h | 197 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 197 insertions(+) create mode 100644 include/config_distro_bootcmd.h (limited to 'include') diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h new file mode 100644 index 0000000..90d9901 --- /dev/null +++ b/include/config_distro_bootcmd.h @@ -0,0 +1,197 @@ +/* + * (C) Copyright 2014 + * NVIDIA Corporation + * + * Copyright 2014 Red Hat, Inc. + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef _CONFIG_CMD_DISTRO_BOOTCMD_H +#define _CONFIG_CMD_DISTRO_BOOTCMD_H + +#define BOOTENV_SHARED_BLKDEV_BODY(devtypel) \ + "if " #devtypel " dev ${devnum}; then " \ + "setenv devtype " #devtypel "; " \ + "run scan_dev_for_boot; " \ + "fi\0" + +#define BOOTENV_SHARED_BLKDEV(devtypel) \ + #devtypel "_boot=" \ + BOOTENV_SHARED_BLKDEV_BODY(devtypel) + +#define BOOTENV_DEV_BLKDEV(devtypeu, devtypel, instance) \ + "bootcmd_" #devtypel #instance "=" \ + "setenv devnum " #instance "; " \ + "run " #devtypel "_boot\0" + +#define BOOTENV_DEV_NAME_BLKDEV(devtypeu, devtypel, instance) \ + #devtypel #instance " " + +#ifdef CONFIG_CMD_MMC +#define BOOTENV_SHARED_MMC BOOTENV_SHARED_BLKDEV(mmc) +#define BOOTENV_DEV_MMC BOOTENV_DEV_BLKDEV +#define BOOTENV_DEV_NAME_MMC BOOTENV_DEV_NAME_BLKDEV +#else +#define BOOTENV_SHARED_MMC +#define BOOTENV_DEV_MMC \ + BOOT_TARGET_DEVICES_references_MMC_without_CONFIG_CMD_MMC +#define BOOTENV_DEV_NAME_MMC \ + BOOT_TARGET_DEVICES_references_MMC_without_CONFIG_CMD_MMC +#endif + +#ifdef CONFIG_CMD_SATA +#define BOOTENV_SHARED_SATA BOOTENV_SHARED_BLKDEV(sata) +#define BOOTENV_DEV_SATA BOOTENV_DEV_BLKDEV +#define BOOTENV_DEV_NAME_SATA BOOTENV_DEV_NAME_BLKDEV +#else +#define BOOTENV_SHARED_SATA +#define BOOTENV_DEV_SATA \ + BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_CMD_SATA +#define BOOTENV_DEV_NAME_SATA \ + BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_CMD_SATA +#endif + +#ifdef CONFIG_CMD_SCSI +#define BOOTENV_SHARED_SCSI BOOTENV_SHARED_BLKDEV(scsi) +#define BOOTENV_DEV_SCSI BOOTENV_DEV_BLKDEV +#define BOOTENV_DEV_NAME_SCSI BOOTENV_DEV_NAME_BLKDEV +#else +#define BOOTENV_SHARED_SCSI +#define BOOTENV_DEV_SCSI \ + BOOT_TARGET_DEVICES_references_SCSI_without_CONFIG_CMD_SCSI +#define BOOTENV_DEV_NAME_SCSI \ + BOOT_TARGET_DEVICES_references_SCSI_without_CONFIG_CMD_SCSI +#endif + +#ifdef CONFIG_CMD_IDE +#define BOOTENV_SHARED_IDE BOOTENV_SHARED_BLKDEV(ide) +#define BOOTENV_DEV_IDE BOOTENV_DEV_BLKDEV +#define BOOTENV_DEV_NAME_IDE BOOTENV_DEV_NAME_BLKDEV +#else +#define BOOTENV_SHARED_IDE +#define BOOTENV_DEV_IDE \ + BOOT_TARGET_DEVICES_references_IDE_without_CONFIG_CMD_IDE +#define BOOTENV_DEV_NAME_IDE \ + BOOT_TARGET_DEVICES_references_IDE_without_CONFIG_CMD_IDE +#endif + +#ifdef CONFIG_CMD_USB +#define BOOTENV_RUN_USB_INIT "run usb_init; " +#define BOOTENV_SET_USB_NEED_INIT "setenv usb_need_init; " +#define BOOTENV_SHARED_USB \ + "usb_init=" \ + "if ${usb_need_init}; then " \ + "setenv usb_need_init false; " \ + "usb start 0; " \ + "fi\0" \ + \ + "usb_boot=" \ + BOOTENV_RUN_USB_INIT \ + BOOTENV_SHARED_BLKDEV_BODY(usb) +#define BOOTENV_DEV_USB BOOTENV_DEV_BLKDEV +#define BOOTENV_DEV_NAME_USB BOOTENV_DEV_NAME_BLKDEV +#else +#define BOOTENV_RUN_USB_INIT +#define BOOTENV_SET_USB_NEED_INIT +#define BOOTENV_SHARED_USB +#define BOOTENV_DEV_USB \ + BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB +#define BOOTENV_DEV_NAME_USB \ + BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB +#endif + +#if defined(CONFIG_CMD_DHCP) +#define BOOTENV_DEV_DHCP(devtypeu, devtypel, instance) \ + "bootcmd_dhcp=" \ + BOOTENV_RUN_USB_INIT \ + "if dhcp ${scriptaddr} boot.scr.uimg; then " \ + "source ${scriptaddr}; " \ + "fi\0" +#define BOOTENV_DEV_NAME_DHCP(devtypeu, devtypel, instance) \ + "dhcp " +#else +#define BOOTENV_DEV_DHCP \ + BOOT_TARGET_DEVICES_references_DHCP_without_CONFIG_CMD_DHCP +#define BOOTENV_DEV_NAME_DHCP \ + BOOT_TARGET_DEVICES_references_DHCP_without_CONFIG_CMD_DHCP +#endif + +#if defined(CONFIG_CMD_DHCP) && defined(CONFIG_CMD_PXE) +#define BOOTENV_DEV_PXE(devtypeu, devtypel, instance) \ + "bootcmd_pxe=" \ + BOOTENV_RUN_USB_INIT \ + "dhcp; " \ + "if pxe get; then " \ + "pxe boot; " \ + "fi\0" +#define BOOTENV_DEV_NAME_PXE(devtypeu, devtypel, instance) \ + "pxe " +#else +#define BOOTENV_DEV_PXE \ + BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE +#define BOOTENV_DEV_NAME_PXE \ + BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE +#endif + +#define BOOTENV_DEV_NAME(devtypeu, devtypel, instance) \ + BOOTENV_DEV_NAME_##devtypeu(devtypeu, devtypel, instance) +#define BOOTENV_BOOT_TARGETS \ + "boot_targets=" BOOT_TARGET_DEVICES(BOOTENV_DEV_NAME) "\0" + +#define BOOTENV_DEV(devtypeu, devtypel, instance) \ + BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance) +#define BOOTENV \ + BOOTENV_SHARED_MMC \ + BOOTENV_SHARED_USB \ + BOOTENV_SHARED_SATA \ + BOOTENV_SHARED_SCSI \ + BOOTENV_SHARED_IDE \ + "boot_prefixes=/ /boot/\0" \ + "boot_scripts=boot.scr.uimg boot.scr\0" \ + BOOTENV_BOOT_TARGETS \ + "bootpart=1\0" \ + \ + "boot_extlinux=" \ + "sysboot ${devtype} ${devnum}:${bootpart} any " \ + "${scriptaddr} ${prefix}extlinux/extlinux.conf\0" \ + \ + "scan_dev_for_extlinux=" \ + "if test -e ${devtype} ${devnum}:${bootpart} " \ + "${prefix}extlinux/extlinux.conf; then " \ + "echo Found ${prefix}extlinux/extlinux.conf; " \ + "run boot_extlinux; " \ + "echo SCRIPT FAILED: continuing...; " \ + "fi\0" \ + \ + "boot_a_script=" \ + "load ${devtype} ${devnum}:${bootpart} " \ + "${scriptaddr} ${prefix}${script}; " \ + "source ${scriptaddr}\0" \ + \ + "scan_dev_for_scripts=" \ + "for script in ${boot_scripts}; do " \ + "if test -e ${devtype} ${devnum}:${bootpart} " \ + "${prefix}${script}; then " \ + "echo Found U-Boot script " \ + "${prefix}${script}; " \ + "run boot_a_script; " \ + "echo SCRIPT FAILED: continuing...; " \ + "fi; " \ + "done\0" \ + \ + "scan_dev_for_boot=" \ + "echo Scanning ${devtype} ${devnum}...; " \ + "for prefix in ${boot_prefixes}; do " \ + "run scan_dev_for_extlinux; " \ + "run scan_dev_for_scripts; " \ + "done\0" \ + \ + BOOT_TARGET_DEVICES(BOOTENV_DEV) \ + \ + "bootcmd=" BOOTENV_SET_USB_NEED_INIT \ + "for target in ${boot_targets}; do " \ + "run bootcmd_${target}; " \ + "done\0" + +#endif /* _CONFIG_CMD_DISTRO_BOOTCMD_H */ -- cgit v1.1 From 2ec3a612f440364fa0ed250f22e7d3c3a8d72b92 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 31 Jul 2014 23:04:45 +0200 Subject: sunxi-common.h: Use new generic $bootcmd Use the new standard bootcmd from . Signed-off-by: Hans de Goede Acked-by: Stephen Warren --- include/configs/sunxi-common.h | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 4c712f3..9bfc4ee 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -123,9 +123,6 @@ #define CONFIG_ENV_OFFSET (544 << 10) /* (8 + 24 + 512) KiB */ #define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB */ -#define CONFIG_EXTRA_ENV_SETTINGS \ - "bootm_size=0x10000000\0" - #include #undef CONFIG_CMD_FPGA @@ -219,6 +216,28 @@ #ifndef CONFIG_SPL_BUILD #include + +#ifdef CONFIG_AHCI +#define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0) +#else +#define BOOT_TARGET_DEVICES_SCSI(func) +#endif + +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 0) \ + BOOT_TARGET_DEVICES_SCSI(func) \ + func(USB, usb, 0) \ + func(PXE, pxe, na) \ + func(DHCP, dhcp, na) + +#include + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "bootm_size=0x10000000\0" \ + BOOTENV + +#else /* ifndef CONFIG_SPL_BUILD */ +#define CONFIG_EXTRA_ENV_SETTINGS #endif #endif /* _SUNXI_COMMON_CONFIG_H */ -- cgit v1.1 From 846e325448ed591c4a5e8db55e2817b0ca013b0b Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 1 Aug 2014 09:37:58 +0200 Subject: sunxi: Add environment settings to make extlinux.conf booting work Automatic booting using an extlinux.conf file requires various environment variables to be set. Also modify CONFIG_SYS_LOAD_ADDR and CONFIG_STANDALONE_LOAD_ADDR to match the value chosen for kernel_addr_r, see the added comment for why the new value is chosen. Signed-off-by: Hans de Goede Acked-by: Stephen Warren --- include/configs/sunxi-common.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 9bfc4ee..e768921 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -100,10 +100,10 @@ /* Boot Argument Buffer Size */ #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE -#define CONFIG_SYS_LOAD_ADDR 0x48000000 /* default load address */ +#define CONFIG_SYS_LOAD_ADDR 0x42000000 /* default load address */ /* standalone support */ -#define CONFIG_STANDALONE_LOAD_ADDR 0x48000000 +#define CONFIG_STANDALONE_LOAD_ADDR 0x42000000 #define CONFIG_SYS_HZ 1000 @@ -217,6 +217,16 @@ #ifndef CONFIG_SPL_BUILD #include +/* 256M RAM (minimum), 32M uncompressed kernel, 16M compressed kernel, 1M fdt, + * 1M script, 1M pxe and the ramdisk at the end */ +#define MEM_LAYOUT_ENV_SETTINGS \ + "bootm_size=0x10000000\0" \ + "kernel_addr_r=0x42000000\0" \ + "fdt_addr_r=0x43000000\0" \ + "scriptaddr=0x43100000\0" \ + "pxefile_addr_r=0x43200000\0" \ + "ramdisk_addr_r=0x43300000\0" + #ifdef CONFIG_AHCI #define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0) #else @@ -233,7 +243,9 @@ #include #define CONFIG_EXTRA_ENV_SETTINGS \ - "bootm_size=0x10000000\0" \ + MEM_LAYOUT_ENV_SETTINGS \ + "fdtfile=" CONFIG_FTDFILE "\0" \ + "console=ttyS0,115200\0" \ BOOTENV #else /* ifndef CONFIG_SPL_BUILD */ -- cgit v1.1