[v3,7/8] riscv: nx25: Enable distro boot

Message ID 20180423055950.78818-8-agraf@suse.de
State Accepted
Commit 0979f7ce1eea73c80e6f858a803106660507d1e3
Headers show
Series
  • riscv: Enable efi_loader support
Related show

Commit Message

Alexander Graf April 23, 2018, 5:59 a.m.
Distro boot allows for a common boot path on systems that allow distributions
to easily boot from a default configuration.

This patch enables distro boot for the nx25-ae250. Hopefully this can serve
as a good example for new boards, so they enable it as well.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 configs/nx25-ae250_defconfig |  1 +
 include/configs/nx25-ae250.h | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)

Comments

rick@andestech.com April 24, 2018, 6:28 a.m. | #1
> -----Original Message-----

> From: Alexander Graf [mailto:agraf@suse.de]

> Sent: Monday, April 23, 2018 2:00 PM

> To: u-boot@lists.denx.de

> Cc: Rick Jian-Zhi Chen(陳建志); Greentime Hu; Philipp Tomsich; Heinrich

> Schuchardt; schwab@suse.de

> Subject: [PATCH v3 7/8] riscv: nx25: Enable distro boot

>

> Distro boot allows for a common boot path on systems that allow distributions to

> easily boot from a default configuration.

>

> This patch enables distro boot for the nx25-ae250. Hopefully this can serve as a

> good example for new boards, so they enable it as well.

>

> Signed-off-by: Alexander Graf <agraf@suse.de>

> ---

>  configs/nx25-ae250_defconfig |  1 +

>  include/configs/nx25-ae250.h | 17 +++++++++++++++++

>  2 files changed, 18 insertions(+)

>

> diff --git a/configs/nx25-ae250_defconfig b/configs/nx25-ae250_defconfig index

> 4f9bd58f75..437083231b 100644

> --- a/configs/nx25-ae250_defconfig

> +++ b/configs/nx25-ae250_defconfig

> @@ -37,3 +37,4 @@ CONFIG_DM_SPI=y

>  CONFIG_ATCSPI200_SPI=y

>  CONFIG_TIMER=y

>  CONFIG_ATCPIT100_TIMER=y

> +CONFIG_DISTRO_DEFAULTS=y

> diff --git a/include/configs/nx25-ae250.h b/include/configs/nx25-ae250.h index

> 0e4c431cab..a90c75abc4 100644

> --- a/include/configs/nx25-ae250.h

> +++ b/include/configs/nx25-ae250.h

> @@ -105,4 +105,21 @@

>  /* Increase max gunzip size */

>  #define CONFIG_SYS_BOOTM_LEN (64 << 20)

>

> +/* When we use RAM as ENV */

> +#define CONFIG_ENV_SIZE 0x2000

> +

> +/* Enable distro boot */

> +#define BOOT_TARGET_DEVICES(func) \

> +     func(MMC, mmc, 0) \

> +     func(DHCP, dhcp, na)

> +#include <config_distro_bootcmd.h>

> +

> +#define CONFIG_EXTRA_ENV_SETTINGS    \

> +                             "kernel_addr_r=0x00080000\0" \

> +                             "pxefile_addr_r=0x01f00000\0" \

> +                             "scriptaddr=0x01f00000\0" \

> +                             "fdt_addr_r=0x02000000\0" \

> +                             "ramdisk_addr_r=0x02800000\0" \

> +                             BOOTENV

> +


Hi Alexander

This default env setting seem try to load something(maybe script, or kernel and dtb ?) from mmc and tftpserver
But I do not know how to prepare this script or image.

I am not sure if the understanding is correct ?
Can you explain it ?

Thank you

Rick :)

>  #endif /* __CONFIG_H */

> --

> 2.12.3


CONFIDENTIALITY NOTICE:

This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation.

Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.
Alexander Graf April 24, 2018, 7:53 a.m. | #2
On 04/24/2018 08:28 AM, rick@andestech.com wrote:
>
>> -----Original Message-----
>> From: Alexander Graf [mailto:agraf@suse.de]
>> Sent: Monday, April 23, 2018 2:00 PM
>> To: u-boot@lists.denx.de
>> Cc: Rick Jian-Zhi Chen(陳建志); Greentime Hu; Philipp Tomsich; Heinrich
>> Schuchardt; schwab@suse.de
>> Subject: [PATCH v3 7/8] riscv: nx25: Enable distro boot
>>
>> Distro boot allows for a common boot path on systems that allow distributions to
>> easily boot from a default configuration.
>>
>> This patch enables distro boot for the nx25-ae250. Hopefully this can serve as a
>> good example for new boards, so they enable it as well.
>>
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> ---
>>   configs/nx25-ae250_defconfig |  1 +
>>   include/configs/nx25-ae250.h | 17 +++++++++++++++++
>>   2 files changed, 18 insertions(+)
>>
>> diff --git a/configs/nx25-ae250_defconfig b/configs/nx25-ae250_defconfig index
>> 4f9bd58f75..437083231b 100644
>> --- a/configs/nx25-ae250_defconfig
>> +++ b/configs/nx25-ae250_defconfig
>> @@ -37,3 +37,4 @@ CONFIG_DM_SPI=y
>>   CONFIG_ATCSPI200_SPI=y
>>   CONFIG_TIMER=y
>>   CONFIG_ATCPIT100_TIMER=y
>> +CONFIG_DISTRO_DEFAULTS=y
>> diff --git a/include/configs/nx25-ae250.h b/include/configs/nx25-ae250.h index
>> 0e4c431cab..a90c75abc4 100644
>> --- a/include/configs/nx25-ae250.h
>> +++ b/include/configs/nx25-ae250.h
>> @@ -105,4 +105,21 @@
>>   /* Increase max gunzip size */
>>   #define CONFIG_SYS_BOOTM_LEN (64 << 20)
>>
>> +/* When we use RAM as ENV */
>> +#define CONFIG_ENV_SIZE 0x2000
>> +
>> +/* Enable distro boot */
>> +#define BOOT_TARGET_DEVICES(func) \
>> +     func(MMC, mmc, 0) \
>> +     func(DHCP, dhcp, na)
>> +#include <config_distro_bootcmd.h>
>> +
>> +#define CONFIG_EXTRA_ENV_SETTINGS    \
>> +                             "kernel_addr_r=0x00080000\0" \
>> +                             "pxefile_addr_r=0x01f00000\0" \
>> +                             "scriptaddr=0x01f00000\0" \
>> +                             "fdt_addr_r=0x02000000\0" \
>> +                             "ramdisk_addr_r=0x02800000\0" \
>> +                             BOOTENV
>> +
> Hi Alexander
>
> This default env setting seem try to load something(maybe script, or kernel and dtb ?) from mmc and tftpserver
> But I do not know how to prepare this script or image.
>
> I am not sure if the understanding is correct ?
> Can you explain it ?

The distro boot script logic is described quite nicely here:

   https://github.com/u-boot/u-boot/blob/master/doc/README.distro

I personally only care about a subset of it though, which is the 
efi_loader loading logic:

   https://github.com/u-boot/u-boot/blob/master/doc/README.uefi

With distro boot enabled, the distro boot script will automatically 
search for a file called /efi/boot/bootriscv64.efi (or 32 respectively) 
and execute it as UEFI binary. The next step I need to get to still is 
to enable RISC-V UEFI support in grub. Once we have that, we can boot 
RISC-V systems like any other platform we support in openSUSE.


Alex
rick@andestech.com May 7, 2018, 2:33 a.m. | #3
> -----Original Message-----

> From: Alexander Graf [mailto:agraf@suse.de]

> Sent: Monday, April 23, 2018 2:00 PM

> To: u-boot@lists.denx.de

> Cc: Rick Jian-Zhi Chen(陳建志); Greentime Hu; Philipp Tomsich; Heinrich

> Schuchardt; schwab@suse.de

> Subject: [PATCH v3 7/8] riscv: nx25: Enable distro boot

>

> Distro boot allows for a common boot path on systems that allow distributions to

> easily boot from a default configuration.

>

> This patch enables distro boot for the nx25-ae250. Hopefully this can serve as a

> good example for new boards, so they enable it as well.

>

> Signed-off-by: Alexander Graf <agraf@suse.de>

> ---

>  configs/nx25-ae250_defconfig |  1 +

>  include/configs/nx25-ae250.h | 17 +++++++++++++++++

>  2 files changed, 18 insertions(+)

>

> diff --git a/configs/nx25-ae250_defconfig b/configs/nx25-ae250_defconfig index

> 4f9bd58f75..437083231b 100644

> --- a/configs/nx25-ae250_defconfig

> +++ b/configs/nx25-ae250_defconfig

> @@ -37,3 +37,4 @@ CONFIG_DM_SPI=y

>  CONFIG_ATCSPI200_SPI=y

>  CONFIG_TIMER=y

>  CONFIG_ATCPIT100_TIMER=y

> +CONFIG_DISTRO_DEFAULTS=y

> diff --git a/include/configs/nx25-ae250.h b/include/configs/nx25-ae250.h index

> 0e4c431cab..a90c75abc4 100644

> --- a/include/configs/nx25-ae250.h

> +++ b/include/configs/nx25-ae250.h

> @@ -105,4 +105,21 @@

>  /* Increase max gunzip size */

>  #define CONFIG_SYS_BOOTM_LEN (64 << 20)

>

> +/* When we use RAM as ENV */

> +#define CONFIG_ENV_SIZE 0x2000

> +

> +/* Enable distro boot */

> +#define BOOT_TARGET_DEVICES(func) \

> +     func(MMC, mmc, 0) \

> +     func(DHCP, dhcp, na)

> +#include <config_distro_bootcmd.h>

> +

> +#define CONFIG_EXTRA_ENV_SETTINGS    \

> +                             "kernel_addr_r=0x00080000\0" \

> +                             "pxefile_addr_r=0x01f00000\0" \

> +                             "scriptaddr=0x01f00000\0" \

> +                             "fdt_addr_r=0x02000000\0" \

> +                             "ramdisk_addr_r=0x02800000\0" \

> +                             BOOTENV

> +


Maybe Add #ifdef CONFIG_DISTRO_DEFAULTS to encapsulate the CONFIG_EXTRA_ENV_SETTINGS can disable auto boot easily.

Reviewed-by: Rick Chen <rick@andestech.com>


>  #endif /* __CONFIG_H */

> --

> 2.12.3


CONFIDENTIALITY NOTICE:

This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation.

Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.

Patch

diff --git a/configs/nx25-ae250_defconfig b/configs/nx25-ae250_defconfig
index 4f9bd58f75..437083231b 100644
--- a/configs/nx25-ae250_defconfig
+++ b/configs/nx25-ae250_defconfig
@@ -37,3 +37,4 @@  CONFIG_DM_SPI=y
 CONFIG_ATCSPI200_SPI=y
 CONFIG_TIMER=y
 CONFIG_ATCPIT100_TIMER=y
+CONFIG_DISTRO_DEFAULTS=y
diff --git a/include/configs/nx25-ae250.h b/include/configs/nx25-ae250.h
index 0e4c431cab..a90c75abc4 100644
--- a/include/configs/nx25-ae250.h
+++ b/include/configs/nx25-ae250.h
@@ -105,4 +105,21 @@ 
 /* Increase max gunzip size */
 #define CONFIG_SYS_BOOTM_LEN	(64 << 20)
 
+/* When we use RAM as ENV */
+#define CONFIG_ENV_SIZE 0x2000
+
+/* Enable distro boot */
+#define BOOT_TARGET_DEVICES(func) \
+	func(MMC, mmc, 0) \
+	func(DHCP, dhcp, na)
+#include <config_distro_bootcmd.h>
+
+#define CONFIG_EXTRA_ENV_SETTINGS	\
+				"kernel_addr_r=0x00080000\0" \
+				"pxefile_addr_r=0x01f00000\0" \
+				"scriptaddr=0x01f00000\0" \
+				"fdt_addr_r=0x02000000\0" \
+				"ramdisk_addr_r=0x02800000\0" \
+				BOOTENV
+
 #endif /* __CONFIG_H */