* [Qemu-devel] [PATCH 1/2] ARM: Add "-uboot" option.
2012-02-22 6:58 [Qemu-devel] [PATCH 0/2] Add "-uboot" option Evgeny Voevodin
@ 2012-02-22 6:58 ` Evgeny Voevodin
2012-02-22 6:58 ` [Qemu-devel] [PATCH 2/2] ARM: exynos, integratorcp: Specify U-Boot start address Evgeny Voevodin
2012-02-22 8:12 ` [Qemu-devel] [PATCH 0/2] Add "-uboot" option Peter Maydell
2 siblings, 0 replies; 6+ messages in thread
From: Evgeny Voevodin @ 2012-02-22 6:58 UTC (permalink / raw)
To: qemu-devel
Cc: kyungmin.park, m.kozlov, i.mitsyanko, d.solodkiy, Evgeny Voevodin
With this option board can load U-Boot into address specified
through arm_boot_info.uboot_start.
Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
---
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(-)
diff --git a/hw/arm-misc.h b/hw/arm-misc.h
index 306013a..54a9450 100644
--- a/hw/arm-misc.h
+++ b/hw/arm-misc.h
@@ -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,
diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index 2ef25ca..0700884 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -15,6 +15,7 @@
#define KERNEL_ARGS_ADDR 0x100
#define KERNEL_LOAD_ADDR 0x00010000
+#define UIMAGE_LOAD_ADDR 0x00007fc0
#define INITRD_LOAD_ADDR 0x00d00000
/* The worlds second smallest bootloader. Set r0-r2, then jump to kernel. */
@@ -236,7 +237,7 @@ static void do_cpu_reset(void *opaque)
void arm_load_kernel(CPUState *env, struct arm_boot_info *info)
{
- int kernel_size;
+ int kernel_size, uboot_size;
int initrd_size;
int n;
int is_linux = 0;
@@ -266,19 +267,43 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info)
big_endian = 0;
#endif
- /* Assume that raw images are linux kernels, and ELF images are not. */
- kernel_size = load_elf(info->kernel_filename, NULL, NULL, &elf_entry,
- NULL, NULL, big_endian, ELF_MACHINE, 1);
- entry = elf_entry;
- if (kernel_size < 0) {
- kernel_size = load_uimage(info->kernel_filename, &entry, NULL,
- &is_linux);
- }
- if (kernel_size < 0) {
- entry = info->loader_start + KERNEL_LOAD_ADDR;
- kernel_size = load_image_targphys(info->kernel_filename, entry,
- ram_size - KERNEL_LOAD_ADDR);
+ if (uboot_name != NULL) {
+
+ entry = info->uboot_start;
+
+ if (!entry) {
+ fprintf(stderr, "Entry point for u-boot must be specified\n");
+ exit(1);
+ }
+
+ uboot_size =
+ load_image_targphys(uboot_name, entry, info->ram_size);
+ if (uboot_size < 0) {
+ fprintf(stderr, "qemu: could not load u-boot '%s'\n", uboot_name);
+ exit(1);
+ }
+
+ kernel_size = load_image_targphys(info->kernel_filename,
+ info->loader_start + UIMAGE_LOAD_ADDR,
+ info->ram_size - uboot_size);
is_linux = 1;
+
+ } else { /* uboot_name == NULL */
+
+ /* Assume that raw images are linux kernels, and ELF images are not. */
+ kernel_size = load_elf(info->kernel_filename, NULL, NULL, &elf_entry,
+ NULL, NULL, big_endian, ELF_MACHINE, 1);
+ entry = elf_entry;
+ if (kernel_size < 0) {
+ kernel_size = load_uimage(info->kernel_filename, &entry, NULL,
+ &is_linux);
+ }
+ if (kernel_size < 0) {
+ entry = info->loader_start + KERNEL_LOAD_ADDR;
+ kernel_size = load_image_targphys(info->kernel_filename, entry,
+ ram_size - KERNEL_LOAD_ADDR);
+ is_linux = 1;
+ }
}
if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n",
diff --git a/qemu-options.hx b/qemu-options.hx
index b129996..d498fbb 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -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
diff --git a/sysemu.h b/sysemu.h
index 9d5ce33..116a4ff 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -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[];
diff --git a/vl.c b/vl.c
index d8a521a..b3c68cb 100644
--- a/vl.c
+++ b/vl.c
@@ -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;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* [Qemu-devel] [PATCH 2/2] ARM: exynos, integratorcp: Specify U-Boot start address.
2012-02-22 6:58 [Qemu-devel] [PATCH 0/2] Add "-uboot" option Evgeny Voevodin
2012-02-22 6:58 ` [Qemu-devel] [PATCH 1/2] ARM: " Evgeny Voevodin
@ 2012-02-22 6:58 ` Evgeny Voevodin
2012-02-22 8:12 ` [Qemu-devel] [PATCH 0/2] Add "-uboot" option Peter Maydell
2 siblings, 0 replies; 6+ messages in thread
From: Evgeny Voevodin @ 2012-02-22 6:58 UTC (permalink / raw)
To: qemu-devel
Cc: kyungmin.park, m.kozlov, i.mitsyanko, d.solodkiy, Evgeny Voevodin
Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
---
hw/exynos4210.h | 1 +
hw/exynos4_boards.c | 1 +
hw/integratorcp.c | 1 +
3 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/hw/exynos4210.h b/hw/exynos4210.h
index e7522f8..9035a2a 100644
--- a/hw/exynos4210.h
+++ b/hw/exynos4210.h
@@ -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
diff --git a/hw/exynos4_boards.c b/hw/exynos4_boards.c
index 553a02b..937aab1 100644
--- a/hw/exynos4_boards.c
+++ b/hw/exynos4_boards.c
@@ -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,
diff --git a/hw/integratorcp.c b/hw/integratorcp.c
index 5b06c81..174ef38 100644
--- a/hw/integratorcp.c
+++ b/hw/integratorcp.c
@@ -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,
};
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread