diff mbox

[U-Boot,1/8] arm: socfpga: Add distro boot to socfpga common header

Message ID 1487451108-4277-2-git-send-email-dwesterg@gmail.com
State Superseded
Delegated to: Marek Vasut
Headers show

Commit Message

Dalon Westergreen Feb. 18, 2017, 8:51 p.m. UTC
This adds a common environment and support for distro boot
in the common socfpga header.

Signed-off-by: Dalon Westergreen <dwesterg@gmail.com>
---
 include/configs/socfpga_common.h | 55 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 51 insertions(+), 4 deletions(-)

Comments

Marek Vasut Feb. 18, 2017, 9:01 p.m. UTC | #1
On 02/18/2017 09:51 PM, Dalon Westergreen wrote:
> This adds a common environment and support for distro boot
> in the common socfpga header.
> 
> Signed-off-by: Dalon Westergreen <dwesterg@gmail.com>
> ---
>  include/configs/socfpga_common.h | 55 +++++++++++++++++++++++++++++++++++++---
>  1 file changed, 51 insertions(+), 4 deletions(-)
> 
> diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
> index 582b04a..2b8be8f 100644
> --- a/include/configs/socfpga_common.h
> +++ b/include/configs/socfpga_common.h
> @@ -67,6 +67,9 @@
>  #define CONFIG_SYS_HOSTNAME	CONFIG_SYS_BOARD
>  #endif
>  
> +#define CONFIG_CMD_PXE
> +#define CONFIG_MENU
> +
>  /*
>   * Cache
>   */
> @@ -245,13 +248,13 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
>   * U-Boot environment
>   */
>  #if !defined(CONFIG_ENV_SIZE)
> -#define CONFIG_ENV_SIZE			4096
> +#define CONFIG_ENV_SIZE			(8*1024)
>  #endif
>  
>  /* Environment for SDMMC boot */
>  #if defined(CONFIG_ENV_IS_IN_MMC) && !defined(CONFIG_ENV_OFFSET)
> -#define CONFIG_SYS_MMC_ENV_DEV		0	/* device 0 */
> -#define CONFIG_ENV_OFFSET		512	/* just after the MBR */
> +#define CONFIG_SYS_MMC_ENV_DEV		0		/* device 0 */
> +#define CONFIG_ENV_OFFSET		(34*512)/* just after the GPT */

Space around the asterisk . Btw this probably broke some existing
configurations ...

>  #endif
>  
>  /* Environment for QSPI boot */
> @@ -308,8 +311,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
>  /* SPL SDMMC boot support */
>  #ifdef CONFIG_SPL_MMC_SUPPORT
>  #if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
> -#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	2
>  #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME		"u-boot-dtb.img"
> +#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
> +#endif
> +#else
> +#ifndef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
> +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION	1
>  #endif
>  #endif
>  
> @@ -331,4 +338,44 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
>   */
>  #define CONFIG_SPL_STACK		CONFIG_SYS_INIT_SP_ADDR
>  
> +/* Extra Environment */
> +#ifndef CONFIG_SPL_BUILD
> +#include <config_distro_defaults.h>
> +
> +#ifdef CONFIG_CMD_PXE
> +#define BOOT_TARGET_DEVICES_PXE(func) func(PXE, pxe, na)
> +#else
> +#define BOOT_TARGET_DEVICES_PXE(func)
> +#endif
> +
> +#ifdef CONFIG_CMD_MMC
> +#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)
> +#else
> +#define BOOT_TARGET_DEVICES_MMC(func)
> +#endif
> +
> +#define BOOT_TARGET_DEVICES(func) \
> +	BOOT_TARGET_DEVICES_MMC(func) \
> +	BOOT_TARGET_DEVICES_PXE(func) \
> +	func(DHCP, dhcp, na)
> +
> +#include <config_distro_bootcmd.h>
> +
> +#ifndef CONFIG_EXTRA_ENV_SETTINGS
> +#define CONFIG_EXTRA_ENV_SETTINGS \
> +	"verify=n\0" \

Is this needed ?

> +	"bootimage=" CONFIG_BOOTFILE "\0" \
> +	"fdt_addr=100\0" \

Move this to like 0x200000 at least.

> +	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
> +	"bootm_size=0xa000000\0" \
> +	"kernel_addr_r="__stringify(CONFIG_SYS_LOAD_ADDR)"\0" \
> +	"fdt_addr_r=0x02000000\0" \

Hmmmm , what's the relationship between this and fdt_addr ?

> +	"scriptaddr=0x02100000\0" \
> +	"pxefile_addr_r=0x02200000\0" \
> +	"ramdisk_addr_r=0x02300000\0" \
> +	BOOTENV
> +
> +#endif
> +#endif
> +
>  #endif	/* __CONFIG_SOCFPGA_COMMON_H__ */
>
Dalon Westergreen Feb. 18, 2017, 11:29 p.m. UTC | #2
On Sat, 2017-02-18 at 22:01 +0100, Marek Vasut wrote:
> On 02/18/2017 09:51 PM, Dalon Westergreen wrote:
> > 
> > This adds a common environment and support for distro boot
> > in the common socfpga header.
> > 
> > Signed-off-by: Dalon Westergreen <dwesterg@gmail.com>
> > ---
> >  include/configs/socfpga_common.h | 55
> > +++++++++++++++++++++++++++++++++++++---
> >  1 file changed, 51 insertions(+), 4 deletions(-)
> > 
> > diff --git a/include/configs/socfpga_common.h
> > b/include/configs/socfpga_common.h
> > index 582b04a..2b8be8f 100644
> > --- a/include/configs/socfpga_common.h
> > +++ b/include/configs/socfpga_common.h
> > @@ -67,6 +67,9 @@
> >  #define CONFIG_SYS_HOSTNAME	CONFIG_SYS_BOARD
> >  #endif
> >  
> > +#define CONFIG_CMD_PXE
> > +#define CONFIG_MENU
> > +
> >  /*
> >   * Cache
> >   */
> > @@ -245,13 +248,13 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
> >   * U-Boot environment
> >   */
> >  #if !defined(CONFIG_ENV_SIZE)
> > -#define CONFIG_ENV_SIZE			4096
> > +#define CONFIG_ENV_SIZE			(8*1024)
> >  #endif
> >  
> >  /* Environment for SDMMC boot */
> >  #if defined(CONFIG_ENV_IS_IN_MMC) && !defined(CONFIG_ENV_OFFSET)
> > -#define CONFIG_SYS_MMC_ENV_DEV		0	/* device 0 */
> > -#define CONFIG_ENV_OFFSET		512	/* just after the MBR
> > */
> > +#define CONFIG_SYS_MMC_ENV_DEV		0		/* device 0
> > */
> > +#define CONFIG_ENV_OFFSET		(34*512)/* just after the GPT */
> 
> Space around the asterisk . Btw this probably broke some existing
> configurations ...

It may, but it is unavoidable as the env needs to be larger for
distro boot.

> 
> > 
> >  #endif
> >  
> >  /* Environment for QSPI boot */
> > @@ -308,8 +311,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
> >  /* SPL SDMMC boot support */
> >  #ifdef CONFIG_SPL_MMC_SUPPORT
> >  #if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
> > -#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	2
> >  #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME		"u-boot-dtb.img"
> > +#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
> > +#endif
> > +#else
> > +#ifndef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
> > +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION	1
> >  #endif
> >  #endif
> >  
> > @@ -331,4 +338,44 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
> >   */
> >  #define CONFIG_SPL_STACK		CONFIG_SYS_INIT_SP_ADDR
> >  
> > +/* Extra Environment */
> > +#ifndef CONFIG_SPL_BUILD
> > +#include <config_distro_defaults.h>
> > +
> > +#ifdef CONFIG_CMD_PXE
> > +#define BOOT_TARGET_DEVICES_PXE(func) func(PXE, pxe, na)
> > +#else
> > +#define BOOT_TARGET_DEVICES_PXE(func)
> > +#endif
> > +
> > +#ifdef CONFIG_CMD_MMC
> > +#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)
> > +#else
> > +#define BOOT_TARGET_DEVICES_MMC(func)
> > +#endif
> > +
> > +#define BOOT_TARGET_DEVICES(func) \
> > +	BOOT_TARGET_DEVICES_MMC(func) \
> > +	BOOT_TARGET_DEVICES_PXE(func) \
> > +	func(DHCP, dhcp, na)
> > +
> > +#include <config_distro_bootcmd.h>
> > +
> > +#ifndef CONFIG_EXTRA_ENV_SETTINGS
> > +#define CONFIG_EXTRA_ENV_SETTINGS \
> > +	"verify=n\0" \
> 
> Is this needed ?
No
> 
> > 
> > +	"bootimage=" CONFIG_BOOTFILE "\0" \
> > +	"fdt_addr=100\0" \
> 
> Move this to like 0x200000 at least.
I think i will just remove it too, i dont believe it us used for
distro boot.
> 
> > 
> > +	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
> > +	"bootm_size=0xa000000\0" \
> > +	"kernel_addr_r="__stringify(CONFIG_SYS_LOAD_ADDR)"\0" \
> > +	"fdt_addr_r=0x02000000\0" \
> 
> Hmmmm , what's the relationship between this and fdt_addr ?

unrelated, as before i think it better just to remove fdt_addr

> > 
> > +	"scriptaddr=0x02100000\0" \
> > +	"pxefile_addr_r=0x02200000\0" \
> > +	"ramdisk_addr_r=0x02300000\0" \
> > +	BOOTENV
> > +
> > +#endif
> > +#endif
> > +
> >  #endif	/* __CONFIG_SOCFPGA_COMMON_H__ */
> > 
> 
> 

Thanks,
Dalon
Marek Vasut Feb. 19, 2017, 12:37 a.m. UTC | #3
On 02/19/2017 12:29 AM, Dalon Westergreen wrote:
> On Sat, 2017-02-18 at 22:01 +0100, Marek Vasut wrote:
>> On 02/18/2017 09:51 PM, Dalon Westergreen wrote:
>>>
>>> This adds a common environment and support for distro boot
>>> in the common socfpga header.
>>>
>>> Signed-off-by: Dalon Westergreen <dwesterg@gmail.com>
>>> ---
>>>  include/configs/socfpga_common.h | 55
>>> +++++++++++++++++++++++++++++++++++++---
>>>  1 file changed, 51 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/include/configs/socfpga_common.h
>>> b/include/configs/socfpga_common.h
>>> index 582b04a..2b8be8f 100644
>>> --- a/include/configs/socfpga_common.h
>>> +++ b/include/configs/socfpga_common.h
>>> @@ -67,6 +67,9 @@
>>>  #define CONFIG_SYS_HOSTNAME	CONFIG_SYS_BOARD
>>>  #endif
>>>  
>>> +#define CONFIG_CMD_PXE
>>> +#define CONFIG_MENU
>>> +
>>>  /*
>>>   * Cache
>>>   */
>>> @@ -245,13 +248,13 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
>>>   * U-Boot environment
>>>   */
>>>  #if !defined(CONFIG_ENV_SIZE)
>>> -#define CONFIG_ENV_SIZE			4096
>>> +#define CONFIG_ENV_SIZE			(8*1024)
>>>  #endif
>>>  
>>>  /* Environment for SDMMC boot */
>>>  #if defined(CONFIG_ENV_IS_IN_MMC) && !defined(CONFIG_ENV_OFFSET)
>>> -#define CONFIG_SYS_MMC_ENV_DEV		0	/* device 0 */
>>> -#define CONFIG_ENV_OFFSET		512	/* just after the MBR
>>> */
>>> +#define CONFIG_SYS_MMC_ENV_DEV		0		/* device 0
>>> */
>>> +#define CONFIG_ENV_OFFSET		(34*512)/* just after the GPT */
>>
>> Space around the asterisk . Btw this probably broke some existing
>> configurations ...
> 
> It may, but it is unavoidable as the env needs to be larger for
> distro boot.

I'm really not impressed ... sigh.

>>>
>>>  #endif
>>>  
>>>  /* Environment for QSPI boot */
>>> @@ -308,8 +311,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
>>>  /* SPL SDMMC boot support */
>>>  #ifdef CONFIG_SPL_MMC_SUPPORT
>>>  #if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
>>> -#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	2
>>>  #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME		"u-boot-dtb.img"
>>> +#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
>>> +#endif
>>> +#else
>>> +#ifndef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
>>> +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION	1
>>>  #endif
>>>  #endif
>>>  
>>> @@ -331,4 +338,44 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
>>>   */
>>>  #define CONFIG_SPL_STACK		CONFIG_SYS_INIT_SP_ADDR
>>>  
>>> +/* Extra Environment */
>>> +#ifndef CONFIG_SPL_BUILD
>>> +#include <config_distro_defaults.h>
>>> +
>>> +#ifdef CONFIG_CMD_PXE
>>> +#define BOOT_TARGET_DEVICES_PXE(func) func(PXE, pxe, na)
>>> +#else
>>> +#define BOOT_TARGET_DEVICES_PXE(func)
>>> +#endif
>>> +
>>> +#ifdef CONFIG_CMD_MMC
>>> +#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)
>>> +#else
>>> +#define BOOT_TARGET_DEVICES_MMC(func)
>>> +#endif
>>> +
>>> +#define BOOT_TARGET_DEVICES(func) \
>>> +	BOOT_TARGET_DEVICES_MMC(func) \
>>> +	BOOT_TARGET_DEVICES_PXE(func) \
>>> +	func(DHCP, dhcp, na)
>>> +
>>> +#include <config_distro_bootcmd.h>
>>> +
>>> +#ifndef CONFIG_EXTRA_ENV_SETTINGS
>>> +#define CONFIG_EXTRA_ENV_SETTINGS \
>>> +	"verify=n\0" \
>>
>> Is this needed ?
> No

OK

>>>
>>> +	"bootimage=" CONFIG_BOOTFILE "\0" \
>>> +	"fdt_addr=100\0" \
>>
>> Move this to like 0x200000 at least.
> I think i will just remove it too, i dont believe it us used for
> distro boot.

:)

>>>
>>> +	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
>>> +	"bootm_size=0xa000000\0" \
>>> +	"kernel_addr_r="__stringify(CONFIG_SYS_LOAD_ADDR)"\0" \
>>> +	"fdt_addr_r=0x02000000\0" \
>>
>> Hmmmm , what's the relationship between this and fdt_addr ?
> 
> unrelated, as before i think it better just to remove fdt_addr

Good

>>>
>>> +	"scriptaddr=0x02100000\0" \
>>> +	"pxefile_addr_r=0x02200000\0" \
>>> +	"ramdisk_addr_r=0x02300000\0" \
>>> +	BOOTENV
>>> +
>>> +#endif
>>> +#endif
>>> +
>>>  #endif	/* __CONFIG_SOCFPGA_COMMON_H__ */
>>>
>>
>>
> 
> Thanks,
> Dalon
>
Dalon Westergreen Feb. 19, 2017, 1:10 a.m. UTC | #4
On Sun, 2017-02-19 at 01:37 +0100, Marek Vasut wrote:
> On 02/19/2017 12:29 AM, Dalon Westergreen wrote:
> > 
> > On Sat, 2017-02-18 at 22:01 +0100, Marek Vasut wrote:
> > > 
> > > On 02/18/2017 09:51 PM, Dalon Westergreen wrote:
> > > > 
> > > > 
> > > > This adds a common environment and support for distro boot
> > > > in the common socfpga header.
> > > > 
> > > > Signed-off-by: Dalon Westergreen <dwesterg@gmail.com>
> > > > ---
> > > >  include/configs/socfpga_common.h | 55
> > > > +++++++++++++++++++++++++++++++++++++---
> > > >  1 file changed, 51 insertions(+), 4 deletions(-)
> > > > 
> > > > diff --git a/include/configs/socfpga_common.h
> > > > b/include/configs/socfpga_common.h
> > > > index 582b04a..2b8be8f 100644
> > > > --- a/include/configs/socfpga_common.h
> > > > +++ b/include/configs/socfpga_common.h
> > > > @@ -67,6 +67,9 @@
> > > >  #define CONFIG_SYS_HOSTNAME	CONFIG_SYS_BOARD
> > > >  #endif
> > > >  
> > > > +#define CONFIG_CMD_PXE
> > > > +#define CONFIG_MENU
> > > > +
> > > >  /*
> > > >   * Cache
> > > >   */
> > > > @@ -245,13 +248,13 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
> > > >   * U-Boot environment
> > > >   */
> > > >  #if !defined(CONFIG_ENV_SIZE)
> > > > -#define CONFIG_ENV_SIZE			4096
> > > > +#define CONFIG_ENV_SIZE			(8*1024)
> > > >  #endif
> > > >  
> > > >  /* Environment for SDMMC boot */
> > > >  #if defined(CONFIG_ENV_IS_IN_MMC) && !defined(CONFIG_ENV_OFFSET)
> > > > -#define CONFIG_SYS_MMC_ENV_DEV		0	/* device 0 */
> > > > -#define CONFIG_ENV_OFFSET		512	/* just after the
> > > > MBR
> > > > */
> > > > +#define CONFIG_SYS_MMC_ENV_DEV		0		/*
> > > > device 0
> > > > */
> > > > +#define CONFIG_ENV_OFFSET		(34*512)/* just after the GPT
> > > > */
> > > 
> > > Space around the asterisk . Btw this probably broke some existing
> > > configurations ...
> > 
> > It may, but it is unavoidable as the env needs to be larger for
> > distro boot.
> 
> I'm really not impressed ... sigh.

I actually dont believe this will cause much of an issue. the env is placed
immediately after the partition table.  I know this size fits between the
table and the typical location of the first partition without issue.

--dalon

> > 
> > > 
> > > > 
> > > > 
> > > >  #endif
> > > >  
> > > >  /* Environment for QSPI boot */
> > > > @@ -308,8 +311,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
> > > >  /* SPL SDMMC boot support */
> > > >  #ifdef CONFIG_SPL_MMC_SUPPORT
> > > >  #if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
> > > > -#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	2
> > > >  #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME		"u-boot-dtb.img"
> > > > +#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
> > > > +#endif
> > > > +#else
> > > > +#ifndef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
> > > > +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION	1
> > > >  #endif
> > > >  #endif
> > > >  
> > > > @@ -331,4 +338,44 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
> > > >   */
> > > >  #define CONFIG_SPL_STACK		CONFIG_SYS_INIT_SP_ADDR
> > > >  
> > > > +/* Extra Environment */
> > > > +#ifndef CONFIG_SPL_BUILD
> > > > +#include <config_distro_defaults.h>
> > > > +
> > > > +#ifdef CONFIG_CMD_PXE
> > > > +#define BOOT_TARGET_DEVICES_PXE(func) func(PXE, pxe, na)
> > > > +#else
> > > > +#define BOOT_TARGET_DEVICES_PXE(func)
> > > > +#endif
> > > > +
> > > > +#ifdef CONFIG_CMD_MMC
> > > > +#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)
> > > > +#else
> > > > +#define BOOT_TARGET_DEVICES_MMC(func)
> > > > +#endif
> > > > +
> > > > +#define BOOT_TARGET_DEVICES(func) \
> > > > +	BOOT_TARGET_DEVICES_MMC(func) \
> > > > +	BOOT_TARGET_DEVICES_PXE(func) \
> > > > +	func(DHCP, dhcp, na)
> > > > +
> > > > +#include <config_distro_bootcmd.h>
> > > > +
> > > > +#ifndef CONFIG_EXTRA_ENV_SETTINGS
> > > > +#define CONFIG_EXTRA_ENV_SETTINGS \
> > > > +	"verify=n\0" \
> > > 
> > > Is this needed ?
> > No
> 
> OK
> 
> > 
> > > 
> > > > 
> > > > 
> > > > +	"bootimage=" CONFIG_BOOTFILE "\0" \
> > > > +	"fdt_addr=100\0" \
> > > 
> > > Move this to like 0x200000 at least.
> > I think i will just remove it too, i dont believe it us used for
> > distro boot.
> 
> :)
> 
> > 
> > > 
> > > > 
> > > > 
> > > > +	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
> > > > +	"bootm_size=0xa000000\0" \
> > > > +	"kernel_addr_r="__stringify(CONFIG_SYS_LOAD_ADDR)"\0" \
> > > > +	"fdt_addr_r=0x02000000\0" \
> > > 
> > > Hmmmm , what's the relationship between this and fdt_addr ?
> > 
> > unrelated, as before i think it better just to remove fdt_addr
> 
> Good
> 
> > 
> > > 
> > > > 
> > > > 
> > > > +	"scriptaddr=0x02100000\0" \
> > > > +	"pxefile_addr_r=0x02200000\0" \
> > > > +	"ramdisk_addr_r=0x02300000\0" \
> > > > +	BOOTENV
> > > > +
> > > > +#endif
> > > > +#endif
> > > > +
> > > >  #endif	/* __CONFIG_SOCFPGA_COMMON_H__ */
> > > > 
> > > 
> > > 
> > 
> > Thanks,
> > Dalon
> > 
> 
>
Marek Vasut Feb. 19, 2017, 2:26 a.m. UTC | #5
On 02/19/2017 02:10 AM, Dalon Westergreen wrote:
> On Sun, 2017-02-19 at 01:37 +0100, Marek Vasut wrote:
>> On 02/19/2017 12:29 AM, Dalon Westergreen wrote:
>>>
>>> On Sat, 2017-02-18 at 22:01 +0100, Marek Vasut wrote:
>>>>
>>>> On 02/18/2017 09:51 PM, Dalon Westergreen wrote:
>>>>>
>>>>>
>>>>> This adds a common environment and support for distro boot
>>>>> in the common socfpga header.
>>>>>
>>>>> Signed-off-by: Dalon Westergreen <dwesterg@gmail.com>
>>>>> ---
>>>>>  include/configs/socfpga_common.h | 55
>>>>> +++++++++++++++++++++++++++++++++++++---
>>>>>  1 file changed, 51 insertions(+), 4 deletions(-)
>>>>>
>>>>> diff --git a/include/configs/socfpga_common.h
>>>>> b/include/configs/socfpga_common.h
>>>>> index 582b04a..2b8be8f 100644
>>>>> --- a/include/configs/socfpga_common.h
>>>>> +++ b/include/configs/socfpga_common.h
>>>>> @@ -67,6 +67,9 @@
>>>>>  #define CONFIG_SYS_HOSTNAME	CONFIG_SYS_BOARD
>>>>>  #endif
>>>>>  
>>>>> +#define CONFIG_CMD_PXE
>>>>> +#define CONFIG_MENU
>>>>> +
>>>>>  /*
>>>>>   * Cache
>>>>>   */
>>>>> @@ -245,13 +248,13 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
>>>>>   * U-Boot environment
>>>>>   */
>>>>>  #if !defined(CONFIG_ENV_SIZE)
>>>>> -#define CONFIG_ENV_SIZE			4096
>>>>> +#define CONFIG_ENV_SIZE			(8*1024)
>>>>>  #endif
>>>>>  
>>>>>  /* Environment for SDMMC boot */
>>>>>  #if defined(CONFIG_ENV_IS_IN_MMC) && !defined(CONFIG_ENV_OFFSET)
>>>>> -#define CONFIG_SYS_MMC_ENV_DEV		0	/* device 0 */
>>>>> -#define CONFIG_ENV_OFFSET		512	/* just after the
>>>>> MBR
>>>>> */
>>>>> +#define CONFIG_SYS_MMC_ENV_DEV		0		/*
>>>>> device 0
>>>>> */
>>>>> +#define CONFIG_ENV_OFFSET		(34*512)/* just after the GPT
>>>>> */
>>>>
>>>> Space around the asterisk . Btw this probably broke some existing
>>>> configurations ...
>>>
>>> It may, but it is unavoidable as the env needs to be larger for
>>> distro boot.
>>
>> I'm really not impressed ... sigh.
> 
> I actually dont believe this will cause much of an issue. the env is placed
> immediately after the partition table.  I know this size fits between the
> table and the typical location of the first partition without issue.
> 

My rant is more about breaking already running setups, but let's see if
someone actually complains.
Pavel Machek Feb. 19, 2017, 7:45 p.m. UTC | #6
Hi!

> > > > >  /* Environment for SDMMC boot */
> > > > >  #if defined(CONFIG_ENV_IS_IN_MMC) && !defined(CONFIG_ENV_OFFSET)
> > > > > -#define CONFIG_SYS_MMC_ENV_DEV		0	/* device 0 */
> > > > > -#define CONFIG_ENV_OFFSET		512	/* just after the
> > > > > MBR
> > > > > */
> > > > > +#define CONFIG_SYS_MMC_ENV_DEV		0		/*
> > > > > device 0
> > > > > */
> > > > > +#define CONFIG_ENV_OFFSET		(34*512)/* just after the GPT
> > > > > */
...
> I actually dont believe this will cause much of an issue. the env is placed
> immediately after the partition table.  I know this size fits between the
> table and the typical location of the first partition without issue.

Hmm. It is not immediately after partition table (==MBR), it is at
sector 34. Now, by changing size you already break the setups, so
moving it back to sector 1 does not help much, but can you explain?

									Pavel
Dalon Westergreen Feb. 19, 2017, 7:59 p.m. UTC | #7
On Sun, 2017-02-19 at 20:45 +0100, Pavel Machek wrote:
> Hi!
> 
> > 
> > > 
> > > > 
> > > > > 
> > > > > > 
> > > > > >  /* Environment for SDMMC boot */
> > > > > >  #if defined(CONFIG_ENV_IS_IN_MMC) && !defined(CONFIG_ENV_OFFSET)
> > > > > > -#define CONFIG_SYS_MMC_ENV_DEV		0	/* device 0
> > > > > > */
> > > > > > -#define CONFIG_ENV_OFFSET		512	/* just after
> > > > > > the
> > > > > > MBR
> > > > > > */
> > > > > > +#define CONFIG_SYS_MMC_ENV_DEV		0		/*
> > > > > > device 0
> > > > > > */
> > > > > > +#define CONFIG_ENV_OFFSET		(34*512)/* just after the
> > > > > > GPT
> > > > > > */
> ...
> > 
> > I actually dont believe this will cause much of an issue. the env is placed
> > immediately after the partition table.  I know this size fits between the
> > table and the typical location of the first partition without issue.
> 
> Hmm. It is not immediately after partition table (==MBR), it is at
> sector 34. Now, by changing size you already break the setups, so
> moving it back to sector 1 does not help much, but can you explain?

Sorry, you are right. Frank had moved it after the GPT in his patchset and i
had just copied that.  i will update this to be immediately after the mbr as
it was before.

--dalon

> 
> 									Pavel
diff mbox

Patch

diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
index 582b04a..2b8be8f 100644
--- a/include/configs/socfpga_common.h
+++ b/include/configs/socfpga_common.h
@@ -67,6 +67,9 @@ 
 #define CONFIG_SYS_HOSTNAME	CONFIG_SYS_BOARD
 #endif
 
+#define CONFIG_CMD_PXE
+#define CONFIG_MENU
+
 /*
  * Cache
  */
@@ -245,13 +248,13 @@  unsigned int cm_get_qspi_controller_clk_hz(void);
  * U-Boot environment
  */
 #if !defined(CONFIG_ENV_SIZE)
-#define CONFIG_ENV_SIZE			4096
+#define CONFIG_ENV_SIZE			(8*1024)
 #endif
 
 /* Environment for SDMMC boot */
 #if defined(CONFIG_ENV_IS_IN_MMC) && !defined(CONFIG_ENV_OFFSET)
-#define CONFIG_SYS_MMC_ENV_DEV		0	/* device 0 */
-#define CONFIG_ENV_OFFSET		512	/* just after the MBR */
+#define CONFIG_SYS_MMC_ENV_DEV		0		/* device 0 */
+#define CONFIG_ENV_OFFSET		(34*512)/* just after the GPT */
 #endif
 
 /* Environment for QSPI boot */
@@ -308,8 +311,12 @@  unsigned int cm_get_qspi_controller_clk_hz(void);
 /* SPL SDMMC boot support */
 #ifdef CONFIG_SPL_MMC_SUPPORT
 #if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
-#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	2
 #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME		"u-boot-dtb.img"
+#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
+#endif
+#else
+#ifndef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION	1
 #endif
 #endif
 
@@ -331,4 +338,44 @@  unsigned int cm_get_qspi_controller_clk_hz(void);
  */
 #define CONFIG_SPL_STACK		CONFIG_SYS_INIT_SP_ADDR
 
+/* Extra Environment */
+#ifndef CONFIG_SPL_BUILD
+#include <config_distro_defaults.h>
+
+#ifdef CONFIG_CMD_PXE
+#define BOOT_TARGET_DEVICES_PXE(func) func(PXE, pxe, na)
+#else
+#define BOOT_TARGET_DEVICES_PXE(func)
+#endif
+
+#ifdef CONFIG_CMD_MMC
+#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)
+#else
+#define BOOT_TARGET_DEVICES_MMC(func)
+#endif
+
+#define BOOT_TARGET_DEVICES(func) \
+	BOOT_TARGET_DEVICES_MMC(func) \
+	BOOT_TARGET_DEVICES_PXE(func) \
+	func(DHCP, dhcp, na)
+
+#include <config_distro_bootcmd.h>
+
+#ifndef CONFIG_EXTRA_ENV_SETTINGS
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	"verify=n\0" \
+	"bootimage=" CONFIG_BOOTFILE "\0" \
+	"fdt_addr=100\0" \
+	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
+	"bootm_size=0xa000000\0" \
+	"kernel_addr_r="__stringify(CONFIG_SYS_LOAD_ADDR)"\0" \
+	"fdt_addr_r=0x02000000\0" \
+	"scriptaddr=0x02100000\0" \
+	"pxefile_addr_r=0x02200000\0" \
+	"ramdisk_addr_r=0x02300000\0" \
+	BOOTENV
+
+#endif
+#endif
+
 #endif	/* __CONFIG_SOCFPGA_COMMON_H__ */