public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [RFC PATCH] qemu-x86: Use config_distro_bootcmd
@ 2019-06-21 15:16 Joshua Watt
  2019-06-22 14:51 ` Bin Meng
  2019-07-02 13:24 ` [U-Boot] [PATCH v2] " Joshua Watt
  0 siblings, 2 replies; 12+ messages in thread
From: Joshua Watt @ 2019-06-21 15:16 UTC (permalink / raw)
  To: u-boot

Converts qemu x86 machines to boot using distro_config. The intent is to
allow u-boot in qemu to be maximally compatible with many boot methods
without having to change the config. Currently, u-boot will only boot in
a very limited set of circumstances where there is a /boot/vmlinuz on
scsi 0:3 with no ramdisk.

If distro_bootcmd fails, u-boot will fall back to the original method.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 include/configs/qemu-x86.h | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/include/configs/qemu-x86.h b/include/configs/qemu-x86.h
index 64e7a60b8a..d9c96e295d 100644
--- a/include/configs/qemu-x86.h
+++ b/include/configs/qemu-x86.h
@@ -10,8 +10,38 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/sizes.h>
+
+#define CONFIG_BOOTCOMMAND \
+	"run distro_bootcmd; " \
+	"ext2load scsi 0:3 01000000 /boot/vmlinuz; " \
+	"zboot 01000000"
+
+#define BOOT_TARGET_DEVICES(func) \
+	func(USB, usb, 0) \
+	func(SCSI, scsi, 0) \
+	func(VIRTIO, virtio, 0) \
+	func(IDE, ide, 0) \
+	func(DHCP, dhcp, na)
+
+#include <config_distro_bootcmd.h>
 #include <configs/x86-common.h>
 
+#undef CONFIG_ENV_SIZE
+#define CONFIG_ENV_SIZE			SZ_256K
+
+#define CONFIG_PREBOOT "pci enum"
+
+#undef CONFIG_EXTRA_ENV_SETTINGS
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	CONFIG_STD_DEVICES_SETTINGS \
+	"scriptaddr=0x8000000\0" \
+	"kernel_addr_r=0x1000000\0" \
+	"ramdisk_addr_r=0x4000000\0" \
+	"consoledev=ttyS0\0" \
+	CONFIG_OTHBOOTARGS \
+	BOOTENV
+
 #define CONFIG_SYS_MONITOR_LEN		(1 << 20)
 
 #define CONFIG_STD_DEVICES_SETTINGS	"stdin=serial,i8042-kbd\0" \
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [RFC PATCH] qemu-x86: Use config_distro_bootcmd
  2019-06-21 15:16 [U-Boot] [RFC PATCH] qemu-x86: Use config_distro_bootcmd Joshua Watt
@ 2019-06-22 14:51 ` Bin Meng
  2019-06-22 14:52   ` Bin Meng
  2019-07-02 13:24 ` [U-Boot] [PATCH v2] " Joshua Watt
  1 sibling, 1 reply; 12+ messages in thread
From: Bin Meng @ 2019-06-22 14:51 UTC (permalink / raw)
  To: u-boot

Hi Joshua,

On Fri, Jun 21, 2019 at 11:17 PM Joshua Watt <jpewhacker@gmail.com> wrote:
>
> Converts qemu x86 machines to boot using distro_config. The intent is to
> allow u-boot in qemu to be maximally compatible with many boot methods
> without having to change the config. Currently, u-boot will only boot in
> a very limited set of circumstances where there is a /boot/vmlinuz on
> scsi 0:3 with no ramdisk.
>
> If distro_bootcmd fails, u-boot will fall back to the original method.
>
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> ---
>  include/configs/qemu-x86.h | 30 ++++++++++++++++++++++++++++++

Could you please enable

>  1 file changed, 30 insertions(+)
>
> diff --git a/include/configs/qemu-x86.h b/include/configs/qemu-x86.h
> index 64e7a60b8a..d9c96e295d 100644
> --- a/include/configs/qemu-x86.h
> +++ b/include/configs/qemu-x86.h
> @@ -10,8 +10,38 @@
>  #ifndef __CONFIG_H
>  #define __CONFIG_H
>
> +#include <linux/sizes.h>
> +
> +#define CONFIG_BOOTCOMMAND \
> +       "run distro_bootcmd; " \
> +       "ext2load scsi 0:3 01000000 /boot/vmlinuz; " \
> +       "zboot 01000000"

This should be in the board defconfig files. I would like to only keep
the "run distro_bootcmd" command.

> +
> +#define BOOT_TARGET_DEVICES(func) \
> +       func(USB, usb, 0) \
> +       func(SCSI, scsi, 0) \
> +       func(VIRTIO, virtio, 0) \
> +       func(IDE, ide, 0) \
> +       func(DHCP, dhcp, na)
> +
> +#include <config_distro_bootcmd.h>
>  #include <configs/x86-common.h>
>
> +#undef CONFIG_ENV_SIZE
> +#define CONFIG_ENV_SIZE                        SZ_256K
> +
> +#define CONFIG_PREBOOT "pci enum"
> +
> +#undef CONFIG_EXTRA_ENV_SETTINGS
> +#define CONFIG_EXTRA_ENV_SETTINGS \
> +       CONFIG_STD_DEVICES_SETTINGS \
> +       "scriptaddr=0x8000000\0" \

QEMU default memory is 128MiB, so I would put this to somewhere that
does not break the default one, like 0x7000000?

> +       "kernel_addr_r=0x1000000\0" \
> +       "ramdisk_addr_r=0x4000000\0" \
> +       "consoledev=ttyS0\0" \
> +       CONFIG_OTHBOOTARGS \
> +       BOOTENV
> +
>  #define CONFIG_SYS_MONITOR_LEN         (1 << 20)
>
>  #define CONFIG_STD_DEVICES_SETTINGS    "stdin=serial,i8042-kbd\0" \
> --

CONFIG_DISTRO_DEFAULTS should also be turned on in the board defconfig files.

Could you please update the README.x86 about testing distro boot on
QEMU? Thanks!

Regards,
Bin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [RFC PATCH] qemu-x86: Use config_distro_bootcmd
  2019-06-22 14:51 ` Bin Meng
@ 2019-06-22 14:52   ` Bin Meng
  0 siblings, 0 replies; 12+ messages in thread
From: Bin Meng @ 2019-06-22 14:52 UTC (permalink / raw)
  To: u-boot

On Sat, Jun 22, 2019 at 10:51 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi Joshua,
>
> On Fri, Jun 21, 2019 at 11:17 PM Joshua Watt <jpewhacker@gmail.com> wrote:
> >
> > Converts qemu x86 machines to boot using distro_config. The intent is to
> > allow u-boot in qemu to be maximally compatible with many boot methods
> > without having to change the config. Currently, u-boot will only boot in
> > a very limited set of circumstances where there is a /boot/vmlinuz on
> > scsi 0:3 with no ramdisk.
> >
> > If distro_bootcmd fails, u-boot will fall back to the original method.
> >
> > Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> > ---
> >  include/configs/qemu-x86.h | 30 ++++++++++++++++++++++++++++++
>
> Could you please enable

Oops, I wanted to say: enable CONFIG_DISTRO_DEFAULTS in the board
defconfig files.

>
> >  1 file changed, 30 insertions(+)
> >

Regards,
Bin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v2] qemu-x86: Use config_distro_bootcmd
  2019-06-21 15:16 [U-Boot] [RFC PATCH] qemu-x86: Use config_distro_bootcmd Joshua Watt
  2019-06-22 14:51 ` Bin Meng
@ 2019-07-02 13:24 ` Joshua Watt
  2019-07-02 14:24   ` Bin Meng
  2019-07-03 17:45   ` [U-Boot] [PATCH v3] " Joshua Watt
  1 sibling, 2 replies; 12+ messages in thread
From: Joshua Watt @ 2019-07-02 13:24 UTC (permalink / raw)
  To: u-boot

Converts qemu x86 machines to boot using distro_config. The intent is to
allow u-boot in qemu to be maximally compatible with many boot methods
without having to change the config. Previously, u-boot would only boot
in a very limited set of circumstances where there was a /boot/vmlinuz
on scsi 0:3 with no ramdisk.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 configs/qemu-x86_64_defconfig |  1 +
 configs/qemu-x86_defconfig    |  1 +
 doc/README.x86                |  5 +++++
 include/configs/qemu-x86.h    | 25 +++++++++++++++++++++++++
 4 files changed, 32 insertions(+)

diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig
index d89cd44144..3e9e83efaf 100644
--- a/configs/qemu-x86_64_defconfig
+++ b/configs/qemu-x86_64_defconfig
@@ -62,3 +62,4 @@ CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
 CONFIG_FRAMEBUFFER_VESA_MODE_USER=y
 CONFIG_FRAMEBUFFER_VESA_MODE=0x144
 CONFIG_CONSOLE_SCROLL_LINES=5
+CONFIG_DISTRO_DEFAULTS=y
diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig
index 898d656ac3..85bb7b1daf 100644
--- a/configs/qemu-x86_defconfig
+++ b/configs/qemu-x86_defconfig
@@ -50,3 +50,4 @@ CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
 CONFIG_FRAMEBUFFER_VESA_MODE_USER=y
 CONFIG_FRAMEBUFFER_VESA_MODE=0x144
 CONFIG_CONSOLE_SCROLL_LINES=5
+CONFIG_DISTRO_DEFAULTS=y
diff --git a/doc/README.x86 b/doc/README.x86
index 8e0a3f36ed..48557ffa51 100644
--- a/doc/README.x86
+++ b/doc/README.x86
@@ -466,6 +466,11 @@ If you want to check both consoles, use '-serial stdio'.
 Multicore is also supported by QEMU via '-smp n' where n is the number of cores
 to instantiate. Note, the maximum supported CPU number in QEMU is 255.
 
+U-Boot uses 'distro_bootcmd' by default when booting on x86 QEMU. This tries to
+load a boot script, kernel, and ramdisk from several different interfaces. For
+the default boot order, see 'qemu-x86.h'. For more information, see
+'README.distro'
+
 The fw_cfg interface in QEMU also provides information about kernel data,
 initrd, command-line arguments and more. U-Boot supports directly accessing
 these informtion from fw_cfg interface, which saves the time of loading them
diff --git a/include/configs/qemu-x86.h b/include/configs/qemu-x86.h
index 64e7a60b8a..097ed414f8 100644
--- a/include/configs/qemu-x86.h
+++ b/include/configs/qemu-x86.h
@@ -10,8 +10,33 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/sizes.h>
+
+#define BOOT_TARGET_DEVICES(func) \
+	func(USB, usb, 0) \
+	func(SCSI, scsi, 0) \
+	func(VIRTIO, virtio, 0) \
+	func(IDE, ide, 0) \
+	func(DHCP, dhcp, na)
+
+#include <config_distro_bootcmd.h>
 #include <configs/x86-common.h>
 
+#undef CONFIG_ENV_SIZE
+#define CONFIG_ENV_SIZE			SZ_256K
+
+#define CONFIG_PREBOOT "pci enum"
+
+#undef CONFIG_EXTRA_ENV_SETTINGS
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	CONFIG_STD_DEVICES_SETTINGS \
+	"scriptaddr=0x7000000\0" \
+	"kernel_addr_r=0x1000000\0" \
+	"ramdisk_addr_r=0x4000000\0" \
+	"consoledev=ttyS0\0" \
+	CONFIG_OTHBOOTARGS \
+	BOOTENV
+
 #define CONFIG_SYS_MONITOR_LEN		(1 << 20)
 
 #define CONFIG_STD_DEVICES_SETTINGS	"stdin=serial,i8042-kbd\0" \
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v2] qemu-x86: Use config_distro_bootcmd
  2019-07-02 13:24 ` [U-Boot] [PATCH v2] " Joshua Watt
@ 2019-07-02 14:24   ` Bin Meng
  2019-07-02 15:31     ` Joshua Watt
  2019-07-03 17:45   ` [U-Boot] [PATCH v3] " Joshua Watt
  1 sibling, 1 reply; 12+ messages in thread
From: Bin Meng @ 2019-07-02 14:24 UTC (permalink / raw)
  To: u-boot

Hi Joshua,

On Tue, Jul 2, 2019 at 9:26 PM Joshua Watt <jpewhacker@gmail.com> wrote:
>
> Converts qemu x86 machines to boot using distro_config. The intent is to
> allow u-boot in qemu to be maximally compatible with many boot methods
> without having to change the config. Previously, u-boot would only boot
> in a very limited set of circumstances where there was a /boot/vmlinuz
> on scsi 0:3 with no ramdisk.
>
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> ---
>  configs/qemu-x86_64_defconfig |  1 +
>  configs/qemu-x86_defconfig    |  1 +
>  doc/README.x86                |  5 +++++
>  include/configs/qemu-x86.h    | 25 +++++++++++++++++++++++++
>  4 files changed, 32 insertions(+)
>
> diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig
> index d89cd44144..3e9e83efaf 100644
> --- a/configs/qemu-x86_64_defconfig
> +++ b/configs/qemu-x86_64_defconfig
> @@ -62,3 +62,4 @@ CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
>  CONFIG_FRAMEBUFFER_VESA_MODE_USER=y
>  CONFIG_FRAMEBUFFER_VESA_MODE=0x144
>  CONFIG_CONSOLE_SCROLL_LINES=5
> +CONFIG_DISTRO_DEFAULTS=y

I think this should be inserted to a proper place in the defconfig
files. Try "make savedefconfig" and use the generated "defconfig"
file.

> diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig
> index 898d656ac3..85bb7b1daf 100644
> --- a/configs/qemu-x86_defconfig
> +++ b/configs/qemu-x86_defconfig
> @@ -50,3 +50,4 @@ CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
>  CONFIG_FRAMEBUFFER_VESA_MODE_USER=y
>  CONFIG_FRAMEBUFFER_VESA_MODE=0x144
>  CONFIG_CONSOLE_SCROLL_LINES=5
> +CONFIG_DISTRO_DEFAULTS=y
> diff --git a/doc/README.x86 b/doc/README.x86
> index 8e0a3f36ed..48557ffa51 100644
> --- a/doc/README.x86
> +++ b/doc/README.x86
> @@ -466,6 +466,11 @@ If you want to check both consoles, use '-serial stdio'.
>  Multicore is also supported by QEMU via '-smp n' where n is the number of cores
>  to instantiate. Note, the maximum supported CPU number in QEMU is 255.
>
> +U-Boot uses 'distro_bootcmd' by default when booting on x86 QEMU. This tries to
> +load a boot script, kernel, and ramdisk from several different interfaces. For
> +the default boot order, see 'qemu-x86.h'. For more information, see
> +'README.distro'

Thanks for adding some documentation. Do you have any details on for
example how to boot Ubuntu or Fedora on QEMU?

> +
>  The fw_cfg interface in QEMU also provides information about kernel data,
>  initrd, command-line arguments and more. U-Boot supports directly accessing
>  these informtion from fw_cfg interface, which saves the time of loading them
> diff --git a/include/configs/qemu-x86.h b/include/configs/qemu-x86.h
> index 64e7a60b8a..097ed414f8 100644
> --- a/include/configs/qemu-x86.h
> +++ b/include/configs/qemu-x86.h
> @@ -10,8 +10,33 @@
>  #ifndef __CONFIG_H
>  #define __CONFIG_H
>

Regards,
Bin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v2] qemu-x86: Use config_distro_bootcmd
  2019-07-02 14:24   ` Bin Meng
@ 2019-07-02 15:31     ` Joshua Watt
  0 siblings, 0 replies; 12+ messages in thread
From: Joshua Watt @ 2019-07-02 15:31 UTC (permalink / raw)
  To: u-boot


On 7/2/19 9:24 AM, Bin Meng wrote:
> Hi Joshua,
>
> On Tue, Jul 2, 2019 at 9:26 PM Joshua Watt <jpewhacker@gmail.com> wrote:
>> Converts qemu x86 machines to boot using distro_config. The intent is to
>> allow u-boot in qemu to be maximally compatible with many boot methods
>> without having to change the config. Previously, u-boot would only boot
>> in a very limited set of circumstances where there was a /boot/vmlinuz
>> on scsi 0:3 with no ramdisk.
>>
>> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
>> ---
>>   configs/qemu-x86_64_defconfig |  1 +
>>   configs/qemu-x86_defconfig    |  1 +
>>   doc/README.x86                |  5 +++++
>>   include/configs/qemu-x86.h    | 25 +++++++++++++++++++++++++
>>   4 files changed, 32 insertions(+)
>>
>> diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig
>> index d89cd44144..3e9e83efaf 100644
>> --- a/configs/qemu-x86_64_defconfig
>> +++ b/configs/qemu-x86_64_defconfig
>> @@ -62,3 +62,4 @@ CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
>>   CONFIG_FRAMEBUFFER_VESA_MODE_USER=y
>>   CONFIG_FRAMEBUFFER_VESA_MODE=0x144
>>   CONFIG_CONSOLE_SCROLL_LINES=5
>> +CONFIG_DISTRO_DEFAULTS=y
> I think this should be inserted to a proper place in the defconfig
> files. Try "make savedefconfig" and use the generated "defconfig"
> file.

OK, I'll do that.

>
>> diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig
>> index 898d656ac3..85bb7b1daf 100644
>> --- a/configs/qemu-x86_defconfig
>> +++ b/configs/qemu-x86_defconfig
>> @@ -50,3 +50,4 @@ CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
>>   CONFIG_FRAMEBUFFER_VESA_MODE_USER=y
>>   CONFIG_FRAMEBUFFER_VESA_MODE=0x144
>>   CONFIG_CONSOLE_SCROLL_LINES=5
>> +CONFIG_DISTRO_DEFAULTS=y
>> diff --git a/doc/README.x86 b/doc/README.x86
>> index 8e0a3f36ed..48557ffa51 100644
>> --- a/doc/README.x86
>> +++ b/doc/README.x86
>> @@ -466,6 +466,11 @@ If you want to check both consoles, use '-serial stdio'.
>>   Multicore is also supported by QEMU via '-smp n' where n is the number of cores
>>   to instantiate. Note, the maximum supported CPU number in QEMU is 255.
>>
>> +U-Boot uses 'distro_bootcmd' by default when booting on x86 QEMU. This tries to
>> +load a boot script, kernel, and ramdisk from several different interfaces. For
>> +the default boot order, see 'qemu-x86.h'. For more information, see
>> +'README.distro'
> Thanks for adding some documentation. Do you have any details on for
> example how to boot Ubuntu or Fedora on QEMU?
I don't, but I'll see if I can get an image and give it a try.
>
>> +
>>   The fw_cfg interface in QEMU also provides information about kernel data,
>>   initrd, command-line arguments and more. U-Boot supports directly accessing
>>   these informtion from fw_cfg interface, which saves the time of loading them
>> diff --git a/include/configs/qemu-x86.h b/include/configs/qemu-x86.h
>> index 64e7a60b8a..097ed414f8 100644
>> --- a/include/configs/qemu-x86.h
>> +++ b/include/configs/qemu-x86.h
>> @@ -10,8 +10,33 @@
>>   #ifndef __CONFIG_H
>>   #define __CONFIG_H
>>
> Regards,
> Bin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3] qemu-x86: Use config_distro_bootcmd
  2019-07-02 13:24 ` [U-Boot] [PATCH v2] " Joshua Watt
  2019-07-02 14:24   ` Bin Meng
@ 2019-07-03 17:45   ` Joshua Watt
  2019-07-16 14:19     ` Joshua Watt
  2019-07-17  5:43     ` Bin Meng
  1 sibling, 2 replies; 12+ messages in thread
From: Joshua Watt @ 2019-07-03 17:45 UTC (permalink / raw)
  To: u-boot

Converts qemu x86 machines to boot using distro_config. The intent is to
allow u-boot in qemu to be maximally compatible with many boot methods
without having to change the config. Previously, u-boot would only boot
in a very limited set of circumstances where there was a /boot/vmlinuz
on scsi 0:3 with no ramdisk.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 configs/qemu-x86_64_defconfig |  1 +
 configs/qemu-x86_defconfig    |  1 +
 doc/README.x86                | 17 +++++++++++++++++
 include/configs/qemu-x86.h    | 25 +++++++++++++++++++++++++
 4 files changed, 44 insertions(+)

diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig
index d89cd44144..89118cc3dc 100644
--- a/configs/qemu-x86_64_defconfig
+++ b/configs/qemu-x86_64_defconfig
@@ -12,6 +12,7 @@ CONFIG_SMP=y
 CONFIG_GENERATE_PIRQ_TABLE=y
 CONFIG_GENERATE_MP_TABLE=y
 CONFIG_GENERATE_ACPI_TABLE=y
+CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BUILD_ROM=y
 CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig
index 898d656ac3..a50285beec 100644
--- a/configs/qemu-x86_defconfig
+++ b/configs/qemu-x86_defconfig
@@ -6,6 +6,7 @@ CONFIG_SMP=y
 CONFIG_GENERATE_PIRQ_TABLE=y
 CONFIG_GENERATE_MP_TABLE=y
 CONFIG_GENERATE_ACPI_TABLE=y
+CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BUILD_ROM=y
 CONFIG_FIT=y
 CONFIG_BOOTSTAGE=y
diff --git a/doc/README.x86 b/doc/README.x86
index 8e0a3f36ed..a00ae69acc 100644
--- a/doc/README.x86
+++ b/doc/README.x86
@@ -466,6 +466,23 @@ If you want to check both consoles, use '-serial stdio'.
 Multicore is also supported by QEMU via '-smp n' where n is the number of cores
 to instantiate. Note, the maximum supported CPU number in QEMU is 255.
 
+U-Boot uses 'distro_bootcmd' by default when booting on x86 QEMU. This tries to
+load a boot script, kernel, and ramdisk from several different interfaces. For
+the default boot order, see 'qemu-x86.h'. For more information, see
+'README.distro'. Most Linux distros can be booted by writing a uboot script.
+For example, Debian (stretch) can be booted by creating a script file named
+'boot.txt' with the contents:
+
+ setenv bootargs root=/dev/sda1 ro
+ load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} /vmlinuz
+ load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} /initrd.img
+ zboot ${kernel_addr_r} - ${ramdisk_addr_r} ${filesize}
+
+Then compile and install it with:
+
+ $ apt install u-boot-tools && \
+     mkimage -T script -C none -n "Boot script" -d boot.txt /boot/boot.scr
+
 The fw_cfg interface in QEMU also provides information about kernel data,
 initrd, command-line arguments and more. U-Boot supports directly accessing
 these informtion from fw_cfg interface, which saves the time of loading them
diff --git a/include/configs/qemu-x86.h b/include/configs/qemu-x86.h
index 64e7a60b8a..097ed414f8 100644
--- a/include/configs/qemu-x86.h
+++ b/include/configs/qemu-x86.h
@@ -10,8 +10,33 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/sizes.h>
+
+#define BOOT_TARGET_DEVICES(func) \
+	func(USB, usb, 0) \
+	func(SCSI, scsi, 0) \
+	func(VIRTIO, virtio, 0) \
+	func(IDE, ide, 0) \
+	func(DHCP, dhcp, na)
+
+#include <config_distro_bootcmd.h>
 #include <configs/x86-common.h>
 
+#undef CONFIG_ENV_SIZE
+#define CONFIG_ENV_SIZE			SZ_256K
+
+#define CONFIG_PREBOOT "pci enum"
+
+#undef CONFIG_EXTRA_ENV_SETTINGS
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	CONFIG_STD_DEVICES_SETTINGS \
+	"scriptaddr=0x7000000\0" \
+	"kernel_addr_r=0x1000000\0" \
+	"ramdisk_addr_r=0x4000000\0" \
+	"consoledev=ttyS0\0" \
+	CONFIG_OTHBOOTARGS \
+	BOOTENV
+
 #define CONFIG_SYS_MONITOR_LEN		(1 << 20)
 
 #define CONFIG_STD_DEVICES_SETTINGS	"stdin=serial,i8042-kbd\0" \
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3] qemu-x86: Use config_distro_bootcmd
  2019-07-03 17:45   ` [U-Boot] [PATCH v3] " Joshua Watt
@ 2019-07-16 14:19     ` Joshua Watt
  2019-07-17  5:43     ` Bin Meng
  1 sibling, 0 replies; 12+ messages in thread
From: Joshua Watt @ 2019-07-16 14:19 UTC (permalink / raw)
  To: u-boot

ping?

On 7/3/19 12:45 PM, Joshua Watt wrote:
> Converts qemu x86 machines to boot using distro_config. The intent is to
> allow u-boot in qemu to be maximally compatible with many boot methods
> without having to change the config. Previously, u-boot would only boot
> in a very limited set of circumstances where there was a /boot/vmlinuz
> on scsi 0:3 with no ramdisk.
>
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> ---
>   configs/qemu-x86_64_defconfig |  1 +
>   configs/qemu-x86_defconfig    |  1 +
>   doc/README.x86                | 17 +++++++++++++++++
>   include/configs/qemu-x86.h    | 25 +++++++++++++++++++++++++
>   4 files changed, 44 insertions(+)
>
> diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig
> index d89cd44144..89118cc3dc 100644
> --- a/configs/qemu-x86_64_defconfig
> +++ b/configs/qemu-x86_64_defconfig
> @@ -12,6 +12,7 @@ CONFIG_SMP=y
>   CONFIG_GENERATE_PIRQ_TABLE=y
>   CONFIG_GENERATE_MP_TABLE=y
>   CONFIG_GENERATE_ACPI_TABLE=y
> +CONFIG_DISTRO_DEFAULTS=y
>   CONFIG_BUILD_ROM=y
>   CONFIG_FIT=y
>   CONFIG_SPL_LOAD_FIT=y
> diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig
> index 898d656ac3..a50285beec 100644
> --- a/configs/qemu-x86_defconfig
> +++ b/configs/qemu-x86_defconfig
> @@ -6,6 +6,7 @@ CONFIG_SMP=y
>   CONFIG_GENERATE_PIRQ_TABLE=y
>   CONFIG_GENERATE_MP_TABLE=y
>   CONFIG_GENERATE_ACPI_TABLE=y
> +CONFIG_DISTRO_DEFAULTS=y
>   CONFIG_BUILD_ROM=y
>   CONFIG_FIT=y
>   CONFIG_BOOTSTAGE=y
> diff --git a/doc/README.x86 b/doc/README.x86
> index 8e0a3f36ed..a00ae69acc 100644
> --- a/doc/README.x86
> +++ b/doc/README.x86
> @@ -466,6 +466,23 @@ If you want to check both consoles, use '-serial stdio'.
>   Multicore is also supported by QEMU via '-smp n' where n is the number of cores
>   to instantiate. Note, the maximum supported CPU number in QEMU is 255.
>   
> +U-Boot uses 'distro_bootcmd' by default when booting on x86 QEMU. This tries to
> +load a boot script, kernel, and ramdisk from several different interfaces. For
> +the default boot order, see 'qemu-x86.h'. For more information, see
> +'README.distro'. Most Linux distros can be booted by writing a uboot script.
> +For example, Debian (stretch) can be booted by creating a script file named
> +'boot.txt' with the contents:
> +
> + setenv bootargs root=/dev/sda1 ro
> + load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} /vmlinuz
> + load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} /initrd.img
> + zboot ${kernel_addr_r} - ${ramdisk_addr_r} ${filesize}
> +
> +Then compile and install it with:
> +
> + $ apt install u-boot-tools && \
> +     mkimage -T script -C none -n "Boot script" -d boot.txt /boot/boot.scr
> +
>   The fw_cfg interface in QEMU also provides information about kernel data,
>   initrd, command-line arguments and more. U-Boot supports directly accessing
>   these informtion from fw_cfg interface, which saves the time of loading them
> diff --git a/include/configs/qemu-x86.h b/include/configs/qemu-x86.h
> index 64e7a60b8a..097ed414f8 100644
> --- a/include/configs/qemu-x86.h
> +++ b/include/configs/qemu-x86.h
> @@ -10,8 +10,33 @@
>   #ifndef __CONFIG_H
>   #define __CONFIG_H
>   
> +#include <linux/sizes.h>
> +
> +#define BOOT_TARGET_DEVICES(func) \
> +	func(USB, usb, 0) \
> +	func(SCSI, scsi, 0) \
> +	func(VIRTIO, virtio, 0) \
> +	func(IDE, ide, 0) \
> +	func(DHCP, dhcp, na)
> +
> +#include <config_distro_bootcmd.h>
>   #include <configs/x86-common.h>
>   
> +#undef CONFIG_ENV_SIZE
> +#define CONFIG_ENV_SIZE			SZ_256K
> +
> +#define CONFIG_PREBOOT "pci enum"
> +
> +#undef CONFIG_EXTRA_ENV_SETTINGS
> +#define CONFIG_EXTRA_ENV_SETTINGS \
> +	CONFIG_STD_DEVICES_SETTINGS \
> +	"scriptaddr=0x7000000\0" \
> +	"kernel_addr_r=0x1000000\0" \
> +	"ramdisk_addr_r=0x4000000\0" \
> +	"consoledev=ttyS0\0" \
> +	CONFIG_OTHBOOTARGS \
> +	BOOTENV
> +
>   #define CONFIG_SYS_MONITOR_LEN		(1 << 20)
>   
>   #define CONFIG_STD_DEVICES_SETTINGS	"stdin=serial,i8042-kbd\0" \

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3] qemu-x86: Use config_distro_bootcmd
  2019-07-03 17:45   ` [U-Boot] [PATCH v3] " Joshua Watt
  2019-07-16 14:19     ` Joshua Watt
@ 2019-07-17  5:43     ` Bin Meng
  2019-07-19  9:46       ` Bin Meng
  1 sibling, 1 reply; 12+ messages in thread
From: Bin Meng @ 2019-07-17  5:43 UTC (permalink / raw)
  To: u-boot

On Thu, Jul 4, 2019 at 1:46 AM Joshua Watt <jpewhacker@gmail.com> wrote:
>
> Converts qemu x86 machines to boot using distro_config. The intent is to
> allow u-boot in qemu to be maximally compatible with many boot methods
> without having to change the config. Previously, u-boot would only boot
> in a very limited set of circumstances where there was a /boot/vmlinuz
> on scsi 0:3 with no ramdisk.
>
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> ---
>  configs/qemu-x86_64_defconfig |  1 +
>  configs/qemu-x86_defconfig    |  1 +
>  doc/README.x86                | 17 +++++++++++++++++
>  include/configs/qemu-x86.h    | 25 +++++++++++++++++++++++++
>  4 files changed, 44 insertions(+)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3] qemu-x86: Use config_distro_bootcmd
  2019-07-17  5:43     ` Bin Meng
@ 2019-07-19  9:46       ` Bin Meng
  2019-08-14  4:14         ` Heinrich Schuchardt
  0 siblings, 1 reply; 12+ messages in thread
From: Bin Meng @ 2019-07-19  9:46 UTC (permalink / raw)
  To: u-boot

On Wed, Jul 17, 2019 at 1:43 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Thu, Jul 4, 2019 at 1:46 AM Joshua Watt <jpewhacker@gmail.com> wrote:
> >
> > Converts qemu x86 machines to boot using distro_config. The intent is to
> > allow u-boot in qemu to be maximally compatible with many boot methods
> > without having to change the config. Previously, u-boot would only boot
> > in a very limited set of circumstances where there was a /boot/vmlinuz
> > on scsi 0:3 with no ramdisk.
> >
> > Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> > ---
> >  configs/qemu-x86_64_defconfig |  1 +
> >  configs/qemu-x86_defconfig    |  1 +
> >  doc/README.x86                | 17 +++++++++++++++++
> >  include/configs/qemu-x86.h    | 25 +++++++++++++++++++++++++
> >  4 files changed, 44 insertions(+)
> >
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

applied to u-boot-x86, thanks!

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3] qemu-x86: Use config_distro_bootcmd
  2019-07-19  9:46       ` Bin Meng
@ 2019-08-14  4:14         ` Heinrich Schuchardt
  2019-08-14  7:19           ` Bin Meng
  0 siblings, 1 reply; 12+ messages in thread
From: Heinrich Schuchardt @ 2019-08-14  4:14 UTC (permalink / raw)
  To: u-boot

On 7/19/19 11:46 AM, Bin Meng wrote:
> On Wed, Jul 17, 2019 at 1:43 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>>
>> On Thu, Jul 4, 2019 at 1:46 AM Joshua Watt <jpewhacker@gmail.com> wrote:
>>>
>>> Converts qemu x86 machines to boot using distro_config. The intent is to
>>> allow u-boot in qemu to be maximally compatible with many boot methods
>>> without having to change the config. Previously, u-boot would only boot
>>> in a very limited set of circumstances where there was a /boot/vmlinuz
>>> on scsi 0:3 with no ramdisk.
>>>
>>> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
>>> ---
>>>   configs/qemu-x86_64_defconfig |  1 +
>>>   configs/qemu-x86_defconfig    |  1 +
>>>   doc/README.x86                | 17 +++++++++++++++++
>>>   include/configs/qemu-x86.h    | 25 +++++++++++++++++++++++++
>>>   4 files changed, 44 insertions(+)
>>>
>>
>> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
>
> applied to u-boot-x86, thanks!
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot
>

This patch leads to a build error when building with
CONFIG_DISTRO_DEFAULTS=n.

In file included from include/configs/qemu-x86.h:23,
                  from include/config.h:5,
                  from include/common.h:23,
                  from lib/asm-offsets.c:14:
include/configs/x86-common.h:109: error: "BOOTENV" redefined [-Werror]
  #define BOOTENV

In file included from include/configs/qemu-x86.h:22,
                  from include/config.h:5,
                  from include/common.h:23,
                  from lib/asm-offsets.c:14:
include/config_distro_bootcmd.h:407: note: this is the location of the
previous definition
  #define BOOTENV \

I am glad that qemu-x86 now can use distro defaults. But I would not
expect a build error due to a legal configuration choice.

If you do not want to retain backwards compatibility you could 'select
DISTRO_DEFAULTS' in board/emulation/Kconfig. This way distro defaults
would no longer be deselectable for qemu-x86.

Best regards

Heinrich

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3] qemu-x86: Use config_distro_bootcmd
  2019-08-14  4:14         ` Heinrich Schuchardt
@ 2019-08-14  7:19           ` Bin Meng
  0 siblings, 0 replies; 12+ messages in thread
From: Bin Meng @ 2019-08-14  7:19 UTC (permalink / raw)
  To: u-boot

Hi Heinrich,

On Wed, Aug 14, 2019 at 12:15 PM Heinrich Schuchardt
<xypron.debian@gmx.de> wrote:
>
> On 7/19/19 11:46 AM, Bin Meng wrote:
> > On Wed, Jul 17, 2019 at 1:43 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> >>
> >> On Thu, Jul 4, 2019 at 1:46 AM Joshua Watt <jpewhacker@gmail.com> wrote:
> >>>
> >>> Converts qemu x86 machines to boot using distro_config. The intent is to
> >>> allow u-boot in qemu to be maximally compatible with many boot methods
> >>> without having to change the config. Previously, u-boot would only boot
> >>> in a very limited set of circumstances where there was a /boot/vmlinuz
> >>> on scsi 0:3 with no ramdisk.
> >>>
> >>> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> >>> ---
> >>>   configs/qemu-x86_64_defconfig |  1 +
> >>>   configs/qemu-x86_defconfig    |  1 +
> >>>   doc/README.x86                | 17 +++++++++++++++++
> >>>   include/configs/qemu-x86.h    | 25 +++++++++++++++++++++++++
> >>>   4 files changed, 44 insertions(+)
> >>>
> >>
> >> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> >
> > applied to u-boot-x86, thanks!
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot at lists.denx.de
> > https://lists.denx.de/listinfo/u-boot
> >
>
> This patch leads to a build error when building with
> CONFIG_DISTRO_DEFAULTS=n.
>
> In file included from include/configs/qemu-x86.h:23,
>                   from include/config.h:5,
>                   from include/common.h:23,
>                   from lib/asm-offsets.c:14:
> include/configs/x86-common.h:109: error: "BOOTENV" redefined [-Werror]
>   #define BOOTENV
>
> In file included from include/configs/qemu-x86.h:22,
>                   from include/config.h:5,
>                   from include/common.h:23,
>                   from lib/asm-offsets.c:14:
> include/config_distro_bootcmd.h:407: note: this is the location of the
> previous definition
>   #define BOOTENV \
>
> I am glad that qemu-x86 now can use distro defaults. But I would not
> expect a build error due to a legal configuration choice.
>
> If you do not want to retain backwards compatibility you could 'select
> DISTRO_DEFAULTS' in board/emulation/Kconfig. This way distro defaults
> would no longer be deselectable for qemu-x86.

Thanks for reporting it. I will prepare a patch to fix it.

Regards,
Bin

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-08-14  7:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-21 15:16 [U-Boot] [RFC PATCH] qemu-x86: Use config_distro_bootcmd Joshua Watt
2019-06-22 14:51 ` Bin Meng
2019-06-22 14:52   ` Bin Meng
2019-07-02 13:24 ` [U-Boot] [PATCH v2] " Joshua Watt
2019-07-02 14:24   ` Bin Meng
2019-07-02 15:31     ` Joshua Watt
2019-07-03 17:45   ` [U-Boot] [PATCH v3] " Joshua Watt
2019-07-16 14:19     ` Joshua Watt
2019-07-17  5:43     ` Bin Meng
2019-07-19  9:46       ` Bin Meng
2019-08-14  4:14         ` Heinrich Schuchardt
2019-08-14  7:19           ` Bin Meng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox