Skip to contentSkip to conversation

Add "-uboot" option

PATCH In review Evgeny Voevodin 2 participants 6 messages Feb 22, 2012 Arm Samsung Exynos

lore
Share & tools
lore
#0 lore raw

cover Add "-uboot" option

These patches add "-uboot" option to ARM boards. To let user load u-boot, board should initialize .uboot_start in arm_boot_info struct.
Added utilisation of "-uboot" for exynos4 and integratorcp.

Evgeny Voevodin (2):
ARM: Add "-uboot" option.
ARM: exynos, integratorcp: Specify U-Boot start address.

 hw/arm-misc.h       |    1 +
 hw/arm_boot.c       |   51 ++++++++++++++++++++++++++++++++++++++-------------
 hw/exynos4210.h     |    1 +
 hw/exynos4_boards.c |    1 +
 hw/integratorcp.c   |    1 +
 qemu-options.hx     |    8 ++++++++
 sysemu.h            |    1 +
 vl.c                |    4 ++++
 8 files changed, 55 insertions(+), 13 deletions(-)
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/2 ARM: Add "-uboot" option.

With this option board can load U-Boot into address specified through arm_boot_info.uboot_start.

---
 hw/arm-misc.h   |    1 +
 hw/arm_boot.c   |   51 ++++++++++++++++++++++++++++++++++++++-------------
 qemu-options.hx |    8 ++++++++
 sysemu.h        |    1 +
 vl.c            |    4 ++++
 5 files changed, 52 insertions(+), 13 deletions(-)
hw/arm-misc.h +1 -0
index 306013a..54a9450 100644
@@ -29,6 +29,7 @@ struct arm_boot_info {
     const char *kernel_filename;
     const char *kernel_cmdline;
     const char *initrd_filename;
+    target_phys_addr_t uboot_start;
     target_phys_addr_t loader_start;
     /* multicore boards that use the default secondary core boot functions
      * need to put the address of the secondary boot code, the boot reg,
hw/arm_boot.c +38 -13

70 lines not on this page · raw message

qemu-options.hx +8 -0
index b129996..d498fbb 100644
@@ -2336,6 +2336,14 @@ STEXI
 Set the filename for the BIOS.
 ETEXI
 
+DEF("uboot", HAS_ARG, QEMU_OPTION_uboot, \
+    "-uboot file     set the filename for the U-Boot\n", QEMU_ARCH_ARM)
+STEXI
+@item -uboot @var{file}
+@findex -uboot
+Set the filename for the U-Boot.
+ETEXI
+
 DEF("enable-kvm", 0, QEMU_OPTION_enable_kvm, \
     "-enable-kvm     enable KVM full virtualization support\n", QEMU_ARCH_ALL)
 STEXI
sysemu.h +1 -0
index 9d5ce33..116a4ff 100644
@@ -13,6 +13,7 @@
 /* vl.c */
 
 extern const char *bios_name;
+extern const char *uboot_name;
 
 extern const char *qemu_name;
 extern uint8_t qemu_uuid[];
vl.c +4 -0
index d8a521a..b3c68cb 100644
@@ -176,6 +176,7 @@ int main(int argc, char **argv)
 
 static const char *data_dir;
 const char *bios_name = NULL;
+const char *uboot_name = NULL;
 enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
 DisplayType display_type = DT_DEFAULT;
 int display_remote = 0;
@@ -2617,6 +2618,9 @@ int main(int argc, char **argv, char **envp)
             case QEMU_OPTION_bios:
                 bios_name = optarg;
                 break;
+            case QEMU_OPTION_uboot:
+                uboot_name = optarg;
+                break;
             case QEMU_OPTION_singlestep:
                 singlestep = 1;
                 break;
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 2/2 ARM: exynos, integratorcp: Specify U-Boot start address.

In reply to Evgeny Voevodin
---
 hw/exynos4210.h     |    1 +
 hw/exynos4_boards.c |    1 +
 hw/integratorcp.c   |    1 +
 3 files changed, 3 insertions(+), 0 deletions(-)
hw/exynos4210.h +1 -0
index e7522f8..9035a2a 100644
@@ -43,6 +43,7 @@
 #define EXYNOS4210_IRAM_BASE_ADDR           0x02020000
 #define EXYNOS4210_IRAM_SIZE                0x00020000  /* 128 KB */
 
+#define EXYNOS4210_UBOOT_ADDR               0x44800000
 /* Secondary CPU startup code is in IROM memory */
 #define EXYNOS4210_SMP_BOOT_ADDR            EXYNOS4210_IROM_BASE_ADDR
 #define EXYNOS4210_SMP_BOOT_SIZE            0x1000
hw/exynos4_boards.c +1 -0
index 553a02b..937aab1 100644
@@ -67,6 +67,7 @@ static unsigned long exynos4_board_ram_size[EXYNOS4_NUM_OF_BOARDS] = {
 };
 
 static struct arm_boot_info exynos4_board_binfo = {
+    .uboot_start      = EXYNOS4210_UBOOT_ADDR,
     .loader_start     = EXYNOS4210_BASE_BOOT_ADDR,
     .smp_loader_start = EXYNOS4210_SMP_BOOT_ADDR,
     .nb_cpus          = EXYNOS4210_NCPUS,
hw/integratorcp.c +1 -0
index 5b06c81..174ef38 100644
@@ -434,6 +434,7 @@ static void icp_control_init(target_phys_addr_t base)
 /* Board init.  */
 
 static struct arm_boot_info integrator_binfo = {
+    .uboot_start = 0x01000000,
     .loader_start = 0x0,
     .board_id = 0x113,
 };
Signature · 1 line
1.7.5.4
#3 lore raw
In reply to Evgeny Voevodin
Quoted 4 lines · Evgeny Voevodin

These patches add "-uboot" option to ARM boards. To let user load u-boot, board should initialize .uboot_start in arm_boot_info struct.
Added utilisation of "-uboot" for exynos4 and integratorcp.

Nack. This kind of thing should be done by making QEMU load an ELF file which has u-boot in it (which at the moment you can do with -kernel). Loading Linux kernels is a special case in arm_boot because of the complicated boot protocol they have and because people want to load lots of different kernels.

-- PMM

#4 lore raw
Quoted 5 lines · Peter Maydell
Quoted 4 lines · Evgeny Voevodin

These patches add "-uboot" option to ARM boards. To let user load u-boot, board should initialize .uboot_start in arm_boot_info struct.
Added utilisation of "-uboot" for exynos4 and integratorcp.

Quoted 9 lines

Nack. This kind of thing should be done by making QEMU load an ELF file which has u-boot in it (which at the moment you can do with -kernel). Loading Linux kernels is a special case in arm_boot because of the complicated boot protocol they have and because people want to load lots of different kernels.

-- PMM

As I understood, you mean that -kernel is for people who want to quickly compile and try different kernel.
As for me, -uboot is the same ) No need to generate a file, where u-boot and kernel are placed. Just use -uboot ./u-boot -kernel ./uImage, change kernel, or change u-boot, or both, as you wish.

Signature · 5 lines
Kind regards,
Evgeny Voevodin,
Leading Software Engineer,
ASWG, Moscow R&D center, Samsung Electronics
e-mail: [email protected]
#5 lore raw
Quoted 8 lines · Evgeny Voevodin
Quoted 6 lines · Peter Maydell

Nack. This kind of thing should be done by making QEMU load an ELF file which has u-boot in it (which at the moment you can do with -kernel). Loading Linux kernels is a special case in arm_boot because of the complicated boot protocol they have and because people want to load lots of different kernels.

Quoted 5 lines

As I understood, you mean that -kernel is for people who want to quickly compile and try different kernel.
As for me, -uboot is the same ) No need to generate a file, where u-boot and kernel are placed. Just use -uboot ./u-boot -kernel ./uImage, change kernel, or change u-boot, or both, as you wish.

If you're using -kernel you don't need to provide a u-boot because qemu is being the bootloader. If you're making qemu execute a bootloader than you should just put the kernel where u-boot would load it normally.

We really can't add random options to qemu to support loading every single thing you might possibly want to load, which is why I'm drawing a line in the sand here.

-- PMM