Help needed to run Exynos 4210 linux kernel on qemu?
Hi,
I am trying to run linux over qemu-system-arm emulating a nuri or smdkc210 Exynos 4210 based board.
To do this I fetched the last qemu (from git://git.qemu.org/qemu.git) and built it with "./configure --target-list=arm-softmmu.
Then I fetched the latest linux image for samsung processors (from git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git) and built it using exynos4_defconfig config file.
Then I tried to run the 2 together:
$ qemu-system-arm -kernel zImage -append "console=ttySAC0,115200n8 root=/dev/ram rw earlyprintk" -serial stdio -M smdkc210 -initrd rootfs.img smdkc210 board supports only 2 CPU cores. Ignoring smp_cpus value. VNC server running on `127.0.0.1:5900' Booting Linux on physical CPU 0 Linux version 3.6.0-rc3 (jcd@jcd-P31SG) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #1 SMP PREEMPT Mon Sep 3 22:44:05 CEST 2012 CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache Machine: SMDKC210 bootconsole [earlycon0] enabled Truncating RAM at 40000000-7fffffff to -6f7fffff (vmalloc region overlap). Memory policy: ECC disabled, Data cache writealloc
The kernel hangs here because it got a data abort exception while trying to print the "next" message (which is "CPU EXYNOS4210 (id 0x43210211)"). The data abort is generated somewhere in the console_unlock() function.
I tried the same thing with some less up to date source code of qemu and/or linux with the same result. I even tried the linaro versions of qemu and linux without luck.
So there has to be something I am doing wrong. I would really appreciate it if you could point me in the right direction.
Thanks.
JC
Quoted 37 lines · Jean-Christophe DUBOIS
Hi,
I am trying to run linux over qemu-system-arm emulating a nuri or smdkc210 Exynos 4210 based board.
To do this I fetched the last qemu (from
git://git.qemu.org/qemu.git)
and built it with "./configure --target-list=arm-softmmu.Then I fetched the latest linux image for samsung processors (from
git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git)
and built it usingexynos4_defconfigconfig file.Then I tried to run the 2 together:
$ qemu-system-arm -kernel zImage -append "console=ttySAC0,115200n8 root=/dev/ram rw earlyprintk" -serial stdio -M smdkc210 -initrd rootfs.img smdkc210 board supports only 2 CPU cores. Ignoring smp_cpus value. VNC server running on `127.0.0.1:5900' Booting Linux on physical CPU 0 Linux version 3.6.0-rc3 (jcd@jcd-P31SG) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #1 SMP PREEMPT Mon Sep 3 22:44:05 CEST 2012 CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache Machine: SMDKC210 bootconsole [earlycon0] enabled Truncating RAM at 40000000-7fffffff to -6f7fffff (vmalloc region overlap). Memory policy: ECC disabled, Data cache writeallocThe kernel hangs here because it got a data abort exception while trying to print the "next" message (which is "CPU EXYNOS4210 (id
0x43210211)"). The data abort is generated somewhere in theconsole_unlock()function.I tried the same thing with some less up to date source code of qemu and/or linux with the same result. I even tried the linaro versions of qemu and linux without luck.
Quoted 8 lines
So there has to be something I am doing wrong. I would really appreciate it if you could point me in the right direction.
Thanks.
JC
Hello, Jean!
I've just tried to do the same thing you're trying to do, it works for me if I remove earlyprintk from append. Probably this is due to the fact that kernel expects uart0 to be configured by u-boot prior to kernel start execution. Interestingly, if you change default exynos4_defconfig CONFIG_DEBUG_S3C_UART0 to, for example, CONFIG_DEBUG_S3C_UART2 in linux kernel configuration, everything starting to work fine even with earlyprintk.
But using ramdisks is always a pain for me, I would suggest you two different approaches:
1) The most convenient way is to use emulated SD card for rootfs storage. There is no SD card support for exynos4210 in current QEMU master, but you can apply SD host controller patches I attached to this email to get this support. These patches already have been thoroughly reviewed in qemu-devel mailing list and hopefully would be applied to QEMU master soon enough. If you want to use SD card instead of RAMDISK, apply these patches to QEMU master with "git am", and enable MMC/SD support in linux kernel configuration (it is disabled by default in exynos4_defconfig). You need to check CONFIG_MMC, CONFIG_MMC_SDHC, CONFIG_MMC_SDHCI_S3C and ONFIG_MMC_SDHCI_S3C_DMA.
Then you can launch QEMU with -sd /path/to/your/rootfs and, for example, append line -append "root=/dev/mmcblk0 rootfstype=ext4 rw rootwait".
2) If you want to work only with what current QEMU master has, you can use network filesystem as rootfs, but only for smdkc210 board (nuri board doesn't have any net devices). You're gonna have to check these options in Linux configuration:CONFIG_NET, CONFIG_PACKET, CONFIG_INET, CONFIG_IP_PNP, CONFIG_IP_PNP_DHCP, CONFIG_NETDEVICES, CONFIG_SMSC911X, CONFIG_NFS_FS, CONFIG_ROOT_NFS.
Then, if, for example, you have directory /mnt/nfsroot exported by NFS server on your host machine, you can launch QEMU guest with following command line:
qemu-system-arm -kernel ./zImage -M smdkc210 -append "console=ttySAC0,115200n8 ip=dhcp root=/dev/nfs nfsroot=10.0.2.2:/mnt/nfsroot/ rw" -serial stdio
Also, maybe you noticed, graphic support is disabled in exynos4_defconfig by default. To enable it, check these options in Linux configuration:CONFIG_DRM, CONFIG_DRM_EXYNOS, CONFIG_DRM_EXYNOS_DMABUF, CONFIG_DRM_EXYNOS_FIMD. You can also check CONFIG_LOGO to get a fancy penguins during guest VM startup. And if you need to start X server on your guest VM, you also need to enable UNIX domain sockets in linux kernel CONFIG_UNIX.
Quoted 1 line
From
4e48b36376ae0a9044eb0fbe56bfea3fdd8733e4Mon Sep 17 00:00:00 2001
From: Igor Mitsyanko <[email protected]>
Date: Mon, 6 Aug 2012 13:25:34 +1000
Subject: [PATCH 1/2] hw: introduce standard SD host controller
Device model for standard SD Host Controller Interface (SDHCI) compliant with version 2.00 of SD association specification.
--- default-configs/arm-softmmu.mak | 1 + hw/Makefile.objs | 1 + hw/sdhci.c | 1262 +++++++++++++++++++++++++++++++++++++++ hw/sdhci.h | 309 ++++++++++ 4 files changed, 1573 insertions(+), 0 deletions(-) create mode 100644 hw/sdhci.c create mode 100644 hw/sdhci.h
default-configs/arm-softmmu.mak +1 -0
@@ -27,6 +27,7 @@ CONFIG_SMC91C111=y CONFIG_DS1338=y CONFIG_PFLASH_CFI01=y CONFIG_PFLASH_CFI02=y +CONFIG_SDHCI=y CONFIG_ARM_TIMER=y CONFIG_PL011=y
hw/Makefile.objs +1 -0
@@ -35,6 +35,7 @@ hw-obj-$(CONFIG_APPLESMC) += applesmc.o hw-obj-$(CONFIG_SMARTCARD) += ccid-card-passthru.o hw-obj-$(CONFIG_SMARTCARD_NSS) += ccid-card-emulated.o hw-obj-$(CONFIG_I8259) += i8259_common.o i8259.o +hw-obj-$(CONFIG_SDHCI) += sdhci.o # PPC devices hw-obj-$(CONFIG_PREP_PCI) += prep_pci.o
hw/sdhci.c new file +1262 -0
1,262 lines not on this page · raw message
hw/sdhci.h new file +309 -0
309 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Quoted 1 line
From
27ba5740f4d937cc1bb6a8abcb010a932eef16f5Mon Sep 17 00:00:00 2001
From: Igor Mitsyanko <[email protected]>
Date: Mon, 6 Aug 2012 13:25:35 +1000
Subject: [PATCH 2/2] exynos4210: Added SD host controller model
Custom Exynos4210 SD/MMC host controller, based on SD association standard host controller ver. 2.00.
--- hw/arm/Makefile.objs | 2 +- hw/exynos4210.c | 20 +++ hw/exynos4210_sdhci.c | 444 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 465 insertions(+), 1 deletions(-) create mode 100644 hw/exynos4210_sdhci.c
hw/arm/Makefile.objs +1 -1
@@ -6,7 +6,7 @@ obj-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o obj-y += exynos4210_gic.o exynos4210_combiner.o exynos4210.o obj-y += exynos4_boards.o exynos4210_uart.o exynos4210_pwm.o obj-y += exynos4210_pmu.o exynos4210_mct.o exynos4210_fimd.o -obj-y += exynos4210_rtc.o exynos4210_i2c.o +obj-y += exynos4210_rtc.o exynos4210_i2c.o exynos4210_sdhci.o obj-y += arm_mptimer.o a15mpcore.o obj-y += armv7m.o armv7m_nvic.o stellaris.o stellaris_enet.o obj-y += highbank.o
hw/exynos4210.c +20 -0
@@ -66,6 +66,12 @@#define EXYNOS4210_EXT_COMBINER_BASE_ADDR 0x10440000#define EXYNOS4210_INT_COMBINER_BASE_ADDR 0x10448000 +/* SD/MMC host controllers SFR base addresses */ +#define EXYNOS4210_SDHC0_BASE_ADDR 0x12510000 +#define EXYNOS4210_SDHC1_BASE_ADDR 0x12520000 +#define EXYNOS4210_SDHC2_BASE_ADDR 0x12530000 +#define EXYNOS4210_SDHC3_BASE_ADDR 0x12540000 +/* PMU SFR base address */ #define EXYNOS4210_PMU_BASE_ADDR 0x10020000
@@ -327,6 +333,20 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,EXYNOS4210_UART3_FIFO_SIZE ,3 ,NULL , s->irq_table[exynos4210_get_irq(EXYNOS4210_UART_INT_GRP, 3)]); +/*** SD/MMC host controllers ***/ + +sysbus_create_simple ("exynos4210.sdhci" ,EXYNOS4210_SDHC0_BASE_ADDR , + s->irq_table[exynos4210_get_irq (29 ,0 )]); + +sysbus_create_simple ("exynos4210.sdhci" ,EXYNOS4210_SDHC1_BASE_ADDR , + s->irq_table[exynos4210_get_irq (29 ,1 )]); + +sysbus_create_simple ("exynos4210.sdhci" ,EXYNOS4210_SDHC2_BASE_ADDR , + s->irq_table[exynos4210_get_irq (29 ,2 )]); + +sysbus_create_simple ("exynos4210.sdhci" ,EXYNOS4210_SDHC3_BASE_ADDR , + s->irq_table[exynos4210_get_irq (29 ,3 )]); +/*** Display controller (FIMD) ***/ sysbus_create_varargs("exynos4210.fimd", EXYNOS4210_FIMD0_BASE_ADDR, s->irq_table[exynos4210_get_irq(11, 0)],
hw/exynos4210_sdhci.c new file +444 -0
444 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Hello Igor,
Thanks for you reply and your time.
JC
Quoted 5 lines · Igor Mitsyanko
On 09/04/2012 02:13 AM, Jean-Christophe DUBOIS wrote:
Hello, Jean!
I've just tried to do the same thing you're trying to do, it works for me if I remove earlyprintk from append.
Yes, I found out about this in the mean time.
Quoted 1 line
Probably this is due to the fact that kernel expects uart0 to be configured by u-boot prior to kernel start execution. Interestingly, if you change default
exynos4_defconfigCONFIG_DEBUG_S3C_UART0to, for example,CONFIG_DEBUG_S3C_UART2in linux kernel configuration, everything starting to work fine even with earlyprintk.
Seems strange. It would be nice if "earlyprintk" was not hanging though (is it possible to work around the actual LSP expectation?).
Quoted 2 lines
But using ramdisks is always a pain for me, I would suggest you two different approaches:
Ramdisk is fine for what I need to do at this time.
Quoted 4 lines
1) The most convenient way is to use emulated SD card for rootfs storage. There is no SD card support for exynos4210 in current QEMU master, but you can apply SD host controller patches I attached to this email to get this support. These patches already have been thoroughly reviewed in qemu-devel mailing list and hopefully would be applied to QEMU master soon enough. If you want to use SD card instead of RAMDISK, apply these patches to QEMU master with "git am", and enable MMC/SD support in linux kernel configuration (it is disabled by default in
exynos4_defconfig). You need to checkCONFIG_MMC,CONFIG_MMC_SDHC,CONFIG_MMC_SDHCI_S3CandONFIG_MMC_SDHCI_S3C_DMA.
Then you can launch QEMU with -sd /path/to/your/rootfs and, for example, append line -append "root=/dev/mmcblk0 rootfstype=ext4 rw rootwait".
Thanks. That seems interesting but I don't need it right now. I can wait for this patch to hit mainline.
Quoted 6 lines
2) If you want to work only with what current QEMU master has, you can use network filesystem as rootfs, but only for smdkc210 board (nuri board doesn't have any net devices). You're gonna have to check these options in Linux configuration:
CONFIG_NET,CONFIG_PACKET,CONFIG_INET,CONFIG_IP_PNP,CONFIG_IP_PNP_DHCP,CONFIG_NETDEVICES,CONFIG_SMSC911X,CONFIG_NFS_FS,CONFIG_ROOT_NFS.
Then, if, for example, you have directory/mnt/nfsrootexported by NFS server on your host machine, you can launch QEMU guest with following command line:qemu-system-arm -kernel ./zImage -M smdkc210 -append "console=ttySAC0,115200n8 ip=dhcp root=/dev/nfs nfsroot=10.0.2.2:/mnt/nfsroot/ rw" -serial stdio
Unfortunately, network will have to wait too. But it will come in a second step.
Quoted 3 lines
Also, maybe you noticed, graphic support is disabled in
exynos4_defconfigby default. To enable it, check these options in Linux configuration:CONFIG_DRM,CONFIG_DRM_EXYNOS,CONFIG_DRM_EXYNOS_DMABUF,CONFIG_DRM_EXYNOS_FIMD. You can also checkCONFIG_LOGOto get a fancy penguins during guest VM startup. And if you need to start X server on your guest VM, you also need to enable UNIX domain sockets in linux kernelCONFIG_UNIX.
Thanks. I'll look at this later. No graphic is needed for now. A serial console is all I need.