[EDIT] I have written a new updated version of this post here.
Last time I experimented on compiling bare-metal ARM programs and U-Boot; now I want to compile a Linux kernel for an ARM architecture from scratch. I don’t have a physical ARM device handy, so I’m using QEMU instead, as I’ve already done before.
Both the mainline kernel and QEMU support the VersatilePB platform, so that’s the target I chose for my tests. The toolchain I’ll be using is the CodeSourcery ARM EABI toolchain. [edit] From version 2010q1 of the toolchain, the manual explicitly says that the compiler is not intended for Linux kernel development; it is anyway possible to use the GNU/Linux toolchain for the same scope. [/edit]
The vanilla kernel can be downloaded from kernel.org; I took the latest at the moment (version 2.6.33) and extracted it in a folder. From that folder I ran:
make ARCH=arm versatile_defconfig
This command sets a predefined configuration, used in compilation, that is capable of building a kernel targeted to run inside the VersatilePB board. I wanted to tweak it a little bit, so I ran:
make ARCH=arm menuconfig
I removed module support (for simplicity) and enabled EABI support as a binary format (allowing also old ABI). This is necessary to run software compiled with the CodeSourcery toolchain. I exited the menu and saved the configuration, then I ran:
make ARCH=arm CROSS_COMPILE=arm-none-eabi- all
[edit] If using the GNU/Linux toolchain, the command that must be used is, instead:
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- all
[/edit]
This will start the building of the kernel using the correct ARM compiler; the build will create, among other binaries, a compressed kernel in a file called zImage
located in “arch/arm/boot
“. This image can be run in QEMU using the following command (assuming that you are in the “arch/arm/boot
” directory):
qemu-system-arm -M versatilepb -m 128M -kernel zImage
QEMU will execute the Linux image: the kernel will display many boot messages and then it will complain that it didn’t find a root filesystem. Let’s then create the simplest filesystem we can do: it consists of a single “Hello World” executable, that can be built using the CodeSourcery GNU/Linux toolchain.
#include <stdio.h> void main() { printf("Hello World!\n"); while(1); }
Note: an infinite loop is introduced because when Linux executes the first program in the root filesystem, it expects that the program does not exit.
Having the GNU/Linux ARM toolchain installed (be aware that it is different from the bare EABI toolchain) I ran:
arm-none-linux-gnueabi-gcc -static test.c -o test
This creates an executable ELF program for ARM, statically linked (all the libraries that it needs are linked together in a single binary). We can now create a simple filesystem using the cpio
tool as follows:
echo test | cpio -o --format=newc > rootfs
The cpio
tool takes a list of files and outputs an archive; the newc
format is the format of the initramfs
filesystem, that the Linux kernel recognizes. The rootfs
file in our case is a binary image of a filesystem containing a single file, that is the test ELF program. QEMU can pass the filesystem binary image to the kernel using the initrd
parameter; the kernel must also know that the root filesystem will be located in RAM (because that’s where QEMU writes the initrd
binary) and that the program to launch is our test
executable, so the command line becomes:
qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -append "root=/dev/ram rdinit=/test"
The QEMU window will show the boot messages we saw before, but at the end of the execution a “Hello World!” will be displayed. The next step would be to create a working filesystem with a command shell and at least basic functionality.
Fabio
2010/03/23
Hi Balau,
I’ve been following your blog for some weeks. I am working on something related to your last posts. I am trying to get to run a profiler (e.g. gprof) under qemu simulating an ARM board. My idea is to compile my application using arm-none-eabi with -eg, then link it with the kernel, as you did with your Helloworld example. Have you ever tried something like that?
Regards.
Balau
2010/03/23
I never tried it on QEMU, yet. I know that gprof-compiled programs write a gmon.out log on execution, and this can’t be done in my example because everything happens in RAM. Instead of mounting a ramdisk you should mount a root filesystem from NFS, so that the gmon.out can be written on a real disk. This page can help somehow to setup NFS for QEMU, but I already planned on doing a post on this topic to extend my examples.
A couple of notes:
Fabio
2010/03/25
Hi Balau.
I wasn’t aware of this constraint of the qemu. What I need to have profiled is a video codec, which will be implemented in hardware afterwards. Therefore I have to find another simulator. I was thinking of skyeye, although it is not clear whether is supports cycle-accurate simulation. I found some other options on the web, but must of them are very restricted.
Balau
2010/03/25
Unfortunately I never searched for free cycle-accurate simulators. The proprietary RVISS/ARMulator could give a very precise (but not 100% cycle accurate: see its manual) estimate of the code performance if it is configured as the real system, because it can model memory with configurable delay as well as caches and Tightly Coupled Memory (ITCM and DTCM).
M.Vivek
2010/05/28
Hi Balau,
In the “Quick Start” chapter of Sourcery G++ Lite, it mentions that the EABI configuration is *not* intended for kernel/application development.
Did you consider using any other configuration (e.g. the “GNU/Linux” configuration) in your experiments.
Thanks,
Vivek
Balau
2010/05/29
Hello M.Vivek,
I just tried to compile the linux kernel using:
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- all
The kernel works just fine.
The version of Sourcery I used (arm-none-eabi-gcc Sourcery G++ Lite 2008q3-66 4.3.2) did not contain that information in the manuals. I’m gonna add this to the post, thanks!
Brian Mahaffy
2010/06/11
Hi Balau & Vivec,
For compiling the Linux kernel, either toolchain will work. The difference between the two toolchains are the libraries provided. The EABI (Enhanced/Extended ARM Binary Interface) version of the tools (sometimes called the “Bare Metal” compiler) will generate code containing library calls resolved by something like NewLib (http://sourceware.org/newlib/). The gnueabi tools on the other hand only link in a stub library that makes software interrupts to the Linux kernel to satisfy the library calls.
For compiling the Linux kernel though, none of this ends up mattering, as the Kernel does not use any LibC calls. Either toolchain works. It is not until you make a Linux userspace program that is is an issue. Conversely, if you are building a bare metal program, you either need to provide your own implementations of things found in the standard lib, or you need to link to something like NewLib and use the EABI tools.
…Brian
Johan
2010/07/21
Hi
In your example all the kernel logs is sent to the graphical window and not to a serial console.
If you start qemu with:
qemu-system-arm -M versatilepb -m 128M -serial stdio -kernel zImage
Then you get “Uncompressing Linux… done, booting the kernel.
” in the terminal but nothing more.
Do you know how to get all the boot logs to be sent there and not to the graphical window?
Thanks
Johan
Balau
2010/07/21
you need to add “console=ttyAMA0” to the kernel options. Instead of the command in my post, run:
qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -serial stdio -append "console=ttyAMA0 root=/dev/ram rdinit=/test"
You can also use “-nographic” instead of “-serial stdio” to launch QEMU without opening another window, but then to close it you have to type Ctrl-A and then “x”.
Johan
2010/07/21
Thanks the
-serial stdio -append “console=ttyAMA0”
works quite nice.
Robert Smith
2010/09/13
Hi, Thank you for very interesting posts.
I’ve built kernel v2.6.33.2 (using tool-chain arm-unknown-linux-uclibcgnueabi produced by Crosstool-NG 1.7.0) and successfuly simulated VersatilePB board on Qemu following your post. I run qemu under Ubuntu 9.10.
However when I tried to repeat the same for realview arm board I got the very strange behaviour:
make ARCH=arm realview_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-
qemu-system-arm -M realview -kernel zImage.2.6.33.2.realview -initrd
initramfs.cpio.gz
I got blank Qemu screen on the target system. If I open Qemu serial console (Ctrl + Alt + 3) then I see:
serial0 console
Uncompressing Linux…Uncompressing Linux…
Not a gzip file
— System halted
This is very strange, because, as I said above VersatilePB kernel created with the same tool-chain worked fine. Could you advise how to deal with and investigate such kind of problems?
Thanks
Balau
2010/09/13
Unfortunately I have no experience on the RealView boards. I tried to compile the kernel (both 2.6.33 and 2.6.34) like you did, only with CodeSourcery toolchain, and had the same results you had. I noticed that, giving the option
-cpu arm1136
, it prints “Uncompressing Linux... done, booting the kernel.
” then stops.You could do the following:
– Recompile the kernel with debugging symbols (the configuration should be in “kernel hacking” section inside the kernel menuconfig)
– Launch QEMU with debugging enabled (“-s -S” to launch it stopped and waiting for GDB)
– Launch GDB with something like this (If you have ddd installed and your toolchain comes with gdb):
$
ddd --debugger arm-unknown-linux-uclibcgnueabi-gdb -- vmlinux
– Inside GDB:
(gdb) target remote localhost:1234
(gdb) b start_kernel
(gdb) c
– Try to debug step-by-step the kernel and understand what’s doing nasty things.
Vinicius do Vale
2010/10/25
Hi Balau. Very interesting this post.
I run Qemu under Ubuntu 10.04 and I followed step-by-step but I’m suceeded not emulated the VersatilePB on Qemu. The QEMU window shows the boot messages, but the Kernel Panic Message is showed.
“No filesystem could mount root, tried: ext2 cramfs minix romfs
Kernel Panic – not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
Could you help-me?
Regards.
Balau
2010/10/26
It could mean the
rootfs
is not recognized or does not contain the program you specify withrdinit
kernel option.Check that:
– the
rootfs
is a little bigger than thetest
file. It’s an indication that the filesystem contains your file.– the beginning of the
rootfs
file is something like “070701” in ASCII (30 37 30 37 30 31 in hexadecimal).– you use the
rdinit
kernel option using the correct filename.Try also to run the following command instead, to create the filesystem:
echo ./test | cpio -o --format=newc > rootfs
Míla
2010/11/22
Hi Balau,
I’ve followed all steps, I even downloaded the same linux kernel sources and toolchain, but still not able to run ARM kernel in QEMU. I got an error:
“Kernel panic – not syncing: Attempted to kill init!”
when passed correct filename to rdinit. My rootfs is surely ok, test is build using same toolchain as kernel (GNU/Linux toolchain from CodeSourcery). When I use incorrect filename in rdinit, I get same error as Vinicius do Vale:
“No filesystem could mount root, tried: ext2 cramfs minix romfs
Kernel Panic – not syncing: VFS: Unable to mount root fs on unknown-block(1,0)”
So I suppose that my test in rootfs is run, but something else is wrong. Any idea?
Could you please provide yours kerenel zImage and rootfs? I would like to check if I’m able to run it under my QEMU. Or can be something wrong with my qemu-system-arm? (I don’t suppose it, because it seeems that kernel is currently running)
I’m working on Ubuntu 10.04 and my command is
qemu-system-arm -m 128M -M versatilepb -kernel zImage -initrd rootfs -append "root=/dev/ram rdinit=/test"
When running in cosole:
$ qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrrootfs -serial stdio -append “console=ttyAMA0 root=/dev/ram rdinit=/test”
Uncompressing Linux… done, booting the kernel.
Linux version 2.6.33.7 (mkriz@DELLo) (gcc version 4.5.1 (Sourcery G++ Lite 2010.09-50) ) #1 Fri Nov 19 16:28:22 CET 2010
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00093177
CPU: VIVT data cache, VIVT instruction cache
Machine: ARM-Versatile PB
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512
Kernel command line: console=ttyAMA0 root=/dev/ram rdinit=/test
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 125852KB available (2916K code, 228K data, 116K init, 0K highmem)
Hierarchical RCU implementation.
RCU-based detection of stalled CPUs is enabled.
NR_IRQS:192
VIC @f1140000: id 0x00041190, vendor 0x41
Console: colour dummy device 80×30
Calibrating delay loop… 445.64 BogoMIPS (lpj=2228224)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
Serial: AMBA PL011 UART driver
dev:f1: ttyAMA0 at MMIO 0x101f1000 (irq = 12) is a AMBA/PL011
console [ttyAMA0] enabled
dev:f2: ttyAMA1 at MMIO 0x101f2000 (irq = 13) is a AMBA/PL011
dev:f3: ttyAMA2 at MMIO 0x101f3000 (irq = 14) is a AMBA/PL011
fpga:09: ttyAMA3 at MMIO 0x10009000 (irq = 38) is a AMBA/PL011
bio: create slab at 0
SCSI subsystem initialized
Switching to clocksource timer3
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Trying to unpack rootfs image as initramfs…
Freeing initrd memory: 632K
NetWinder Floating Point Emulator V0.97 (double precision)
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 247
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
CLCD: unknown LCD panel ID 0x00001000, using VGA
CLCD: Versatile hardware, VGA display
Console: switching to colour frame buffer device 80×60
brd: module loaded
Uniform Multi-Platform E-IDE driver
ide-gd driver 1.18
smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre
eth0: SMC91C11xFD (rev 1) at c8800000 IRQ 25 [nowait]
eth0: Ethernet addr: 52:54:00:12:34:56
mice: PS/2 mouse device common for all mice
TCP cubic registered
NET: Registered protocol family 17
VFP support v0.3: implementor 41 architecture 1 part 10 variant 9 rev 0
Freeing init memory: 116K
Kernel panic – not syncing: Attempted to kill init!
Backtrace:
[] (dump_backtrace+0x0/0x110) from [] (dump_stack+0x18/0x1c)
r6:c7815c40 r5:00000004 r4:c0319044
[] (dump_stack+0x0/0x1c) from [] (panic+0x48/0x124)
[] (panic+0x0/0x124) from [] (do_exit+0x68/0x5c8)
r3:c03059d0 r2:c781fe40 r1:00000001 r0:c02c0bdd
[] (do_exit+0x0/0x5c8) from [] (do_group_exit+0x94/0xc8)
r7:c781ffb0
[] (do_group_exit+0x0/0xc8) from [] (get_signal_to_deliver+0x328/0x360)
r4:0830009f
[] (get_signal_to_deliver+0x0/0x360) from [] (do_signal+0x70/0x5dc)
[] (do_signal+0x0/0x5dc) from [] (do_notify_resume+0x20/0x54)
[] (do_notify_resume+0x0/0x54) from [] (work_pending+0x1c/0x20)
r4:00000000
Thanks!
Balau
2010/11/22
If the message is “Kernel panic – not syncing: Attempted to kill init!” then it seems that your test program is exiting in some way.
– It could be that the while(1) loop is optimized out (unlikely) and the program exits. You can check the generated assembler to see if there is a loop in the main function. Then compile without optimization (“-O0”)
– Have you enabled EABI support in the kernel menuconfig? (CONFIG_AEABI=y should be inside the config file)
– Maybe there’s something in the system calls of the new toolchain you use that is incompatible with the one I used. I used the 2009-q3-67 one: http://www.codesourcery.com/sgpp/lite/arm/portal/release1039
I will send you the rootfs together with the kernel, if it does not work then the problem could be QEMU.
Míla
2010/11/22
Hi,
I’m sorry for wasting your time. I didn’t understand what’s EABI and I couldn’t find the option before. Now I have read something about ABI / EABI and I understand my error.
Thanks a lot for yours tutorials, they are very useful and educational.
Best regards.
Balau
2010/11/22
No problem! We’re all here to learn.
Check out this Debian page that contains some information about the ABI/EABI mess: http://wiki.debian.org/ArmEabiPort
Puente
2010/11/25
Hello, sorry by my English, I talk Spain,
First, thanks you by the post, is very good, but I need emulate s3c2410_defconfig kernel configuration, “make s3c2410_defconfig” “make menuconfig” and “make all” using ARCH and CROSS_COMPILE variable is fine. Now, when I try emulate with qemu, show a black screen and no more, without mistakes.
If you have any answer for this, I will be thank to you.
Balau
2010/11/25
Hello!
QEMU does not support the board you’re trying to emulate. Unless you are running a modified version of QEMU that emulates the s3c2410, I don’t think that you can do what you are trying to do.
Puente
2010/11/25
I’m trying to build a System with the arm920t CPU, but I don’t have the real (physical) target, this is the reason for that, I need emulate this System on a x86, but if qemu don’t can, I don’t know how doing that.
Thanks.
Adithya
2011/01/27
I have a very silly doubt, plz dont mind.
In the below command:
qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -append “root=/dev/ram rdinit=/test”
The linux kernel is in zImage, but where is the bootloader. I suppose that in your previous post regarding hello world for bare metal arm, the booting and necessary memory map were built into the test.bin. And the U-boot should be doing this for a linux kernel. But i dint understand where is the bootloader in the above command.
Balau
2011/01/27
Don’t worry, it’s not a silly doubt because the answer is hidden in QEMU internal working 🙂
In fact, QEMU acts as a bootloader in the sense that it puts zImage in a fixed location in the emulated RAM, then prepares the environment of the emulated machine, such as setting the registers, preparing the ATAGs structures according to QEMU options (“initrd”, “append”, …), and then jumps to the kernel start address to begin execution.
I discovered it by starting QEMU with the “-s -S” options to make it freeze on start, and then attaching to it with a debugger such as arm-none-eabi-gdb.
Adithya
2011/02/14
Hai
I m not very used to gdb, can u tell me the exact commands i need to type to see the booting process.
I have tried doing gdb over zImage but it says format not recognised.
Thanks in Advance !
Balau
2011/02/14
One problem is that QEMU installed from Ubuntu does not support debugging. You have to compile and install it from source or, better, use Linaro Tools PPA to install the package qemu-linaro.
Before you compile the kernel with “make … all” I suggest you enable the “compile with debug info” configuration that is present in the “make … menuconfig” screen in section “kernel hacking”.
The kernel compilation produces “arch/arm/boot/zImage” as a compressed kernel image, but also “vmlinux” as an executable, and “vmlinux” is the file to point to GDB, not zImage.
To debug the kernel I run this command:
$ qemu-system-arm -M versatilepb -m 128M -kernel arch/arm/boot/zImage -s -S
QEMU will start in a freezed state, waiting from a GDB connection to port 1234. Then, from another window, I run DDD with this command:
$ ddd --debugger arm-none-eabi-gdb vmlinux
When the terminal opens, I run the commands:
target remote localhost:1234
break start_kernel
continue
And then you can debug step by step or make your own breakpoints.
You can also check out these slides: Debugging with QEMU
dwnlds
2011/02/19
QEMU supports mini2440 board?
Balau
2011/02/19
It does not support it officially, but it seems that there are people providing patches for it.
See these instructions: http://gnufiish.org/trac/wiki/Qemu
The projects involved are this: http://code.google.com/p/mini2440/ and this: http://repo.or.cz/w/qemu/mini2440.git
I can’t guarantee if they work and if they are stable, but it’s a start!
naveed ahmad
2011/03/01
hi,
i am facing an issue, can you help be bro, i cross compiled for ARM, but now i am struck at hello program,
i need your help, i am unable to compile c program using code sourcery toolchain, tell me what i can do,
plz
naveed ahmad
naviduett@gmail.com
Balau
2011/03/01
First of all don’t panic, and then tell us:
without this information it’s hard to solve your problem.
naveed ahmad
2011/03/01
thanks sir for reply
———————–
i followed your steps that you mentioned for “Compiling Linux kernel for QEMU ARM emulator”.
cross compilation is done,
i run this command in respective dir ,qemu-system-arm -M versatilepb -m 128M -kernel zImage
and i am getting roof file system error and many other error,
then according to your article i make hello program and try to compile it with “Code Sourcery tool chain ” but i am getting error
“/root/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol _start; defaulting to 00008018”
command is root@nido:/home/naveed/Desktop# arm-none-eabi-gcc -static test.c -o test
………………..
i am stuck here, i dont know what i am missing, i tried to found it on internet but could not.
i will be really thank full you sir,
regrads
Naveed Ahmad
Balau
2011/03/01
The problem is that you are using the “bare metal” toolchain “arm-none-eabi” instead of the Linux toolchain “arm-none-linux-gnueabi” that can be downloaded here.
I’m sorry if it was not so clear in my post!
naveed ahmad
2011/03/01
i downloaded “arm-2010.09-50-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 ” from “http://www.codesourcery.com/sgpp/lite/arm/portal/release1600”,
i will check this and will back to you if i face any issue.
Thanks for help.. 🙂
Naveed Ahmad
naveed ahmad
2011/03/01
sorry sir again for disturbance,
there is no command arm-none-linux-gnueab after adding PATH in /etc/envir… file.
arm-none-eabi is available, 😦 bad day for me.
i am new in embedded linux so that i am getting a lot errors,
sorry for this disturbance sir
Balau
2011/03/01
Have you tried logging out and logging in again? /etc/environment should be applied when you login.
What you should have is “arm-none-linux-gnueabi-gcc” and all the other tools.
Maybe you misspelled “arm-none-linux-gnueab” without the “i”, because if you try to execute “arm-none-linux-gnueab-gcc” it does not exist :).
naveed ahmad
2011/03/01
i restart the VM but no effect, well i will try it tomorrow , and then i will update you.
Thanks,
naveed ahmad
2011/03/02
hi sir,
hope so you will be fine, well first of sorry i was using wrong toolchain, but know that command is available, i compile hello program using that command,
i move output of arm-none-linux-gnueabi-gcc -static test.c -o test
after applying cpio command to /
———
then i run qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -append “root=/dev/ram rdinit=/test”
but it give me the same out put, no hello message in it 😦
sorry for these ridiculous questions..
Naveed Ahmad
2011/03/03
Dear sir Balau
———————————
hi sir,
hope so you will be fine, well first of sorry i was using wrong toolchain, but know that command is available, i compile hello program using that command,
i move output of arm-none-linux-gnueabi-gcc -static test.c -o test
after applying cpio command to /
———
then i run qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -append “root=/dev/ram rdinit=/test”
but it give me the same out put, no hello message in it 😦
sorry for these ridiculous questions..
Naveed Ahmad
2011/03/03
guide me if i am missing some thing plz
Thanks
Balau
2011/03/03
First of all don’t panic.
Then, what do you mean by moving the output? you don’t have to move anything.
Then you don’t apply cpio command to /, but you run cpio to create a root filesystem image.
When you say “it give me the same output”, can you copy here the last lines? if you can’t copy/paste, run:
qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -serial stdio -append "root=/dev/ram rdinit=/test console=ttyAMA0"
in this case the output is on the terminal and you can copy/paste.
Adithya
2011/03/08
What is the difference between “arm-none-eabi” “arm-none-linux-gnueabi” ? I mean when should we use each one of them.
Adithya
2011/03/08
What do these kind of error mean ??? I m executing a kernel built for realview board. What are the areas i can look into for resolving these kind of errors.
Uncompressing Linux…qemu: fatal: Trying to execute code outside RAM or ROM at 0xbe800000
R00=7011070d R01=0000076d R02=411a4c00 R03=e012bce2
R04=00000000 R05=00000028 R06=70110667 R07=80007efd
R08=70111c1c R09=701116f0 R10=7011272c R11=70111604
R12=7001b67b R13=00000000 R14=70010014 R15=be800000
PSR=800001db N— A und32
Aborted (core dumped)
Balau
2011/03/08
See one of the comments above yours for the difference between the two toolchains.
About your error: R15 is the program counter, so a piece of code tried to jump to a strange address. R14 is the Link Register that usually holds the return address when you call a function. Based on the output, the code that generates the error is the one that uncompresses the kernel image into another location. I think you can try some of the following:
Try to use the “-m” option to set the memory size of QEMU to a bigger or smaller value.
Check the memory map of the realview board to see where ROM and RAM are and what’s at 0xbe800000.
Debug QEMU with GDB (also check the end of this blog post for some information on debugging QEMU execution) to see what’s the initial situation and when the problem happens.
In my experience these problems are usually related to a mismatch between the real memory size and the memory size that the software thinks to have available.
Adithya
2011/03/09
Hello, the missing thing was i disabled MMU support for the kernel during the build.
I enabled it and now, i get the output:
“Uncompressing Linux … , booting Linux”
and it probably goes into an infinite loop.
When i gdb into it, I find it stops at:
“__delay() at arch/arm/lib/delay.S”
and now i do bt to find this
#1 panic_blink_one_second
#2 panic(Attempted to kill idle task)
#3 do exit
#4 die
#5 do_kernel_fault
#6 do_page_fault
#7 do_translation_fault
#8 do_DataAbort
#9 __dabt_svc in arch/arm/kernel/entry-armv.S
BT Stoppped: Frame did not save the PC.
Now what is leading the kernel jump to: __dabt_svc
and How can i resolve it?
Thanx in Advance
Regards
Adithya
Adithya
2011/03/10
Hey Balau,
Finally, i sucessfully booted up ARM Realview Pbx A9 with multicore on Qemu with Busybox. It would not have been possible without your guidance. I thank you a lot for the prompt help and would look for further collaboration if i get stuck with some problems in future. Please keep up the great articles you write.
Happy Blogging!
Thanks and Regards,
B. Adithya
kaiwan
2011/03/19
Hi Balau,
Hey, awesome blog! Thanks for all the useful inputs & keep ’em coming.
Am hoping you/others can help me with a QEMU-initrd related issue:
Am having a consistent issue with attempting to mount a root filesystem using initrd
on the QEMU emulator.
This is on an x86 host w/ Ubuntu 10.10; the qemu guest is also x86 based (am using the 2.6.35-11 kernel).
I built a simple initrd image following the instructions you gave above, basically, doing:
find rootfs/ | cpio -o –format=newc > initrd.img .
Kernel config: made sure the these options were enabled:
CONFIG_BLK_DEV_LOOP
CONFIG_BLK_DEV_RAM
CONFIG_BLK_DEV_NBD
CONFIG_SATA_PMP=y
CONFIG_SATA_AHCI=y
CONFIG_AUTOFS_FS
CONFIG_AUTOFS4_FS
CONFIG_EXT3_FS=y
Then:
$ qemu -kernel arch/x86/boot/bzImage -curses -append “root=/dev/ram rdinit=/bin/busybox” -initrd ./initrd.img
…
For whatever reason, I get the (usual 🙂 panic message “VFS: Unable to mount root fs on unknown-block(1,0)”…
I even poked some instrumentation (printk’s -they start with ‘K:’ below) into the kernel to help debug the situation.
Here’s the dump when it panics:
…
[ 2.377397] K:initrd_load:131:
[ 2.477497] K:prepare_namespace:424:
m-devel@re377970] K:mount_block_root:248: fs_names = ext3 name=/dev/root
[ 2.384533] K:mount_block_root:248: fs_names = ext3 name=/dev/root
[ 2.385757] K:mount_block_root:248: fs_names = ext3 name=/dev/root
86647] K:mount_block_root:248: fs_names = ext3 name=/dev/root
[ 2.392216] List of all partitions:
[ 2.392605] 0b00 1048575 sr0 driver: sr
[ 2.392751] No filesystem could mount root, tried: ext3 vfat msdos iso9660
[ 2.393038] Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(1,0) 1
[ 2.393407] Pid: 1, comm: swapper Not tainted 2.6.35.11 #29 s secs 393511] Call Trace:
[ 2.393767] [] ? printk+0xf/0x11
[ 2.393948] [] panic+0x4b/0xb9
[ 2.394128] [] mount_block_root+0x183/0x192
[ 2.394220] [] ? T.1053+0x38/0x3e
[ 2.494323] [] mount_root+0x5a/0x78
[ 2.394400] [] prepare_namespace+0x1e8/0x260
[ 2.394481] [] kernel_init+0x252/0x2b2
[ 2.494561] [] ? kernel_init+0x0/0x2b2
[ 2.494638] [] kernel_thread_helper+0x6/0x10
Looking at existing forums, this seems to be a pretty common issue.
Would greatly appreciate a solution / inputs on the same.
TIA,
kaiwan.
Balau
2011/03/20
I tried to reproduce what you did, and I think the problem may be in the creation of the initrd image.
Instead of this:
$ find rootfs/ | cpio -o –format=newc > initrd.img
Try to do this:
$ cd rootfs
$ find . | cpio -o –format=newc > ../initrd.img
kaiwan
2011/03/21
Balau,
(wrt comment # 733 above):
Yes, it worked!
The pathnames being wrong it wasn’t working, i think… (prefixed w/ rootfs/ ).
Thanks v much!
Best.
kaiwan
2011/03/21
(Continuing wrt comment # 734 above):
Interestingly, one can see the path if the verbose option (-v) to cpio is used:
# find . | cpio -o –format=newc -v > ../initrd.img
.
./dev
./dev/mem
./dev/kmem
./dev/null
./dev/zero
./dev/random
…
#
So i guess it’s a good idea to use this option.
alex
2011/04/21
Hi All
Could you please tell how to create initrd image from basic file system to use output in qemu.
Every time it is showing panic
What are points are considered,in kernel & file system while compiling
Let me know some inputs
Balau
2011/04/21
Hi Alex,
if you don’t have already, check my other blog posts about creating and booting a minimal working filesystem:
Busybox for ARM on QEMU
Booting Linux with U-Boot on QEMU ARM
Uday Shankar
2011/04/23
Hello, I am Uday shankar S
I have the following problem
When i execute the following line
make ARCH=arm CROSS_COMPILE=arm-none-eabi-gcc- all (i get following error)
make: arm-none-eabi-gcc-gcc: Command not found
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h’ is up to date.
CC kernel/bounds.s
/bin/sh: arm-none-eabi-gcc-gcc: command not found
make[1]: *** [kernel/bounds.s] Error 127
make: *** [prepare0] Error 2
Have i installed a different tool chain??
Please help me solve this problem
Balau
2011/04/23
You have to run the “
make
” command with “CROSS_COMPILE=arm-none-eabi-
” without the “gcc
“, because it is appended later inside the Makefile.enzofang
2011/05/06
Hi,
i just follow the tutorial,compile the kernel and make rootfs,
and everything seems OK,but at the end i can’t see “hello world”
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Trying to unpack rootfs image as initramfs…
Freeing initrd memory: 632K
NetWinder Floating Point Emulator V0.97 (double precision)
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 247
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
CLCD: unknown LCD panel ID 0x00001000, using VGA
CLCD: Versatile hardware, VGA display
Console: switching to colour frame buffer device 80×60
brd: module loaded
smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre
eth0: SMC91C11xFD (rev 1) at c8800000 IRQ 25 [nowait]
eth0: Ethernet addr: 52:54:00:12:34:56
mice: PS/2 mouse device common for all mice
TCP cubic registered
NET: Registered protocol family 17
VFP support v0.3: implementor 41 architecture 1 part 10 variant 9 rev 0
Freeing init memory: 100K
input: AT Raw Set 2 keyboard as /devices/fpga:06/serio0/input/input0
input: ImExPS/2 Generic Explorer Mouse as /devices/fpga:07/serio1/input/input1
the kernel does not give me panic or error message ,i don’t know what’s wrong, can you help me solve the problem
Balau
2011/05/07
Instead of the command that I wrote in the post, try this one:
$ qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -append "root=/dev/ram rdinit=/test console=ttyAMA0" -serial stdio
It should print everything on your terminal instead of on the black window.
Also, try to change “test.c” to do nothing and return, it should give you a “Kernel panic” message and you will know it is being executed.
enzofang
2011/05/07
Hi Balau,
thanks for your answer. I found i lost “\n” in the printf statement
So the kernel doesn’t print the hello message.Now it works fine
hienhoang
2011/05/10
Hi Balau,
First of all, many thanks for your interesting post. Currently, I am working on a project about Android. The project is to port Android to MIPS platform. Since I don’t have a real kit, I want to use QEMU instead. As I know, the procedure of porting Android to MIPS platform is quite similar to the way to port Linux to ARM. I have to compile the Linux kernel for MIPS platform (in my case, I chose Malta board ) as the way to compile Linux kernel for ARM. Also, I have to build a root file system. But when I use the command which is similar to your guide, it didn’t work. the message shown “kernel panic….”. I wonder if QEMU supports for emulating Android on MIPS platform or not? if yes, how can I port Android to MIPS using QEMU? Wish you can help me. Thank you again.
Balau
2011/05/12
Unfortunately I have no experience on MIPS architectures. QEMU should emulate the Malta and it should at least find the filesystem, but I don’t know if the full Android could work. Without knowing anything my guess is that the toolchain (gcc, libc, …) creates binaries that can’t be executed by that configuration of Linux kernel.
Ramesh Dixit
2011/05/23
Sir,
I’m trying to make menuconfig a kernel, but I get this error:
Code:
basement:/usr/src/linux# make menuconfig
/usr/bin/ld: cannot find -lncurses
collect2: ld returned 1 exit status
>> Unable to find the Ncurses libraries.
>>
>> You must install ncurses-devel in order
>> to use ‘make menuconfig’
make[2]: *** [scripts/lxdialog/ncurses] Error 1
make[1]: *** [menuconfig] Error 2
make: *** [menuconfig] Error 2.
So Pls suggest me How to install ncurses..?
Balau
2011/05/23
You have to install the “ncurses” development library that is used to display the configuration menus.
if you have Ubuntu the command is “
sudo apt-get install libncurses5-dev
“, with Debian it should be “aptitude install libncurses5-dev
” and it should be similar for other distributions.Then you run in the Linux source tree “
make distclean
” to remove all the compilation output, and try to run again “make menuconfig
“.Ramesh Dixit
2011/05/24
Sir.
Thank you for your help, But now I am facing one more problem, after typing the last command that is qemu-system-arm………..-append “root=/dev/ram rdinit=/hello” The qemu(black window) window ll appears, but it could display anything just a blackwindow, thats all. I have used linux kernel version 2.6.39. what might be the problem…? i ve installed qemu kvm extras by sudo apt get install,
Balau
2011/05/24
Try to add the “-serial stdio” option to the QEMU command to show the emulated serial port output on the terminal:
qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -append "root=/dev/ram rdinit=/test" -serial stdio
try also to add “console=ttyAMA0” to redirect the kernel messages to the serial port:
qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -append "root=/dev/ram rdinit=/test console=ttyAMA0" -serial stdio
If you need the messages to show inside the window, maybe using “console=tty1” could work.
Ramesh Dixit
2011/05/25
Sir,
I have tried both the options but still I could not see anything on qemu window(just a blank back screen). Pls help…..
Balau
2011/05/25
The options that I gave you don’t display anything in the qemu black window, but they display it in the terminal window (the one where you run the “
qemu-system-arm ...
” command). What do you see in the terminal window? Do you see at least “Uncompressing Linux... done, booting the kernel.
” message?Ramesh Dixit
2011/06/02
Ya sir, I got that msg….
Balau
2011/06/02
I tried right now to compile kernel 2.6.39 and it worked for me (so the version is not the problem), using both CodeSourcery toolchains:
arm-none-eabi-
orarm-none-linux-gnueabi-
.Maybe the “make distclean” I suggested before could be the problem, because it didn’t remove something; try to redo everything running also “make distclean ARCH=arm”, and then remember to use “ARCH=arm” on all “make” commands.
Mehran Spitman
2011/06/05
Hi Balau,
Thanks for your useful post. I’m working on a project which I have to compile a series of programs for an ARM based system. I compiled Linux kernel, but my question is how can i compile those specified programs for this kernel? I see how you compile your test c program for target platform. can i use arm-none-linux-gnueabi-gcc for compiling for example “lighttpd”? how can I enforce the programs to use arm-none-linux-gnueabi-gcc instead of native gcc on my host Linux?
Balau
2011/06/06
You can take a look at this blog post: Debugging ARM programs inside QEMU, that cross-compiles a simple hello-world program using “
./configure --host=arm-none-linux-gnueabi
” when compiling. If you need many packages that depends on many libraries, I think that the simplest way to do it is by using a distribution that already provides binary packages compiled for ARM, such as Debian or Ubuntu.cpalm
2011/06/15
I was able to compile and run the kernel image as instructed, i was also able to add the rfs as explained in your other article, but when i pass the option -cpu cortex-a8 i get an error in the console “unrecognized/unsupported processor variant”. when i normally boot without this option at the # prompt when type uname -a i see that it has emulated armv5. But how can add support for armv7?
Balau
2011/06/15
Newer versions of QEMU have support for the Versatile Platform Baseboard with Cortex-A8 using the option “
-M realview-pb-a8
” without the “-cpu
” option. My QEMU is installed from the Ubuntu 10.10 package, and the package version is “0.12.5+noroms-0ubuntu7.5”. I think that updating your QEMU installation should add support for armv7, and if it doesn’t because your distribution has not yet the updated packages, you should try compiling from source, downloading the latest release.cpalm
2011/06/15
Hello balu,
thanks for your quick response. I have recompiled qemu 0.14 from the sources, i also see the option realview-pb-a8 when i type qemu-system-arm -M ?. For this to work do i have to recompile the kernel with realview_defconfig ? When i executed with this option with the kernel i have compiled with your instructions it just displays blank screen. Any idea?
thanks in advance
cpalm
cpalm
2011/06/16
hello balau
okay, i did recompile the kernel with realview_defconfig and executed the below command (i.e. as mentioned by you) it works (sort of)
qemu-system-arm -M realview-pb-a8 -m 128M -kernel zImage-realview
kernel boots with error messages. Then i run this command
qemu-system-arm -M realview-pb-a8 -m 128M -kernel zImage-realview -initrd rootfs -append “root=/dev/ram rdinit=/test”
then i simply get a blank screen.Any tips here?
thanks in advance
cpalm
Balau
2011/06/16
It’s strange that adding these options makes the screen go black, because they act only later during the boot process.
You could also try the “-serial stdio” option OR the “-nographic” option (Ctrl-A and x to exit when there’s no window to close).
Anyway it could be also useful to trace what’s happening at the beginning. Try to debug in this way:
Maybe something strange will pop up such as a jump to a strange address, an exception or a jump to non-initialized memory.
It could also be that QEMU does not support entirely the realview-pb-a8 platform and some hardware that is not emulated correctly breaks the kernel boot. Check the Linaro QEMU and Kernel releases, they could have up-to-date packages that support Cortex-A8 and Cortex-A9.
czar x
2011/06/21
hi,
i have tried building the kernel .36 and .39.1 both using the method you have mentioned.
but no matter what i do it will never display the boot messages
qemu-system-arm -M versatilepb -m 128M -kernel arch/arm/boot/zImage -serial stdio -append “console=ttyAMA0″
Uncompressing Linux… done, booting the kernel.
i have even tried to debug after enabling debug info (make menuconfig), it doesn’t break for start_kernel break point as u have mentioned in one of your comments.
Please help me to get the boot messages.
thanks
czar
czar x
2011/06/22
Hi
Heres a bit debugging update after i click stepi following is the location where the ddd (debugger) stops as u can see the kernel compiled is 2.6.39.1
———————-DDD command————————
Program received signal SIGINT, Interrupt.
calibrate_delay_converge () at init/calibrate.c:132
/media/15Gigs/kernel_work/linux-2.6.39.1/init/calibrate.c:132:3960:beg:0xc001deec
(gdb) stepi
——————————————————————-
Source at that particular location is:
130 /* wait for “start of” clock tick */
131 ticks = jiffies;
132 while (ticks == jiffies) /* czar comment here is where ddd points to */
133 ; /* nothing */
134 /* Go .. */
135 ticks = jiffies;
hope this helps you to resolve my issue.
thanks
czar
Balau
2011/06/23
I just tried to compile kernel 2.6.39.1 and it works for me, so maybe the problem is QEMU. what version do you have? My QEMU is installed from the Ubuntu 10.10 package, and the package version is “0.12.5+noroms-0ubuntu7.5″. As an alternative you can try to compile QEMU from source and see if something changes.
czar x
2011/06/24
Hi Balau,
u r expert.
it seems problem was indeed with qemu itself ubuntu10.04 and qemu version 0.12.3
i have download qemu both from linaro ( 0.14.50 qemu-linaro 2011.04-1) and qemu.org (0.14.1)
both worked fine.
thanks for support
I would like to know if you can provide some tutorial on testing kernel (ltp) over qemu and some device drivers.
it would be great addition to this series.
i will try the u-boot next.
thanx again for gr8 support
czar x
Balau
2011/06/25
Glad to help! I am not familiar with Linux Test Project if that’s what you meant by “lpt”, so obviously I can’t provide tutorials! But I’m going to take a look at it when I find some time. About device drivers, I think that QEMU offers emulation of peripherals that have already mature drivers in the kernel. It could be used to start developing modules that interact with hardware through other drivers, but the latest stages of developing and testing must be necessarily done on real hardware.
czar x
2011/06/28
Hi,
Yes, i meant Linux Test Project (ltp.sourceforge.net) since most of the time we are in scarcity or unavailability of the real hardware. QEMU gives an opportunity to test those modules.
In my personal interest to explore kernel i have planned to venture into
a) Linux testing
b) design device driver for existing peripheral following Greg KH’s book (Linux Device Driver) http://lwn.net/Kernel/LDD3/
I had pointers like ltp and kgtp (http://kgtp.googlecode.com/) which can be used for testing linux kernel.
I have little x86 knowledge and comfortable with ARM systems.
Hope u can still answer my few questions in the areas mentioned above.
thanx once again
czar
Piyush Pandey
2011/07/05
hello Balau
I was trying to run the cross compiled linux kernel for ARM architecture in the Qemu armulator and for that I followed the steps on your blog over here and in the same way as you have described.
But when I run the following command :
qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd /home/piyush/Documents/Embedded/ARM/ARM\ example\ codes/rootfs -append “root=/dev/ram rdinit=/test”
I get this error in the console of my Qemu ARM emulator:
info rcu detected cpu0 stall (t=10000 jiffies)
info rcu detected cpu0 stall (t=40000 jiffies)
info rcu detected cpu0 stall (t=80000 jiffies)
and nothing happens at all after that.
Please tell me where is the error and how to resolve it as I am very near to the running kernel of my ARM.
Thank you
Piyush Pandey
Balau
2011/07/05
Hello,
Could you please check if the output of the following commands is similar to yours?
$ file rootfs
rootfs: ASCII cpio archive (SVR4 with no CRC)
$ cpio -t < rootfs
test
1281 blocks
the “1281” could be different, and also the “SVR4 with no CRC” but roofs should be a cpio archive with “test” as its only file.
If the output you get is different, then rootfs has not been generated correctly.
Also, what version of QEMU are you using?
Piyush Pandey
2011/07/06
Hello Balau
I checked what you suggested and the output is as follows:
$ file rootfs
rootfs: ASCII cpio archive (SVR4 with no CRC)
$ cpio -t rootfs
Also I am using the following Qemu version:
version 0.5.1-20100120_010601-rothera
So Balau where is the problem . Please help me Bro.
Thanks
Balau
2011/07/07
Your problems are:
– the “
rootfs
” file has not been created correctly. There’s no “test
” file inside it. Please try to redo the “echo test | cpio -o --format=newc > rootfs
” command inside the directory that contains “test
“.– your QEMU version is 7 years old. I can’t be sure that my tutorial will work on it.
Piyush Pandey
2011/07/07
hello Balau
are you using the ubuntu Linux , if yes than how you installed the latest qemu on the ubuntu linux .
Please tell me about that, because I have searched every where and no where found the qemu latest installation on the ubuntu.
Thank you
Balau
2011/07/10
If you have a newer Ubuntu version (from 10.4 Lucid Lynx for example) you should have the package you need: http://packages.ubuntu.com/lucid/qemu-kvm-extras
Otherwise you need to download QEMU source code from here: http://wiki.qemu.org/Download , and compile it.
Somesh
2011/08/29
A very useful and concise explanation in the blog.
I tried carrying out the steps given in your blog. Just to reiterate, following is what I did,
– installed Code sourcery tool chain (arm-none-linux-gnueabi- prefixed binaries obtained)
– compiled linux 2.6.33 with the installed tool chain as follows,
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- all
– got zImage from the above compilation
– created a hello world file, cross compiled (with -static and -O0 flag) and created rootfs,
$ echo test.out | cpio -o –format=newc > rootfs
– ran the following command to check proper creation of rootfs
$ file test.out
&
$ cpio -t < rootfs
both give proper output as mentioned in a couple of replies of your post
– finally,
$ qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -append "root=/dev/ram rdinit=/test.out"
The booting ends with a kernel panic with kernel unable to mount the rootfs along with a back trace. Following is a snippet of message towards the end,
"
List of all partitions:
No filesystem could mount root, tried: ext3 vfat msdos iso9660
Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(1,0) 1
"
Also I tried emulating test.out with qemu-arm and it gives expected behavior of printing message and waiting in while(1)
If rootfs itself has failed to mount during kernel there would be no question of running "test.out". Do you have any inputs on how to solve this?
–thanks in advance–
Balau
2011/08/29
The problem is not in the compilation of test because Linux never goes
as far as executing it: it doesn’t even mount the rootfs. The
filesystem seems OK, so I think the problem is in the kernel
compilation or configuration.
In my case, if I try to give QEMU a bad filesystem as rootfs, I get the message:
List of all partitions:
No filesystem could mount root, tried: ext2 cramfs minix romfs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
In your description you didn’t include the kernel configuration (make
menuconfig). Have you configured the kernel in some custom way, such
as for example enabling/disabling some filesystem support?
Remember that if you need to go back to an original state of the
kernel source, you must run “
make distclean ARCH=arm
”Hope this helps.
Somesh
2011/08/30
Missed that point.
After configuring with the versatile defconfig file, I tried booting the image with loadable module support disabled. Because I am using arm-none-linux-gnueabi-* tool chain I have not selected option for “Use ARM EABI to compile kernel” under ‘Kernel Features’ (I tried booting with the option selected also in a different run).
The “Initial RAM file system and RAM disk (initramfs/initrd) support” is still selected under ‘General Setup’ of menuconfig. Although no value is there in “Initramfs source file(s)” under the same heading.
The kernel still fails to mount the rootfs with the test binary.
Would it make a difference in booting if kernel is compiled with arm-none-eabi-* tool chain set and arm-none-linux-gnueabi-* tool chain set?
Balau
2011/08/30
You have to enable ARM EABI if you want to execute user-space programs compiled with toolchains from CodeSourcery, Emdebian or Linaro.
It’s OK that the “initramfs source file(s)” option is empty, because it is used to embed the rootfs image inside the zImage, but in our case we supply it with QEMU.
The two toolchains you mention should behave in the same way when compiling Linux kernel.
I don’t know where the problem could be. The kernel version is clear, and I suppose the toolchain that you are using is quite new. Maybe the QEMU version is too old or the Linux distribution changed it and broke it. I’m currently using:
$ qemu-system-arm --version
QEMU emulator version 0.14.1 (Debian 0.14.1+dfsg-3), Copyright (c) 2003-2008 Fabrice Bellard
You can try to download and compile QEMU from source code, some instructions here.
Somesh
2011/08/31
Finally I could get the setup to work. The mistake was very silly,
(mistake in my original post)
-append “root=/dev/ram initrd=/test”
which should have been,
-append “root=/dev/ram rdinit=/test”
I created a minimal file system using your blog post on busybox and changed the rdinit=/bin/sh to rdinit=/test and checked it. Thats when I observed the V “diff” V and I don’t know how I missed it.
So, the kernel finally boots and greets back!!
Thanks for patience in your replies. I will definitely be reading other posts in your blog.
maximus
2011/10/07
hi balau
i recently started with linux…
there are few questions i had to ask..
1)this kernel which we compiled , is it common across all the distros(ubuntu,suse) for a particular platform(x86,arm)??if yes than what is modified between distros??
2)any inputs on how to create own distro?
thnx….
Balau
2011/10/08
1) The kernel source tree contains code for many platforms (x86, arm, mips, powerpc, …) and during the configuration step it selects the architectures. Every distribution can modify the kernel and ship it in a particular configuration as long as they comply with the GPL. For example if you download Debian or Ubuntu source package for the kernel, in the “debian” folder there should be the modifications.
2) Any modern distro provides an user friendly installation, a package manager, a rich package repository, package upgrades and quick security updates. I suggest thinking if you REALLY need to create another distro or stick with something that already exists. If you really want to create your own distro, derive from Debian, so that much of the work is already done.
Horaira Khan
2011/11/01
Hi,
i run the compiled cross compiled kernel linux-2.6.33 using command
qemu-system-arm -M versatilepb -m 128M -kernel zImage
i am not getting output as expected “kernel panic”. I am getting below output
INFO: RCU detected CPU 0 Stall
i have tried with below cross compilers
CodeSourcery/Sourcery_G++_Lite/arm-2009q3-67/bin/arm-none-linux-gnueabi-
CodeSourcery/Sourcery_G++_Lite/arm-2009q3-68/bin/arm-none-eabi-
My host system is ubuntu 10.04.2
uname -a
Linux horaira-laptop 2.6.32-28-generic #55-Ubuntu SMP Mon Jan 10 21:21:01 UTC 2011 i686 GNU/Linux
One more thing what is the difference between
arm-none-linux-gnueabi- and arm-none-eabi-
Regards
Horaira
Balau
2011/11/03
I don’t remember having seen that error before. From a rapid search here they say it could be OK to have RCU detect a stall after a panic. Are you sure the “kernel panic” message isn’t somewhere before the last messages? How is the kernel configured?
The difference between arm-none-linux-gnueabi- and arm-none-eabi- is mainly in the libraries, you can check this comment here and Mentor’s FAQ on the toolchains for more clarifications.
Horaira Khan
2011/11/04
Thanks Balau .
Abadhesh
2011/11/19
Hi balau, U r doing great….I hav a problem that i want to porting ARM in linux system. So i need all the steps to do it, if u will help me, i will be greatful to u. So pls help me all the steps to run a LPC 2129 (Philips Microcontroller)program in linux environment. Already i have executed the program in Keil3. but i would like to execute the program in linux with the help off Boot Loader. So i need the guide from the starting. So Plz help me.
Balau
2011/11/19
I’m not sure about what you are trying to do.
It seems to me LPC2129 is a microcontroller with an ARM7TDMI inside; it means that Linux can’t be run inside that chip, but maybe uCLinux can.
I don’t think I can help you, but you can find more help here: http://www.lpclinux.com/LPC2000/WebHome
Fridolin
2011/11/22
Hi!
Great stuff, but I’m having some problems mounting a ext3 rootfs.
Compiled kernel 2.6.38.8 using the versatile_defconfig.
Build a filesystem using debootstrap –foreign –arch armel lucid rootfs.
Started qemu using the following command:
qemu-system-arm -M versatilepb -kernel linux-2.6.38.8/arch/arm/boot/zImage -serial stdio -hda rootfs.etxt3 -append “console=ttyAMA0 root=/dev/sda init=/bin/bash rootfstype=ext3”
I can see all the kernel messages but than a kernel panic occurs due to the fact, that the root device cannot be opened.
…
Root-NFS: no NFS server address
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device “sda” or unknown-block(2,0)
Please append a correct “root=” boot option; here are the available partitions:
Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
…
Any idea how to get the system running using the versatile board and the ext3 filesystem?
Regards,
Fridolin
Balau
2011/11/22
I think your problem is not ext3 in particular, but more that you are trying to boot with an hard disk; the kernel doesn’t even reach the point where it tries different filesystems.
You could try with “root=/dev/sda1”, but I suspect it won’t work because the list of available partition seems empty.
I am not familiar with debootstrap, and I don’t know in what format is rootfs.ext3.
I suspect that your system needs some sort of initrd to populate the devices and see the hard disk. I don’t know how zImage has been created so I don’t know if an initrd (or initramfs) is already included inside it.
Check these sites, they show a setup that works:
http://www.aurel32.net/info/debian_arm_qemu.php
http://people.debian.org/~aurel32/qemu/armel/
hamzeh nasajpour
2011/12/13
i follow the tutorial,compile the kernel and make rootfs,
and everything seems OK,but at the end i can’t see “hello world”.
————————
qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -append “root=/dev/ram rdinit=/test”
———————–
VNC server running on `127.0.0.1:5900′
and stopped.
===============
qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -serial stdio -append “console=ttyAMA0 root=/dev/ram rdinit=/test”
————————
VNC server running on `127.0.0.1:5900′
Uncompressing Linux……………………………………………………………………………………………………………………………………………………………… done, booting the kernel.
Linux version 2.6.30 (corewind @ CoreWind) (gcc version 4.2.0 20070413 (prerelease) (CodeSourcery Sourcery G++ Lite 2007q1-10)) #1 Tue Dec 13 17:11:35 IRST 2011
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00093177
CPU: VIVT data cache, VIVT instruction cache
Machine: ARM-Versatile PB
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512
Kernel command line: console=ttyAMA0 root=/dev/ram rdinit=/test
NR_IRQS:64
PID hash table entries: 512 (order: 9, 2048 bytes)
Console: colour dummy device 80×30
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 123376KB available (5276K code, 290K data, 108K init, 0K highmem)
Calibrating delay loop… 209.71 BogoMIPS (lpj=1048576)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 520 bytes
NET: Registered protocol family 16
bio: create slab at 0
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
NET: Registered protocol family 1
Trying to unpack rootfs image as initramfs…
rootfs image is not initramfs (junk in compressed archive); looks like an initrd
Freeing initrd memory: 556K
NetWinder Floating Point Emulator V0.97 (double precision)
VFS: Disk quotas dquot_6.5.2
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
JFS: nTxBlock = 969, nTxLock = 7756
SGI XFS with ACLs, security attributes, realtime, debug enabled
SGI XFS Quota Management subsystem
OCFS2 1.5.0
ocfs2: Registered cluster interface o2cb
OCFS2 Node Manager 1.5.0
OCFS2 DLM 1.5.0
OCFS2 DLMFS 1.5.0
OCFS2 User DLM kernel interface loaded
Btrfs loaded
yaffs Dec 13 2011 17:09:25 Installing.
msgmni has been set to 242
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
CLCD: unknown LCD panel ID 0x00001000, using VGA
CLCD: Versatile hardware, VGA display
Console: switching to colour frame buffer device 80×60
Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
Serial: AMBA PL011 UART driver
dev:f1: ttyAMA0 at MMIO 0x101f1000 (irq = 12) is a AMBA/PL011
console [ttyAMA0] enabled
dev:f2: ttyAMA1 at MMIO 0x101f2000 (irq = 13) is a AMBA/PL011
dev:f3: ttyAMA2 at MMIO 0x101f3000 (irq = 14) is a AMBA/PL011
fpga:09: ttyAMA3 at MMIO 0x10009000 (irq = 38) is a AMBA/PL011
brd: module loaded
smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre
IRQ 25/eth%d: IRQF_DISABLED is not guaranteed on shared IRQs
eth0: SMC91C11xFD (rev 1) at c8968000 IRQ 25 [nowait]
eth0: Ethernet addr: 52:54:00:12:34:56
mice: PS/2 mouse device common for all mice
i2c /dev entries driver
mmc0: MMCI rev 0 cfg 00 at 0x0000000010005000 irq 22,33
mmc1: MMCI rev 0 cfg 00 at 0x000000001000b000 irq 23,34
Advanced Linux Sound Architecture Driver Version 1.0.20.
ALSA device list:
No soundcards found.
TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
VFP support v0.3: implementor 41 architecture 1 part 10 variant 9 rev 0
input: AT Raw Set 2 keyboard as /class/input/input0
input: ImExPS/2 Generic Explorer Mouse as /class/input/input1
RAMDISK: Couldn’t find valid RAM disk image starting at 0.
EXT4-fs: Update your userspace programs to mount using ext4
EXT4-fs: ext4dev backwards compatibility will go away by 2.6.31
Mount JFS Failure: -22
(1,0):ocfs2_fill_super:989 ERROR: superblock probe failed!
VFS: Cannot open root device “ram” or unknown-block(1,0)
Please append a correct “root=” boot option; here are the available partitions:
Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
[] (unwind_backtrace+0x0/0xdc) from [] (panic+0x44/0x114)
[] (panic+0x44/0x114) from [] (mount_block_root+0x1c4/0x204)
[] (mount_block_root+0x1c4/0x204) from [] (prepare_namespace+0x160/0x1b8)
[] (prepare_namespace+0x160/0x1b8) from [] (kernel_init+0xac/0xd8)
[] (kernel_init+0xac/0xd8) from [] (do_exit+0x0/0x574)
[] (do_exit+0x0/0x574) from [] (0x3)
Please help me.
My kernel is 2.6.30 for CW9G20 board.( Embedded board with AT91SAM9G20 microcontroller).
I copy the zImage and rootfs to the test directory “/test/” and run these commands.
Please help me
Balau
2011/12/13
The interesting messages are:
“Trying to unpack rootfs image as initramfs…
rootfs image is not initramfs (junk in compressed archive); looks like an initrd”
It seems the rootfs image has not been created correctly or the kernel is not able to read it.
Run the command “cpio -t <rootfs" inside your working directory. It displays the list of files in the rootfs cpio archive and a size in blocks. If it does not display a line with "test", please review the way you are generating rootfs.
hamzeh nasajpour
2011/12/14
Hi Balau,
Thank you for your attention,
I Ran the command “cpio -t <rootfs" inside my working directory and it display the "test".
—————–
test
1112 blocks
—————–
I don't know my error?
hamzeh nasajpour
2011/12/14
why you delete my comment? You don’t have any solution for this problem?
Balau
2011/12/14
I don’t delete your comments. All comments are held for moderation as I explain in the “About the Blog” page. I’m sorry if WordPress.com doesn’t emphasize the fact that your comment is in a moderation queue but that’s not something I have power to change. I don’t currently have the solution to your problem, but that’s not a valid reason for me to delete comments. As I have already shown, I’m not afraid to say “I don’t know.”
The output of the cpio command is what I expected, so rootfs should not be the problem. Maybe the problem is in the Corewind kernel, which is different from the upstream version that I used in my example. Have you tried doing the same thing with the upstream kernel? The potential problems that I can think of right now are: the Corewind kernel does not support cpio archives (unlikely), or Corewind uses the RAM in a way that the rootfs image becomes corrupted when it’s time to use it. For example if the kernel decompresses itself in some location of the RAM and this location overlaps with the location of rootfs, then the boot will surely fail. I think you can use QEMU options “-s -S” and connect to it with the GDB of your ARM toolchain, then you can check the binary data of location 0x800000 (which is the location where QEMU puts the initrd file) at the beginning of execution and when the kernel panics, and verify that it corresponds to the binary data of rootfs file and that it does not change. If the content changes, then the Corewind kernel is overwriting it and you should check with them about why and how they behave differently from the mainline kernel.
hamzeh nasajpour
2011/12/14
No No No, I’m sorry. Excuse me. It was a misunderstanding.
Thank you for your answer. Please mail a rootfs and zImage that you build them for working in qemu.
hamzeh.nasajpour@gmail.com
Balau
2011/12/14
OK no problem.
I’ll send you the two files when I have access to my home computer.
If you want you can also send me your zImage.
Fridolin
2011/12/15
Hello Balau!
It take me some time, but now I’m having a solution so it works even with a filesystem build using debootstrap.
The problem in my case was that the standard kernel configuration of the versatile board does not work. I had to enable the SCSI driver SYM53C8xx and some other functions.
If doing so I can use a virtual disc to boot.
Creating the disc:
qemu-img create disc.img 1G
Partitioning the disc. You have to follow the installation wizard till the partitioner has finished.
qemu -hda disc.img -cdrom debian-XXX-CD.iso -boot d
Mount the disc and copy the filesystem to it:
sudo mount -o loop,offset=32256 disc.img /mnt
sudo cp -pRd TARGET_FS/* /mnt
sudo umount /mnt
Start the system:
qemu-system-arm -M versatilepb -m 256M -kernel arch/arm/boot/zImage -serial stdio -hda disc.img -append “console=ttyAMA0,115200n8 root=/dev/sda1”
Some changes in /etc/securetty, /dev and /etc/inittab of the target rootfilesystem must be done so you can login on the ttyAMA0 as root.
Regards,
Fridolin
Balau
2011/12/15
Glad you did it! It is also possible to create and partition a disc.img without using QEMU and the Debian ISO, but disc.img must be a raw binary file created with dd, and then it can be mounted as loop device and partitioned using parted, fdisk and mkfs.ext3 on it manually from the host.
hamzeh nasajpour
2011/12/15
hi,
Thank you very very much.
I could build my kernel with your .config.
Please explain your .config for me.
hamzeh nasajpour
2011/12/15
I have a mini2440 board. This board has a ARM9 – ARM920T.
This board has a 7″ LCD with Qt distribution.
Can I emulate the graphical LCD in the qemu?
Balau
2011/12/15
I ran “make ARCH=arm versatile_defconfig”, then I changed two options: added “CONFIG_AEABI=y” and removed “CONFIG_MODULES”.
Probably the Versatile board default configuration file is different from the CW9G20 default one.
It is possible to emulate an LCD with QEMU (see Trying Debian for ARM on QEMU), but I don’t know if it can emulate the specific LCD of the mini2440 board. When you launch qemu-system-arm, the “-M” option indicates the architecture and the board, and it includes the memory map, the I/O peripherals and graphical display.
In my example I use the Versatile emulation, but I see there’s a project that is working on QEMU and Linux for the mini2440: http://code.google.com/p/mini2440/. Their version of QEMU should support also the “-M mini2440” option or something like that.
hamzeh nasajpour
2011/12/17
Thank you,
In this page said that we can emulate the mini2440.
http://gnufiish.org/trac/wiki/Qemu
======================================
1 git clone git://repo.or.cz/qemu/mini2440.git
2 cd mini2440
3 git apply < /path/to/qemu_glofiish.diff
4 ./configure –target-list=arm-softmmu
5 make
======================================
when I run line 3, I have errors.
error: patch failed: Makefile.target:655
error: Makefile.target: patch does not apply
error: patch failed: hw/boards.h:131
error: hw/boards.h: patch does not apply
error: hw/glofiish.c: already exists in working directory
error: patch failed: hw/nand.c:357
error: hw/nand.c: patch does not apply
error: patch failed: hw/sd.c:33
error: hw/sd.c: patch does not apply
error: patch failed: target-arm/machine.c:24
error: target-arm/machine.c: patch does not apply
=====================================
Please download the "qemu_glofiish.diff" and give me more information about these errors.
I'm confused that what is these commands and why error was occurred?
Thank you
hamzeh nasajpour
2011/12/17
Please see the following web link:
http://benoit.vince84.free.fr/mediawiki-1.16.0/index.php5?title=QEmu
In this link you can download a tar file and extract it and use the following commands
to emulating the mini2440 with graphical LCD.
I ran the following commands but I have an error.
Please download and test it if it is possible for your.
kernel and needed files is in the following link:
http://kagior.free.fr/fichiers/mini2440/qemu_mini2440_script.tar.gz
run the “mini2440_start.sh”
then run the following commands:
MINI2440 # run set_bootargs_nand
MINI2440 # saveenv
MINI2440 # setenv bootcmd ‘nboot.e kernel ; bootm’
MINI2440 # boot
My error:
=======================================================================
Loading from NAND 64MiB 3,3V 8-bit, offset 0x60000
reading NAND page at offset 0x60000 failed
** Read error
## Booting kernel from Legacy Image at 32000000 …
Image Name:
Created: 2011-02-22 17:34:07 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2799320 Bytes = 2.7 MB
Load Address: 30008000
Entry Point: 30008000
Verifying Checksum … OK
Loading Kernel Image … OK
OK
Starting kernel …
Uncompressing Linux…………………………………………………………………………………………………………………………………………………………….. done, booting the kernel.
s3c_timers_write: Bad register 0x40
Linux version 2.6.32.2-FriendlyARM (gorka@gorka-EasyNote-TM94) (gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #5 Tue Feb 22 18:29:45 CET 2011
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: FriendlyARM Mini2440 development board
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, (c) 2004 Simtec Electronics
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: console=ttySAC0,115200 noinitrd init=/sbin/init mini2440=0tb
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 59024KB available (5200K code, 477K data, 168K init, 0K highmem)
SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Hierarchical RCU implementation.
NR_IRQS:85
irq: clearing subpending status 00000003
Console: colour dummy device 80×30
console [ttySAC0] enabled
Calibrating delay loop… 392.39 BogoMIPS (lpj=980992)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4808000, irq 33
DMA channel 1 at c4808040, irq 34
DMA channel 2 at c4808080, irq 35
DMA channel 3 at c48080c0, irq 36
S3C244X: Clock Support, DVS off
bio: create slab at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
s3c-i2c s3c2440-i2c: slave address 0x10
s3c-i2c s3c2440-i2c: bus frequency set to 98 KHz
s3c-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
cfg80211: Calling CRDA to update world regulatory domain
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
NetWinder Floating Point Emulator V0.97 (double precision)
yaffs Feb 21 2011 11:42:53 Installing.
JFFS2 version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
JFS: nTxBlock = 461, nTxLock = 3693
msgmni has been set to 115
alg: No test for stdrng (krng)
io scheduler noop registered (default)
Console: switching to colour frame buffer device 100×30
fb0: s3c2410fb frame buffer device
backlight initialized
QEMU: mini2440_bl_switch: LCD Backlight now on (1).
leds initialized
buttons initialized
pwm initialized
adc initialized
s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
loop: module loaded
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c24xx-nand s3c2440-nand: Tacls=3, 29ns Twrph0=7 69ns, Twrph1=3 29ns
s3c24xx-nand s3c2440-nand: NAND soft ECC
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)
Scanning device for bad blocks
Creating 5 MTD partitions on “NAND 64MiB 3,3V 8-bit”:
0x000000000000-0x000000040000 : “supervivi”
0x000000040000-0x000000060000 : “param”
0x000000060000-0x000000560000 : “Kernel”
0x000000560000-0x000040560000 : “root”
mtd: partition “root” extends beyond the end of device “NAND 64MiB 3,3V 8-bit” — size truncated to 0x3aa0000
0x000000000000-0x000040000000 : “nand”
mtd: partition “nand” extends beyond the end of device “NAND 64MiB 3,3V 8-bit” — size truncated to 0x4000000
dm9000 Ethernet Driver, V1.31
eth0: dm9000e at c48ac300,c48b0304 IRQ 51 MAC: 08:90:90:90:90:90 (chip)
Atmel at76x USB Wireless LAN Driver 0.17 loading
usbcore: registered new interface driver at76c50x-usb
usbcore: registered new interface driver zd1211rw
usbcore: registered new interface driver rtl8187
usbcore: registered new interface driver zd1201
usbcore: registered new interface driver ar9170usb
ohci_hcd: USB 1.1 ‘Open’ Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
usb usb1: New USB device found, idVendor=1d6b, idProduct=0001
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: S3C24XX OHCI
usb usb1: Manufacturer: Linux 2.6.32.2-FriendlyARM ohci_hcd
usb usb1: SerialNumber: s3c24xx
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 3 ports detected
Initializing USB Mass Storage driver…
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver ums-alauda
usbcore: registered new interface driver ums-cypress
usbcore: registered new interface driver ums-datafab
usbcore: registered new interface driver ums-freecom
usbcore: registered new interface driver ums-isd200
usbcore: registered new interface driver ums-jumpshot
usbcore: registered new interface driver ums-karma
usbcore: registered new interface driver ums-onetouch
usbcore: registered new interface driver ums-sddr09
usbcore: registered new interface driver ums-sddr55
usbcore: registered new interface driver ums-usbat
usbcore: registered new interface driver usbserial
USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial Driver core
USB Serial support registered for aircable
usbcore: registered new interface driver aircable
USB Serial support registered for ark3116
usbcore: registered new interface driver ark3116
USB Serial support registered for Belkin / Peracom / GoHubs USB Serial Adapter
usbcore: registered new interface driver belkin
belkin_sa: v1.2:USB Belkin Serial converter driver
USB Serial support registered for ch341-uart
usbcore: registered new interface driver ch341
USB Serial support registered for cp210x
usbcore: registered new interface driver cp210x
cp210x: v0.09:Silicon Labs CP210x RS232 serial adaptor driver
USB Serial support registered for Reiner SCT Cyberjack USB card reader
usbcore: registered new interface driver cyberjack
cyberjack: v1.01 Matthias Bruestle
cyberjack: REINER SCT cyberJack pinpad/e-com USB Chipcard Reader Driver
USB Serial support registered for DeLorme Earthmate USB
USB Serial support registered for HID->COM RS232 Adapter
USB Serial support registered for Nokia CA-42 V2 Adapter
usbcore: registered new interface driver cypress
cypress_m8: v1.09:Cypress USB to Serial Driver
USB Serial support registered for Digi 2 port USB adapter
USB Serial support registered for Digi 4 port USB adapter
usbcore: registered new interface driver digi_acceleport
digi_acceleport: v1.80.1.2:Digi AccelePort USB-2/USB-4 Serial Converter driver
USB Serial support registered for Edgeport 2 port adapter
USB Serial support registered for Edgeport 4 port adapter
USB Serial support registered for Edgeport 8 port adapter
USB Serial support registered for EPiC device
usbcore: registered new interface driver io_edgeport
io_edgeport: v2.7:Edgeport USB Serial Driver
USB Serial support registered for Edgeport TI 1 port adapter
USB Serial support registered for Edgeport TI 2 port adapter
usbcore: registered new interface driver io_ti
io_ti: v0.7mode043006:Edgeport USB Serial Driver
USB Serial support registered for empeg
usbcore: registered new interface driver empeg
empeg: v1.2:USB Empeg Mark I/II Driver
USB Serial support registered for FTDI USB Serial Device
usbcore: registered new interface driver ftdi_sio
ftdi_sio: v1.5.0:USB FTDI Serial Converters Driver
USB Serial support registered for funsoft
usbcore: registered new interface driver funsoft
USB Serial support registered for Garmin GPS usb/tty
usbcore: registered new interface driver garmin_gps
garmin_gps: v0.33:garmin gps driver
USB Serial support registered for hp4X
usbcore: registered new interface driver hp4X
hp4x: v1.00:HP4x (48/49) Generic Serial driver
USB Serial support registered for PocketPC PDA
usbcore: registered new interface driver ipaq
ipaq: v0.5:USB PocketPC PDA driver
USB Serial support registered for IPWireless converter
usbcore: registered new interface driver ipwtty
ipw: v0.3:IPWireless tty driver
USB Serial support registered for IR Dongle
usbcore: registered new interface driver ir-usb
ir_usb: v0.4:USB IR Dongle driver
USB Serial support registered for iuu_phoenix
usbcore: registered new interface driver iuu_phoenix
iuu_phoenix: v0.11:Infinity USB Unlimited Phoenix driver
USB Serial support registered for Keyspan – (without firmware)
USB Serial support registered for Keyspan 1 port adapter
USB Serial support registered for Keyspan 2 port adapter
USB Serial support registered for Keyspan 4 port adapter
usbcore: registered new interface driver keyspan
keyspan: v1.1.5:Keyspan USB to Serial Converter Driver
USB Serial support registered for Keyspan PDA
USB Serial support registered for Keyspan PDA – (prerenumeration)
USB Serial support registered for Xircom / Entregra PGS – (prerenumeration)
usbcore: registered new interface driver keyspan_pda
keyspan_pda: v1.1:USB Keyspan PDA Converter driver
USB Serial support registered for KL5KUSB105D / PalmConnect
usbcore: registered new interface driver kl5kusb105d
kl5kusb105: v0.3a:KLSI KL5KUSB105 chipset USB->Serial Converter driver
USB Serial support registered for KOBIL USB smart card terminal
usbcore: registered new interface driver kobil
kobil_sct: 21/05/2004:KOBIL USB Smart Card Terminal Driver (experimental)
USB Serial support registered for MCT U232
usbcore: registered new interface driver mct_u232
mct_u232: z2.1:Magic Control Technology USB-RS232 converter driver
USB Serial support registered for Moschip 2 port adapter
mos7720: 1.0.0.4F:Moschip USB Serial Driver
usbcore: registered new interface driver moschip7720
USB Serial support registered for Moschip 7840/7820 USB Serial Driver
mos7840: 1.3.2:Moschip 7840/7820 USB Serial Driver
usbcore: registered new interface driver mos7840
USB Serial support registered for moto-modem
usbcore: registered new interface driver moto-modem
USB Serial support registered for navman
usbcore: registered new interface driver navman
USB Serial support registered for ZyXEL – omni.net lcd plus usb
usbcore: registered new interface driver omninet
omninet: v1.1:USB ZyXEL omni.net LCD PLUS Driver
USB Serial support registered for opticon
usbcore: registered new interface driver opticon
USB Serial support registered for GSM modem (1-port)
usbcore: registered new interface driver option
option: v0.7.2:USB Driver for GSM modems
USB Serial support registered for oti6858
usbcore: registered new interface driver oti6858
USB Serial support registered for pl2303
usbcore: registered new interface driver pl2303
pl2303: Prolific PL2303 USB to serial adaptor driver
USB Serial support registered for Qualcomm USB modem
usbcore: registered new interface driver qcserial
safe_serial: v0.0b:USB Safe Encapsulated Serial
USB Serial support registered for safe_serial
usbcore: registered new interface driver safe_serial
USB Serial support registered for siemens_mpi
usbcore: registered new interface driver siemens_mpi
Driver for Siemens USB/MPI adapter
Version 0.1 09/26/2005 Thomas Hergenhahn@web.de http://libnodave.sf.net
USB Serial support registered for Sierra USB modem
usbcore: registered new interface driver sierra
sierra: v.1.3.8:USB Driver for Sierra Wireless USB modems
USB Serial support registered for SPCP8x5
usbcore: registered new interface driver spcp8x5
spcp8x5: v0.04:SPCP8x5 USB to serial adaptor driver
USB Serial support registered for symbol
usbcore: registered new interface driver symbol
USB Serial support registered for TI USB 3410 1 port adapter
USB Serial support registered for TI USB 5052 2 port adapter
usbcore: registered new interface driver ti_usb_3410_5052
ti_usb_3410_5052: v0.9:TI USB 3410/5052 Serial Driver
USB Serial support registered for Handspring Visor / Palm OS
USB Serial support registered for Sony Clie 3.5
USB Serial support registered for Sony Clie 5.0
usbcore: registered new interface driver visor
visor: USB HandSpring Visor / Palm OS driver
USB Serial support registered for Connect Tech – WhiteHEAT – (prerenumeration)
USB Serial support registered for Connect Tech – WhiteHEAT
usbcore: registered new interface driver whiteheat
whiteheat: v2.0:USB ConnectTech WhiteHEAT driver
mice: PS/2 mouse device common for all mice
s3c2410 TouchScreen successfully loaded
input: s3c2410 TouchScreen as /devices/virtual/input/input0
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2410-rtc s3c2410-rtc: rtc disabled, re-enabling
s3c2410-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
i2c /dev entries driver
Linux video capture interface: v2.00
gspca: main v2.7.0 registered
usbcore: registered new interface driver conex
conex: registered
usbcore: registered new interface driver etoms
etoms: registered
usbcore: registered new interface driver finepix
finepix: registered
usbcore: registered new interface driver jeilinj
jeilinj: registered
usbcore: registered new interface driver mars
mars: registered
usbcore: registered new interface driver mr97310a
mr97310a: registered
usbcore: registered new interface driver ov519
ov519: registered
usbcore: registered new interface driver ov534
ov534: registered
usbcore: registered new interface driver pac207
pac207: registered
usbcore: registered new interface driver pac7311
pac7311: registered
usbcore: registered new interface driver sn9c20x
sn9c20x: registered
usbcore: registered new interface driver sonixb
sonixb: registered
usbcore: registered new interface driver sonixj
sonixj: registered
usbcore: registered new interface driver spca500
spca500: registered
usbcore: registered new interface driver spca501
spca501: registered
usbcore: registered new interface driver spca505
spca505: registered
usbcore: registered new interface driver spca506
spca506: registered
usbcore: registered new interface driver spca508
spca508: registered
usbcore: registered new interface driver spca561
spca561: registered
usbcore: registered new interface driver sq905
sq905: registered
usbcore: registered new interface driver sq905c
sq905c: registered
usbcore: registered new interface driver sunplus
sunplus: registered
usbcore: registered new interface driver stk014
stk014: registered
usbcore: registered new interface driver t613
t613: registered
usbcore: registered new interface driver tv8532
tv8532: registered
usbcore: registered new interface driver vc032x
vc032x: registered
usbcore: registered new interface driver zc3xx
zc3xx: registered
usbcore: registered new interface driver ALi m5602
ALi m5602: registered
usbcore: registered new interface driver STV06xx
STV06xx: registered
gspca_gl860: driver startup – version 0.9d10
usbcore: registered new interface driver gspca_gl860
gspca_gl860: driver registered
usbcore: registered new interface driver uvcvideo
USB Video Class driver (v0.1.0)
initializing s3c2440 camera interface……
s3c_gpio_read: Bad register 0xd0
s3c_gpio_write: Bad register 0xd0
s3c_gpio_read: Bad register 0xd0
s3c_gpio_write: Bad register 0xd0
s3c_gpio_read: Bad register 0xd0
s3c_gpio_write: Bad register 0xd0
s3c_gpio_read: Bad register 0xd0
s3c_gpio_write: Bad register 0xd0
s3c_gpio_read: Bad register 0xd0
s3c_gpio_write: Bad register 0xd0
s3c_gpio_read: Bad register 0xd0
s3c_gpio_write: Bad register 0xd0
s3c_gpio_read: Bad register 0xd0
s3c_gpio_write: Bad register 0xd0
s3c_gpio_read: Bad register 0xd0
s3c_gpio_write: Bad register 0xd0
s3c_gpio_read: Bad register 0xd0
s3c_gpio_write: Bad register 0xd0
s3c_gpio_read: Bad register 0xd0
s3c_gpio_write: Bad register 0xd0
s3c_gpio_read: Bad register 0xd0
s3c_gpio_write: Bad register 0xd0
s3c_gpio_read: Bad register 0xd0
s3c_gpio_write: Bad register 0xd0
s3c_gpio_read: Bad register 0xd0
s3c_gpio_write: Bad register 0xd0
s3c2440 camif init done
Loading OV9650 driver………
SCCB address 0x60, manufacture ID 0xFFFF, expect 0x7FA2
SCCB address 0x60, manufacture ID 0xFFFF, expect 0x7FA2
No OV9650 found!!!
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
s3c-sdi s3c2440-sdi: powered down.
s3c-sdi s3c2440-sdi: mmc0 – using pio, sw SDIO IRQ
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
Advanced Linux Sound Architecture Driver Version 1.0.21.
No device for DAI UDA134X
No device for DAI s3c24xx-i2s
S3C24XX_UDA134X SoC Audio driver
UDA134X SoC Audio Codec
asoc: UDA134X s3c24xx-i2s mapping ok
ALSA device list:
#0: S3C24XX_UDA134X (UDA134X)
TCP cubic registered
lib80211: common routines for IEEE802.11 drivers
s3c2410-rtc s3c2410-rtc: setting system clock to 2011-12-17 13:36:20 UTC (1324128980)
Root-NFS: No NFS server available, giving up.
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device “” or unknown-block(2,0)
Please append a correct “root=” boot option; here are the available partitions:
1f00 256 mtdblock0 (driver?)
1f01 128 mtdblock1 (driver?)
1f02 5120 mtdblock2 (driver?)
1f03 60032 mtdblock3 (driver?)
1f04 65536 mtdblock4 (driver?)
Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
Backtrace:
[] (dump_backtrace+0x0/0x10c) from [] (dump_stack+0x18/0x1c)
r7:c39b30f7 r6:c0588250 r5:c39b3000 r4:c3823f40
[] (dump_stack+0x0/0x1c) from [] (panic+0x4c/0x134)
[] (panic+0x0/0x134) from [] (mount_block_root+0x178/0x234)
r3:00000000 r2:c38689ec r1:c3823f40 r0:c04cd138
[] (mount_block_root+0x0/0x234) from [] (mount_root+0xb0/0xf4)
[] (mount_root+0x0/0xf4) from [] (prepare_namespace+0xf8/0x190)
r7:c0587c20 r6:c0023808 r5:c0023808 r4:c002235c
[] (prepare_namespace+0x0/0x190) from [] (kernel_init+0xf0/0x124)
r7:00000000 r6:c0021e2c r5:c002235c r4:c002235c
[] (kernel_init+0x0/0x124) from [] (do_exit+0x0/0x62c)
r7:00000000 r6:00000000 r5:00000000 r4:00000000
Balau
2011/12/17
The errors when applying the “diff” are probably because the diff was created some time ago, and now the mini2440 QEMU source files have changed and the diff is trying to modify files that are different. But I don’t think the diff is what you need, it seems to me that it is needed to add support for X800 or N800 which should be different architecture with respect to your mini2440. If you want to patch, you need to go back to a previous version of the source code. There’s a git command for that but I don’t remember it now. Anyway I don’t think that patch will help you, but maybe I am missing something.
Your errors seem the same errors that are reported in the page you linked. I think QEMU does not yet emulate the camera on the mini2440, but that’s not a problem in boot. The problem here is that Linux does not find a filesystem, because the image passed with the QEMU “drive” option is empty. The kernel arguments are these, so it seems the kernel expects no ramdisk and so it will try to boot from the drive.
Kernel command line: console=ttySAC0,115200 noinitrd init=/sbin/init mini2440=0tb
If you want to make it boot completely, I think you need to populate the drive image with a filesystem in a similar way as the initramfs. By googling quickly I found these instruction that should give you an idea of what you can do: Creating a hard disk image
hamzeh nasajpour
2011/12/18
Thank you for your answer:
In the link that I send to you, a file is available with name of “mini2440_start.sh”.
In this file is a script that run this command in the final.
================================================================
base=”/home/mini2440/qemu/mini2440″
echo Starting in $base
name_nand=”$base/mini2440_nand.bin”
name_snapshots=”$base/mini2440_snapshots.img”
qemu-system-arm \
-M mini2440 $* \
-drive file=$name_snapshots,snapshot=on \
-serial stdio \
-kernel “$base”/uImage_16k \
-mtdblock “$name_nand” \
-show-cursor \
-usb -usbdevice keyboard -usbdevice mouse”
================================================================
Can you describe these commands and parameters that how to work?plz?
sorry, I’m beginner.
And if is it possible change the script for working without error. I don’t know why error was occurred. Please.
Thank you
Balau
2011/12/18
The “base” variable is the working directory where the binary images are. It should be changed with the directory you use.
mini2440_nand.bin seems to be the binary image that goes in the onboard Flash, with the boot loader (U-Boot maybe?). It is passed to QEMU with the mtdblock option.
The mini2440_snapshot.img should be the image of the storage containing the filesystem, and it is passed with the “drive” option, I think it emulates the SD card.
The script also passes the kernel (uImage_16k) to the emulator, with the “kernel” option. It is possible that uImage_16k is created with mkimage, which is a tool by U-Boot to package binary images so that the bootloader understands them (how big they are, what’s inside, …) and can be used at boot.
I don’t know how to make the error disappear, as I said the errors are the same that are present in the page you linked, so you are getting the expected result, which is a kernel panic when it does not find a filesystem.
The wiki seems to have more information on how to go on: http://code.google.com/p/mini2440/w/list have you tried to ask them in one of the wiki pages? I am not familiar with your board, but they worked on it so they are surely more informed than me.
See also this page, it seems interesting.
joel
2011/12/19
Hi Balau,
Thanks a lot for your post. I need a way to debug the linux kernel in eclipse.
But before I can do that I need to successfully run the linux kernel in qemu.
I tried sequentially as per your steps.
But in the last step, when I ran using the “qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -append “root=/dev/ram rdinit=/test” ” after creating the filesystem I get the kernel panic message “kernel panic-not syncing attempted to kill init” and also there is no message from test.c, the output in qemu is same as before creating the filesystem(when there was no filesystem and the error was displayed)
Please help
Thanks in advance 🙂
sites referred:
-your site
-http://www.minoraddition.com/2011/02/11/linux-kernel-development-and-debugging-using-eclipse-cdt/
Balau
2011/12/19
Usually this error is displayed because “
test
” is not executed because the ARM EABI support is disabled. Try to see if your “.config
” file has a line containing “CONFIG_AEABI=y
” and if not, add itwith “with “make menuconfig
“make ARCH=arm menuconfig
” or by adding it manually.joel
2011/12/19
Hi Balau,
I set the EABI as per your instruction under Kernel Features in menuconfig, then built the kernel using the crosscompiler toolchain.
Anyway I would like to check the .config file for “CONFIG_AEABI=y”,
But I dont know where my .config is written to , after the make menuconfig, please say where the .config file is.
Please help
Thanks in advance
Joel
Balau
2011/12/19
The “
.config
” file should be in the same directory where you run “make
“.Anyway I made a small mistake in last comment, you should run “
make ARCH=arm menuconfig
” instead.It is also a good idea to run “
make ARCH=arm distclean
” if it still doesn’t work, and then reconfigure and rebuild everything.joel
2011/12/20
Hi Balau
Problem found(I think)! I enabled EAB under kernel features, before building, using make ARCH=arm menuconfig, but after the build the when I checked the EAB option using make ARCH=arm menuconfig it was disabled!!!
So please help me find the .config file to enable EAB by manually adding CONFIG_AEABI=y before building
These are the steps which I did
first setting the paths
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export CROSS_COMPILE=arm-none-linux-gnueabi
export PATH=/home/ctsuser/DS-5-Workspace/arm-2010q1/bin:$PATH
make ARCH=arm menuconfig
enabled EABI support under kernel features
make ARCH=arm versatile_defconfig
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- all
Build successfull!!!
but when I ran make ARCH=arm menuconfig the EAB option is disabled!!!
Please help me enable the EAB option manually, so It will remain even after the build
I am not able to find the .config file after the make, please specify the exact name and path of the .config file, assuming I am performing make under the directory /linux-2.6.32 and following the above steps(almost same as yours,except for the paths in export)
Please help
Thanks in advance
joel
2011/12/20
Hi Balau
The exact error I am encountering is this,
Freeing init memory: 104k
Kernel panic– not syncing: Attempted to kill init
joel
2011/12/20
Hi Balau,
It is working!!! The problem was that I should give make ARCH=arm menuconfig just before compiling the kernel, ie. before the make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- all …
it is because make ARCH=arm versatile_defconfig resets the .config values disabling the EABI
Now I am attempting to debug the kernel in eclipse
as per the site http://www.minoraddition.com/2011/02/11/linux-kernel-development-and-debugging-using-eclipse-cdt/,
by giving the -s and -S option in the qemu
Thanks a lot for your help 🙂
Balau
2011/12/20
I don’t understand why you are not finding the .config file, it’s usually there… if you are performing make under the directory /linux-2.6.32, then the .config file is “/linux-2.6.32/.config”. Maybe you thought that it was called something like “versatilepb.config” and you searched for “/linux-2.6.32/*.config”, which will not return anything. It is simply “.config”, with nothing before the dot. In Linux, any file whose name begins with a dot is considered “hidden” and some commands like “ls” won’t display them by default, you need to explicitly use “ls -A” to display also hidden files. Also some file managers to navigate the folders (nautilus, konqueror, …) have an option to display hidden files, which is disabled by default.
joel
2011/12/20
Hi Balau,
I need the kernel to boot and run in QEMU continuosly without crashing, all I am getting now is HelloWorld
I tried removing the infinite loop, then I am getting ” kernel panic – not syncing: Attempted to kill init”
Please give me a qemu command, which runs the kernel without kernel panic similar to the site: “http://www.minoraddition.com/2011/02/11/linux-kernel-development-and-debugging-using-eclipse-cdt/,”, and I can step through the source code in eclipse using the -s and -S option
I used this site(http://www.minoraddition.com/2011/02/11/linux-kernel-development-and-debugging-using-eclipse-cdt/, ) as reference, before I came to your site, It says on howto debug the kernel using QEMU and eclipse
But since I followed your build methodology of root filesystem creation, am not able to use the steps in the site http://www.minoraddition.com/2011/02/11/linux-kernel-development-and-debugging-using-eclipse-cdt/ (I dont know how to create standard filesystems to run the kernel on)
Please help me debug the kernel code in eclipse by giving a QEMU command which runs the kernel alone, allowing me to step through the kernel
Thanks a lot for your help 🙂
joel
2011/12/20
Hi Balau,
In your command
“qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -append “root=/dev/ram rdinit=/test” ”
is there a way to mount the rootfs without running the test.c??
Because when I give qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -append “root=/dev/ram” it throws the error
No filesystem could mount, root tried:ext2 cramfs minix romfs
Please help,
Thanks in advance
Hamzeh Nasajpour
2011/12/20
Hi Balau,
I could emulate the linux for mini2440 (Qtopia, Angstrom, Embeddian) in graphic and nographic mode.
Do hava any article for kernel porting? I want to create an embedded board with ARM9
and develop a kernel and RFS for it.
please help me.
Regards,
joel
2011/12/20
Hi Balau,
sorry for the many posts, but I need this to work desperately, please be patient with my many posts
I came across this site “http://fs.devloop.org.uk/”, can you tell me a way to use the downloaded filesystem instead of your file system, in your final QEMU command…
It also says in the site
***********************************************************************************************************
All are in raw disk format which can be loop mounted, or used directly as a raw disk with KVM (or QEMU), User Mode Linux and many others. See below for some examples.
Note: there is no bootloader! Use your own kernel or install a bootloader via a chroot.
***********************************************************************************************************
The site says QEMU can be used, so please tell how to download and use the downloaded file system in your final QEMU command
qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -append “root=/dev/ram rdinit=/test”
also please explain the following parameters in your QEMU command
-initrd rootfs
-append “root=/dev/ram rdinit=/test”
-M versatilepb
-m 128M
Thanks a ton for your help 🙂
Balau
2011/12/20
@joel
Even if you don’t have a filesystem, you CAN debug the boot phase of the kernel. Then when the kernel tries to find a filesystem it will panic, but you can debug anything before that point. Be aware that some QEMU versions, such as the one shipped in some versions of Ubuntu, have a bug where even if you run “-s -S”, the emulation will not stop at the beginning, but it will continue and then panic, so you can’t debug the boot. To solve this problem you need to recompile QEMU or use a different distribution.
You don’t need a bootloader because QEMU does everything you need with the “-kernel” option.
If you need a filesystem, a simple way to have it is to use a ramdisk with Busybox on it, as I explain in Busybox for ARM on QEMU
The “-M versatilepb -m 128M” options in QEMU are used to emulate the ARM Versatile Platform Baseboard, with 128MiB of RAM. It’s an old architecture (with an ARM926EJ-S core) that has been supported on Linux mainline kernel, QEMU and U-Boot.
The “-initrd rootfs” option tells QEMU to load the file “rootfs” into memory at a certain address, and pass that address to the Linux kernel.
The “-append ‘root=/dev/ram rdinit=/test'” option adds some parameters to pass to Linux kernel, and in particular they tell the kernel that the root filesystem is in ram, and the first program that has to be called from the ramdisk is the “/test” we created, instead of the default “/sbin/init”.
You can have more information on QEMU commands from “qemu-system-arm –help”, or “man qemu-system-arm” or this documentation.
It seems to me that both the sites that you pointed have nothing to do with ARM, so you can’t download and use those images. when you run “qemu” or “qemu-system-x86_64” it emulates an x86 machine, if you run “qemu-system-arm” it emulates an ARM machine, they are VERY different and a kernel+filesystem for one can’t work on another.
Balau
2011/12/20
@Hamzeh
I know this guide: Linux Porting Guide.
But I think that if you use a core that Linux already supports (some OMAP chips for example), you have less work to do. I never ported Linux on anything, but I think it involves taking care mainly of the boot process (boot loader, storage for boot loader, kernel and ramdisk), the root filesystem storage (SD card? USB drive?). Most of the root filesystem will already work, it should be sufficient that is compiled for the same architecture.
I’m sorry but I can’t help you with this because I never did it.
joel
2011/12/21
Hi Balau,
Thanks a lot for your help.
By following your blog https://balau82.wordpress.com/2010/03/27/busybox-for-arm-on-qemu/,
I was able to successfully setup the root filesystem and boot my kernel linux-2.6.32.2. Now I have a working kernel with a shell bash, that I can run basic commands such as ls and cd on.
But when I try to connect it with my eclipse gdb server using the -s and -S option, I am getting warning ” warning: Architecture rejected target-supplied description ” and am not able to step through the source code, it is giving, “no source available at 0x0”
The steps are given in this site, http://www.minoraddition.com/2011/02/11/linux-kernel-development-and-debugging-using-eclipse-cdt/ but when I try to follow all the steps, the qemu is not booting the kernel, an array of colours are coming instead.
Can you please go through the site http://www.minoraddition.com/2011/02/11/linux-kernel-development-and-debugging-using-eclipse-cdt/ and suggest me a way to debug the linux kernel in eclipse.
I feel the eclipse is not supporting the qemu-system-arm, but might support qemu alone.
Please give a way of compiling an image which is not arm and workable under linux
There is the command qemu -no-kvm -s -S -kernel /mnt/build/linux-2.6/arch/x86/boot/bzImage -hda /mnt/sid.ext3 -append “root=/dev/sda” in the site http://www.minoraddition.com/2011/02/11/linux-kernel-development-and-debugging-using-eclipse-cdt
Please help me to configure the above QEMU command based on the filesystem downloaded from http://fs.devloop.org.uk
Thanks again for your help 🙂
Balau
2011/12/21
The error message you get about “Architecture rejected” is probably because you are trying to debug an ARM architecture with an x86 GDB. You need to use the GDB for ARM. It seems to me the option is configured in this screen:
http://www.minoraddition.com/wp-content/uploads/2011/02/step012.png
you need to put in the “GDB debugger” field the gdb of the ARM toolchain, such as “arm-none-eabi-gdb” or “arm-none-linux-gnueabi-gdb”, in particular it is what you used in the kernel compilation.
If you need to use http://fs.devloop.org.uk/ images, you can’t use qemu-system-arm or an ARM kernel, you need to use qemu and a x86 kernel. You need to unzip the file and pass it with the -hda option, for example:
wget http://fs.devloop.org.uk/filesystems/Debian-Squeeze/Debian-Squeeze-x86-root_fs.bz2
tar xjf Debian-Squeeze-x86-root_fs.bz2
qemu -no-kvm -s -S -kernel /mnt/build/linux-2.6/arch/x86/boot/bzImage -hda Debian-Squeeze-x86-root_fs -append “root=/dev/sda”
It’s still not clear to me if your objective is to debug Linux on an ARM architecture or what. The only thing you said about your objective is:
There’s no mention of ARM. If you don’t need to debug specifically on ARM, then I strongly suggest you to keep everything for x86, because all the tools are more mature and there’s more stuff about it on the Internet.
joel
2011/12/22
Hi Balau,
Am sorry for not being clear, and thanks a lot for your patience.
I need to debug the linux kernel in eclipse regardless of the architecture x86 or ARM. But since the eclipse seems to support only x86 as you mentioned, can you give me
The detailed build procedure of the kernel for x86, and obtain the zImage for the kernel
Which x86 toolchain to use, where to download and how to use in build
Setting the necessary things in menuconfig.
Finally the QEMU command
I am new to this field, therefore please help me by giving step by step guidelines or guide me to sites which gives step by step guidelines.
Thanks a lot for your help 🙂
PS: I tried searching the internet for the error “Architecture rejected target-supplied description” but could find no solution, but you found the problem to be the x86 architecture, thanks a ton for your help 🙂
joel
2011/12/22
Hi Balau,
you said
“”you need to put in the “GDB debugger” field the gdb of the ARM toolchain, such as “arm-none-eabi-gdb” or “arm-none-linux-gnueabi-gdb”, in particular it is what you used in the kernel compilation.””
If I do the build as per your instructions in this blog for ARM architecture, can you tell me the changes I have to make in eclipse? I tried to change the gdb for arm tool chain, but was unable to find where to change, please give step by step instruction on how to change the gdb field to arm toolchain in eclipse.
Thanks 🙂
Balau
2011/12/22
Forget ARM. Really, forget it. As I said, it’s easier to do everything in x86. The toolchain is simply gcc, the QEMU command is simply qemu, the root filesystem is simply what you can find here: http://fs.devloop.org.uk/, and if you stick to x86, then everything you need to do to compile and debug Linux is written in that site: http://www.minoraddition.com/2011/02/11/linux-kernel-development-and-debugging-using-eclipse-cdt/
I just suggest two differences with respect to that tutorial:
1. Instead of getting the kernel from git, you can download a stable version:
http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.1.6.tar.bz2
2. Instead of creating and using /mnt/sid.ext3 you can pass the filesystem you download and uncompress from http://fs.devloop.org.uk/, as I said in the previous comments. For example you could use the Debian Squeeze 32 bit version.
I believe you were not able to follow the instruction of http://www.minoraddition.com because you mixed his tutorial with mine, and they are incompatible.
joel
2011/12/22
Hi Balau
I am not able to perform the build as per the site.
http://www.minoraddition.com/2011/02/11/linux-kernel-development-and-debugging-using-eclipse-cdt/
When I do all of the steps I am getting error
**** Build of configuration Default for project linux-2.6.32.1_k ****
make O=/mnt/build/linux-2.6.32.1_k all
make -C /home/ctsuser/DS-5-Workspace/linux-2.6.32.1_k O=/mnt/build/linux-2.6.32.1_k/.
ln: cannot remove `source’: Permission denied
make[3]: *** [outputmakefile] Error 1
make[2]: *** No rule to make target `include/config/auto.conf’, needed by `include/config/kernel.release’. Stop.
make[1]: *** [sub-make] Error 2
make: *** [all] Error 2
**** Build Finished ****
Please help
joel
2011/12/22
Hi Balau,
Since I am unable to build the kernel for x86 architecture using eclipse…
Please suggest a site which gives step by step instruction on how to build a kernel for x86 architecture
Thanks a lot
🙂
Balau
2011/12/22
Ideally, you should just do:
cd ~
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.1.6.tar.bz2
tar xjf linux-3.1.6.tar.bz2
cd linux-3.1.6
make defconfig
make menuconfig # And add debug info and frame pointers
make
I think your problem could be three things:
1. you are trying to build the kernel on directories where you don’t have complete access (it gives “Permission denied”). I suggest doing everything under your home directory or below.
2. you are not working on a clean linux tree. maybe something from previous compilation remained. Run “make distclean” and re-configure the kernel with “make defconfig” or using a pre-generated .config.
3. the kernel is not configured (run “make defconfig”)
I can give you a couple of sites for kernel compilation:
http://free-electrons.com/docs/elfs/
http://alien.slackbook.org/dokuwiki/doku.php?id=linux:kernelbuilding
Click to access kernel_compilation.pdf
joel
2011/12/23
Hi Balu
In one of your old comments you talked about using the ddd debugger as follows
___________________________________________________________________
Recompile the kernel with debugging symbols (the configuration should be in “kernel hacking” section inside the kernel menuconfig)
– Launch QEMU with debugging enabled (“-s -S” to launch it stopped and waiting for GDB)
– Launch GDB with something like this (If you have ddd installed and your toolchain comes with gdb):
$ ddd –debugger arm-unknown-linux-uclibcgnueabi-gdb — vmlinux
– Inside GDB:
(gdb) target remote localhost:1234
(gdb) b start_kernel
(gdb) c
– Try to debug step-by-step the kernel and understand what’s doing nasty things.
ddd –debugger arm-none-linux-gnueabi-gdb — vmlinux
_______________________________________________________________________________________________________________________________________________________
But I am getting error, the toolchain am using is arm-none-linux-gnueabi, please also specify under which path I have to give the command $ddd –debugger arm-unknown-linux-uclibcgnueabi-gdb — vmlinux
error
GDB could not be started
ddd requires some inferior debugger to run,
joel
2011/12/23
Hi Balau,
I was able to build successfully for the x86 architecture in terminal, but in eclipse I am getting this error
*** Error during update of the kernel configuration.
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf’, needed by `include/config/kernel.release’. Stop.
**** Build Finished ****
But since I built successfully in terminal I can proceed to the next step of creating a rootfilesystem to mount my kernel.
As you suggested in your previous blog
wget http://fs.devloop.org.uk/filesystems/Debian-Squeeze/Debian-Squeeze-x86-root_fs.bz2
tar xjf Debian-Squeeze-x86-root_fs.bz2
qemu -no-kvm -s -S -kernel /mnt/build/linux-2.6/arch/x86/boot/bzImage -hda Debian-Squeeze-x86-root_fs -append “root=/dev/sda”
can you specify in detail under which directory should I give the above qemu command
Thanks 🙂
joel
2011/12/23
Hi Balau
I followed ur steps but am getting error
built the kernel for x86 using
make defconfig
make menuconfig(enabled compile with kernel debug info, compile with frame pointers)
then
did the following
went into /linux2.6.32.2/arch/x86/boot (my bzImage located here)
extracted the Debian-Squeeze-x86-root_fs
qemu -no-kvm -s -S -kernel /mnt/build/linux-2.6/arch/x86/boot/bzImage -hda Debian-Squeeze-x86-root_fs -append “root=/dev/sda”
now am getting kernel panic here is the error
Please append a correct “root=” boot option here are the available partitions
sda driver: sd
sr0 driver: sr
kernel panic not syncing : VFS : unable to mount rootfs on unknown block(8,1)
Please help
Thanks
joel
2011/12/23
Hi Balau,
I just want to wish you a merry christmas and happy new year.
Thanks a lot for your help, I wouldnt have gotten this far without your aid.
Thanks, and enjoy your vacation 🙂
Balau
2011/12/24
I tried to do the same things you did and it works for me, but I did something different to extract the Debian root filesystem. I said a wrong thing before, to uncompress
Debian-Squeeze-x86-root_fs.bz2
I thought it was compressed with “tar” so I said the command was “tar xjf Debian-Squeeze-x86-root_fs.bz2
” instead the correct command is:bunzip2 -k Debian-Squeeze-x86-root_fs.bz2
It will extract the file called Debian-Squeeze-x86-root_fs which is the one QEMU should use to emulate the hard disk.
Another useful thing: to display kernel messages in the command window instead of the graphical window, run QEMU with:
qemu -no-kvm -s -S -kernel /mnt/build/linux-2.6/arch/x86/boot/bzImage -hda Debian-Squeeze-x86-root_fs -append "root=/dev/sda console=ttyS0" -serial stdio
So it’s easier to copy/paste the errors.
Happy holidays to you, too!
joel
2011/12/24
Hi Balau,
Thanks a lot for trying it out for me, anyway I got it working with a different filesystem.
My main objective is this: Debug the linux kernel(with source code stepping) in eclipse or using the ddd debugger or through any means possible.
I followed a very old comment of yours
___________________________________________________________________________
Recompile the kernel with debugging symbols (the configuration should be in “kernel hacking” section inside the kernel menuconfig)
– Launch QEMU with debugging enabled (“-s -S” to launch it stopped and waiting for GDB)
– Launch GDB with something like this (If you have ddd installed and your toolchain comes with gdb):
$ ddd –debugger arm-unknown-linux-uclibcgnueabi-gdb — vmlinux
– Inside GDB:
(gdb) target remote localhost:1234
(gdb) b start_kernel
(gdb) c
– Try to debug step-by-step the kernel and understand what’s doing nasty things.
ddd –debugger arm-none-linux-gnueabi-gdb — vmlinux
___________________________________________________________________________
But I am getting error, the toolchain am using is arm-none-linux-gnueabi, please also specify under which path I have to give the command $ddd –debugger arm-unknown-linux-uclibcgnueabi-gdb — vmlinux
Also please give a step by step instruction on how to build the linux kernel to use the ddd debugger after building the kernel
_________________________________________________________________________
error message:
error
GDB could not be started
ddd requires some inferior debugger to run
_________________________________________________________________________
Before I forget … Merry Christmas to you 🙂
Balau
2011/12/24
Try to make GDB work without DDD first.
Run QEMU with the usual command “
qemu -s -S ...
”In another terminal, go in the build directory with something like “
cd /mnt/build/linux-2.6/
”If you are debugging x86 kernel, run “
gdb vmlinux
“; if you are debugging ARM kernel, prefix gdb with your toolchain, for example “arm-none-linux-gnueabi-gdb vmlinux
Then, inside GDB:
target remote localhost:1234
break start_kernel
continue
The result should be:
Reading symbols from /home/francesco/Inbox/linux-2.6.32.2/vmlinux...done.
(gdb) target remote localhost:1234
Remote debugging using localhost:1234
0x0000fff0 in ?? ()
(gdb) b start_kernel
Breakpoint 1 at 0xc16df42d: file init/main.c, line 518.
(gdb) c
Continuing.
Breakpoint 1, start_kernel () at init/main.c:518
518 {
(gdb) quit
A debugging session is active.
Inferior 1 [Remote target] will be killed.
Quit anyway? (y or n) y
When this works, you can use DDD as a graphical front-end to gdb.
Run QEMU with the usual command “
qemu -s -S ...
”In another terminal, go in the build directory with something like “
cd /mnt/build/linux-2.6/
”If you are debugging x86 kernel, run “
ddd vmlinux
“; if you are debugging ARM kernel with arm-none-linux-gnueabi toolchain, run “ddd --debugger arm-none-linux-gnueabi-gdb -- vmlinux
joel
2011/12/26
Hi Balau,
This time there were no errors, but at the same time I was not able to perform any debugging. It said (no debug symbols found) This is the log I encountered
_________________________________________________
arm-none-linux-gnueabi-gdb vmlinux
GNU gdb (Sourcery G++ Lite 2010q1-202) 7.0.50.20100218-cvs
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type “show copying”
and “show warranty” for details.
This GDB was configured as “–host=i686-pc-linux-gnu –target=arm-none-linux-gnueabi”.
For bug reporting instructions, please see:
…
Reading symbols from /home/ctsuser/DS-5-Workspace/linux-2.6.32.2_k/vmlinux…(no debugging symbols found)…done.
(gdb) target remote localhost:1234
Remote debugging using localhost:1234
0x00000000 in ?? ()
(gdb) b start_kernel
Breakpoint 1 at 0xc0008824
(gdb) c
Continuing.
Breakpoint 1, 0xc0008824 in start_kernel ()
(gdb) quit
A debugging session is active.
Inferior 1 [Remote target] will be killed.
Quit anyway? (y or n) y
______________________________________________________________________
Note that I am not able to find the source code lines like ***file init/main.c, line 518.***** as suggested in yours
************************************************
gdb) b start_kernel
Breakpoint 1 at 0xc16df42d: file init/main.c, line 518.
(gdb) c
Continuing.
Breakpoint 1, start_kernel () at init/main.c:518
518 {
*****************************************
I think I didnt enable compile with debug info, I will try and enable that and build again,
But please suggest if there might be some other problem
Thanks 🙂
joel
2011/12/26
Hi Balau,
In your old post you said
“Recompile the kernel with debugging symbols (the configuration should be in “kernel hacking” section inside the kernel menuconfig)”
Can you please say exactly which option I should enable
I gave make ARCH=arm menuconfig
Under Kernel hacking I enabled, “compile kernel with debug info” but was unable to find “compile kernel with frame pointers”
Is the above option enough to use gdb to debug or should I enable frame pointers as well??
I gave the above option and am waiting for the build to complete
I got this message while I was using gdb “no debugging symbols found” – as mentioned in my previous comment
and the ddd debugger didnt have any source files to step through
Please help
Thanks 🙂
joel
2011/12/26
Hi Balau,
IT WORKED!!!!
My errors were this
1) Had not compiled with debug symbols enabled
2) Did not set the path for the none-linux-gnueabi
THANK YOU LOADS,
Can you please suggest to me sites for learning the ddd interface, I need to explain all the things I can do with this, ddd debugger on the linux kernel
Thanks
🙂
Balau
2011/12/28
There’s a nice and easy video tutorial here: http://www.youtube.com/watch?v=4aLaHTg45Sw
Here is a more in-depth tutorial: http://heather.cs.ucdavis.edu/~matloff/Debug/Debug.pdf
Here is the reference manual for everything else: http://www.gnu.org/software/ddd/manual/html_mono/ddd.html
Nobel
2011/12/29
Hi Balau.. can u please tell how to build kernel-qemu for android emulator, which runs on linux os.
Balau
2011/12/29
The official android emulator is actually derived from QEMU (see here the source).
If you are using the official way to develop and emulate (which is this SDK), then you are already using QEMU and the Android ARM kernel, under the hood. I don’t know if the kernel is compiled, but here is the page with instructions on how to download the source code.
I don’t think the official QEMU can emulate Android, so you must use the emulator from Android repositories.
I never tried to run Android on QEMU myself, so I can’t help you more than this.
nobel
2012/01/02
Thanks balau .. and i wish u very happy new year 🙂
fisat
2012/01/05
hi balu,
actually my project is based on qemu. bt nw we are in trouble. we want to add a c program into qemu and run the program using qemu. we can add and run simple c program by the following steps..
Run QEMU’s user space emulator.
cd i386-linux-user
echo ‘int main() { printf(“hello qemu\n”); }’ > hello.c
cc -m32 hello.c -o hello
./qemu-i386 hello
but we are not able to run our program in qemu. we are using multithread( pthread )
when we run the program the error comes like this
qemu:unsupported syscall 240
plz help….. 😦
fisat
2012/01/05
hi balau,
which is qemu’s main code where we can edit to add new lines of code? please reply fast
Balau
2012/01/05
I could reproduce your problem with a simple multi-threaded program (using qemu-i386 version 0.15.1 (Debian 0.15.1+dfsg-3)).
I never used QEMU userspace emulator for i386, but googling I quickly found this:
http://talk.maemo.org/showthread.php?t=43480
So the problem seems to be the missing support of NPTL, which is also noted in this bug:
https://bugs.launchpad.net/ubuntu/+source/qemu-linaro/+bug/758424
There’s an old patch around that seems to try to add NPTL support, but I don’t know if it works:
http://patchwork.ozlabs.org/patch/45206/
I tried to disable NPTL using the LD_ASSUME_KERNEL variable like some sites suggest (http://www.wiredrevolution.com/system-administration/select-threading-implementation-using-ld_assume_kernel) but it doesn’t work on my machine probably because it’s too new.
It seems a complex problem, I think the right place to ask is the QEMU mailing lists: http://wiki.qemu.org/MailingLists
Mike
2012/01/07
Hi Balau,
Thx for such deep articles. I follow the article but when after compiling I run 1 qemu-system-arm -M versatilepb -m 128M -kernel zImage in arch/arm/boot dir I do not see anything other than :
VNC server running on `127.0.0.1:5900′
Please help.
Balau
2012/01/07
Maybe qemu is compiled without graphic support, or you may have a problem with the display on the terminal where you are launching it. Anyway if you try to connect with a vnc client to the provided address you should be able to see the window.
fisat
2012/01/09
hi balau,
which is the main program in qemu. we found many main.c programs inthe folder. but we don’t know which one is the main program. plz help…
Balau
2012/01/09
Should be
vl.c
fisat
2012/01/09
hi balue,
we have client-server program in c.
our task is, when we run qemu, client-server communication should begin. ie we need to emulate those two programs to qemu. we tried that hello world program for arm using qemu which is in your blog. we install codesourcery toolchain. and we set path also. but we are not able the program. error is arm-none-eabi-as: command not found
we think there is an error in path setting… is there any other method to emulate the code in qemu? actually we save our program in a project folder in the desktop. and we set the path as /home/athira/Desktop/project . is there any error … 😦 plz help…:-(
Balau
2012/01/09
It is not needed to add to the path your project folder, but you must add to the path the folder containing the codesourcery toolchain (the programs starting with arm-none-eabi-)
fisat
2012/01/10
hi balau,
we try to compile the hello world program.
but when we perform the 3rd step error comes like this..
athira@athira-lap:~/usr/local/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin$ arm-none-linux-gnueabi-ld -T test.ld test.o startup.o -o test.elf
test.o:(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0′
test.o:(.ARM.exidx+0x8): undefined reference to `__aeabi_unwind_cpp_pr1′
how to correct this error…? 😦
Balau
2012/01/10
The unwind functions should be called when an exception occurs, for example a division by zero. If you don’t care about that for now, you can define empty functions such as:
void __aeabi_unwind_cpp_pr0 (void) {}
I don’t think changing vl.c or any part of qemu is what you want to do, because if you do that, you are not running an ARM program.
fisat
2012/01/12
hi balau,
which is the cpu emulator program in qemu..? ie. which program perform the cpu emulation in qemu..? plz reply…
Balau
2012/01/12
I don’t think there is specific code that does just the CPU emulator. QEMU translates the machine code from one architecture to the other, so the translator is probably the most similar thing to what you want to search. But I don’t know exactly where the translator is.
I think you can find better answers in QEMU mailing list or in QEMU IRC channels.
fisat
2012/02/01
hi balau,
when we run an OS in qemu which program will send the machine instruction to the processor. our project head told us that it is related to kvm. plz tell the name of the program in qemu source code.
Balau
2012/02/01
In QEMU there are two “worlds”: the host and the guest. The host is the computer that runs QEMU. The guest is the computer that QEMU emulates.
I am assuming you are asking how the guest machine code is sent to the host processor.
Normally (without KVM) when QEMU executes guest code, it translates (for example in “target-i386/translate.c”) from guest machine code to intermediate code, which is then executed with “tcg_qemu_tb_exec” in “tci.c”. With KVM virtualization, this translation is greatly minimized, but I don’t know much about the details.
KVM is a kernel module running on the host that, if the host architecture and the guest architecture are the same (x86 host emulating an x86 guest), speeds up emulation by using hardware virtualization (like Intel VT-x).
See this paper for information and references about KVM and virtualization: Kernel-based Virtual Machine Technology
Amit
2012/02/09
Hi Balau,
What would be the command after append.
-append “?” would it be /dev/nfs or /dev/ram0
Balau
2012/02/09
Maybe the page is not showing correctly, the complete command is on one line:
qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -append "root=/dev/ram rdinit=/test"
Amit
2012/02/09
Thanks for your quick response.
satishsjadhav
2012/02/18
Hi Balau,
I tried your this article on linux-2.6.33 & linux-3.2.6 versions.
For linux-2.6.33 version, i got “Hello World!” on the QEMU window along with boot messages.
But linux-3.2.6 version couldn’t showed me the same. Also, it reports that-
No filesystem_could mount root, tried : ext2 cramfs minix vfat romfs
What could be the reason for this message? Please help me..
Balau
2012/02/18
I just tried with linux-3.2.6 and it works without problems.
Are you sure you are doing exactly the same thing with the two versions? Are you using the same rootfs file and the same command line options for QEMU?
chandan
2012/02/19
getting error while I run
qemu-system-arm -M versatilepb -m 128M -kernel ./arch/arm/boot/zImage
output:
VNC server running on `127.0.0.1:5900′
taking long time and giving no response.
Balau
2012/02/19
I answered here.
Luis
2012/02/21
Hi Balau, thanks for all your work.
I have been trying for a while to get the correct combination of toolchain and kernel settings that would allow me to simulate a versatilepb board. I followed your tutorial almost to the letter (where I differed is: I used sb2, my version of the toolchain is arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q3-67) 4.4.1, and I attempted to build kernel 2.6.39.4 instead of 2.6.33). As described in you tutorial, I disabled load modules and enabled eabi support.
The kernel built fine, however when I run:
qemu-system-arm -M versatilepb -m 128M -kernel zImage
All I get is a blank black window no additional output ( using 3 ) to look at the console, shows: “Uncompressing Linux… done, booting kernel.”
but in I should be seeing “Kernel panic – not suncing: VFS:….” in the main window ( 1), as I see when attempting the same qemu command with other (pre-compiled) kernels. I need to build by own kernel so using precompiled images is not feasible.
I googled the problem and see inconclusive results, have you seen this problem with later versions of qemu (i am using 10.5 from the repository) and newer kernels
(later than 2.6.33)?
Thanks,
Luis
Luis
2012/02/21
Balau, I figured out what the problem appears to be. The kernel works but intermittently. This appears to be related to the nature of the host running qemu-system-arm. When this is ran from a VM 1 in 10 times works however when run on a real machine, the kernel seems to come up every time. It appears to be related to the virtual settings of my VM.
At least now have a hint as to how to attack the problem. Thank You, and sorry for the noise.
Luis
Dave M
2012/02/29
Hi Balau, I’m trying to find the “enable EABI” option in the configuration menu, but the only binary formats I can find under “Userspace binary formats” are
[*] ELF Support
[ ] ELF Core Dumps
[ ] a.out and ECOFF support
[ ] MISC Binary support
[ ] RISC OS Personality
The only mention of EABI I see is in “Kernel Features” – the option is called “Use the ARM EABI to compile the kernel”. That’s not what you’re talking about, right?
Sorry, I’m new to this, so maybe I’m not seeing the obvious?
Thanks so much for your help,
Dave
Dave M
2012/02/29
Nevermind – I just tried the option in “Kernel Features” and noticed the “Old ABI” option popping up. So I guess this is what you were talking about.
Dave
Elias Gitau
2012/03/01
Hi,this is a very informative hands on tutorial, thank you very much.
However I’m using Linux mint and I install qemu-kvm from the repository(apt-get install), I can’t stop/kill/exit the qemu-arm-system process once I start it, ctl+a or ctl+c or even ctl+z not working or even responding, I’m forced to use top command to kill the process.
Any idea on how to solve this?
Thanks
Balau
2012/03/01
@Dave M: Yeah that was the option I was talking about. I agree that it’s confusing, but I think that other than the ELF format it is necessary to specify the ABI for the passing of parameters to system calls (user-space to kernel-space and back).
Balau
2012/03/01
@Elias Gitau: Inside the terminal the command should be Ctrl+a, then x. Are you sure you don’t have caps-lock on?
One way to work around it could be, instead of using the “-nographics” option, to use the “-serial stdio” option and close QEMU with the X on the black window that appears.
ebin
2012/03/17
Hi balau,
I tried to test the kernel image on qemu using the command
/# qemu-system-arm -M realview-eb-mpcore -m 128M -kernel /linux3.2/linux-3.2.11/arch/arm/boot/uImage
but i am getting a blank screen on qemu and nothing is happening. what could be the problem?
thanks,
Balau
2012/03/17
Some suggestions :
– How have you compiled the kernel?
– Usually the kernel image you need to use is called zImage, not uImage.
– Try adding the option “-serial stdio” to the execution
– It is not necessary to be root to compile the kernel or test it with QEMU.
ebin
2012/03/17
yes, i compiled the kernel..but when i tried with zImage and with serial stdio command, the qemu still showed blank screen, but in the terminal it showed -‘uncompressing Linux… done, booting the kernel.’
Balau
2012/03/17
I’m sorry, I was actually asking what commands/configurations/kernel version/toolchain did you use to compile the kernel.
You could try to use arm-specific gdb and QEMU options “-s -S” to debug step by step what’s happening. Also, if you try “-append earlyprintk” it should give you some other information.
Kaiwan
2012/03/17
@ebin: I think I faced a similar issue…& in my case using the “-nographic” option helped.
ebin
2012/03/19
i used the following commands
make ARCH=arm versatile_defconfig, make ARCH=arm menuconfig, make ARCH=arm CROSS_COMPILE=/arm-2008q3/bin/arm-none-linux-gnueabi- all and i got the zImage.
the kernel version is-3.2.11, toolchain-gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72)
@kaiwan- i tried using ‘-nographic’command but no change was there..
Balau
2012/03/19
The problem is that you are compiling for versatile platform but you are trying to emulate the kernel on a realview mpcore.
They have different architectures (ARM926 vs ARM11 multicore) and different memory maps, I don’t believe it is possible that a kernel compiled for the first works on the second.
I’m not familiar with compiling Linux for realview platforms but this link should help: Linux Support for the ARM Architecture
ebin
2012/03/19
i’m sorry.Actually at first, i compiled for realview mpcore board and tried to emulate on qemu, but it didn’t work. Later i compiled for versatilePB board using the previously mentioned commands and used the command – ‘ qemu-system-arm -M versatilepb -m 128M -serial stdio -kernel zImage’ for testing on qemu.
Balau
2012/03/19
For the Verstile, maybe the compilation has not been done from a clean state.
To start from a clean state you could:
– extract the kernel again on a new directory and redo the configuration and compilation, or
– run “make ARCH=arm distclean” on the directory where you already compiled the kernel, and then redo the steps for Versatile.
I don’t know why the realview compilation did not work.
Victor
2012/03/23
Hello,
I had the same problem with the linux kernel on qemu-system-arm with versatilepb: kernel hangs at “Uncompressing linux kernel … done.”. After doing some debugging I found out that it enters in an infinite loop at calibrate_delay(). Infinite loop is due to the fact that “jiffies” is not updated so timer irqs are not handled. The problem can be reproduced on linux-2.6.33.
da_tibmeister (@da_tibmeister)
2012/07/08
So I’ve been trying for several days to get this to work with the newest debian based image from RPI, and I am having nothing but issues. The reason I am trying to compile a new kernel is to add vFAT support, it seems I can’t find a single zImage for 3.1.9 that has this, and without it under QEMU the /boot partition is not able to be mounted.
So anyhew, I am using arm-2011.03-42-arm-none-eabi-i686-pc-linux-gnu toolchain (having tried the 2009q3 without any luck) and I get this damned error I can’t figure out during the make process, which is a fatal error.
arm-2011.03/bin/arm-none-eabi-gcc: 1: Syntax error: “(” unexpected
Can someone who’s smarter than I help? I hope to make a fully operational RPI QEMU image that can be used to bench many different things then write to an SD card for use on the PI, and I am willing to put the zImage and initrd up on my site so that one only has to DL the release from RPI and these two files.
Balau
2012/07/08
It’s a strange error indeed. Could you explain the steps you are following to cross-compile the kernel?
Have you tried toolchains other than CodeSourcery? For example Linaro or EmDebian.
Colombian
2012/09/25
hello ebin.
you must recompile your kernel linux.
make ARCH=arm versatile_defconfig
make menuconfig ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
(enable the option eabi inside your kernel (kernel feature ->))
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage all
SUCEESS
deepu james
2012/12/06
Hello,
I did all the steps u mentined ,But while running “qemu-system-arm -M versatilepb -m 128M -kernel zImage ” I am getting the following error.
:qemu-0.13.0/tcg/tcg.c:1314: tcg fatal error”..how to solve it
Balau
2012/12/06
It’s a very strange bug. If you can, try to use a newer QEMU version or run it on a different (in terms of Linux distribution or CPU architecture) host machine.
If the latest QEMU version also has the same problem, report the bug to QEMU developers. Otherwise, you should probably report the bug to your Linux distribution bug tracker.
Willy
2012/12/07
try with this linux versions:
http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.37.tar.bz2, 2.6.39 or 2.6.22
SUCCESS
Deepu James
2012/12/16
Hello,
i installed a new version of qemu and did the same steps.”:qemu-0.13.0/tcg/tcg.c:1314: tcg fatal error “problem is solved.Thanks a lot for that.
But now I am getting the following error .How can i go out of this problem??
jae3cob@deepu:~/study$ qemu-system-arm -M versatilepb -m 128M -kernel ../linux-2.6/arch/arm/boot/zImage -initrd rootfs -append “root=/dev/ram rdinit=/test”
oss: Could not initialize DAC
oss: Failed to open `/dev/dsp’
oss: Reason: No such file or directory
oss: Could not initialize DAC
oss: Failed to open `/dev/dsp’
oss: Reason: No such file or directory
audio: Failed to create voice `lm4549.out’
VNC server running on `127.0.0.1:5900′
pflash_write: Unimplemented flash cmd sequence (offset 0000000000000000, wcycle 0x0 cmd 0x0 value 0xf000f0)
pflash_write: Unimplemented flash cmd sequence (offset 0000000000000000, wcycle 0x0 cmd 0x0 value 0xf0)..
Balau
2012/12/17
Did you compile it yourself? If so, there are two
./configure
issues:First, add
--audio-drv-list="alsa oss"
as explained in this message. This should solve the “oss” problems”.Then, you must have SDL development libraries installed and add
--enable-sdl
to./configure
command. The output of the configuration should have this line somewhere:SDL support yes
Deepu James
2012/12/17
thanks a lot for your support ..:)….finally qemu worked….
flashman
2013/01/30
Hi Balau,
thanks for the post and sorry if I resume an old post
The tutorial was perfect and I started to navigate and to try linaro img from the linaro ws. Also ubuntu and android.
In linaro webpage there is a short overview to run qemu using :
qemu-system-arm -kernel vmlinuz-2.6.37-1003-linaro-vexpress -M vexpress-a9 -cpu cortex-a9 -serial stdio -m 1024 -initrd initrd.img-2.6.37-1003-linaro-vexpress -append ‘root=/dev/mmcblk0p2 rw mem=1024M raid=noautodetect console=ttyAMA0,38400n8 rootwait vmalloc=256MB devtmpfs.mount=0′ -sd vexpress.img
As you see the -sd option is used as secure digitale img. Is possible to “unpack” the original image of linaro “vexpress.img” and add some new file, for example apk file ?
On linaro there the procedure to build from scratch but requires too much space.
Thanks a lot!
Balau
2013/01/30
Answered here: https://balau82.wordpress.com/2012/03/31/compile-linux-kernel-3-2-for-arm-and-emulate-with-qemu/#comment-2456
deepu james
2013/04/22
hello ,
How can we transfer files between arm qemu system and my ubuntu host system ?.Can I use tftp for this?..
Balau
2013/04/22
As you guessed, the easiest way to exchange files is to use the virtual network created by QEMU.
See this as reference: QEMU Networking
For example you could open an ftp server on the host(10.0.2.2) and reach it from the guest(10.0.2.15) with an ftp client.
You could also mount remote folders with something like NFS.
pmchaudhary
2013/05/17
Great So great tutorial ..! !
Manuel Diaz Fereiro
2013/06/05
Hello Balau! Thanks a lot for this tutorial!
I’m have a next question. Do you have experience in free-bsd systems and u-boot?
Because us tried run freebsd for Mele_a1000 (alwinner a_10) and not obtained the expected results
Any suggestion ?
I’m sorry for my english.
Thanks!
Balau
2013/06/06
I don’t have experience on free-bsd or A10.
I think depending on your application board you can try to use JTAG to debug the core and see what’s going on.
Also, if you never interfaced u-boot and free-bsd I think it’s better to try on an emulator first, like QEMU, even if it’s not exactly the same chip, because I think the boot procedure should have some similarities.
Hope this help.
Manuel
2013/06/06
Thanks a lot Balau!
You know where can i find information for run u-boot and free-bsd on QEMU?
I’m tried with http://kernelnomicon.org/?p=229 for understand with run free-bsd in QEMU and your tutorial for Linux/u-boot/QEMU but not boot.
Thanks !
Manuel
2013/06/06
EXPLANATION:
Not boot when tried run u-boot-free-bsd/QEMU your tutorial run perfectly
Thanks!
Manuel
2013/06/06
I forgot. I’m tried use serial port but this damaged and only receive garbage.
Tried reviewing baudrate, syncronization, stop bit, make a script in python to translate the sequence. But it’s imposible i’m believe that port is broken.
Thanks again
Balau
2013/06/06
As I said I have no experience on free-bsd, so I don’t know where to find information.
I’m sure you already saw it but I have a post to create a flash image with U-Boot and Linux here: Booting Linux with U-Boot on QEMU ARM
I suppose the boot of free-bsd is different from Linux boot procedure.
QEMU runs a binary image with the -kernel options, you should probably use it to make it run what you want. You can also use the “-s -S” options to enable debugging with gdb.
About the port, if in your career you have successfully setup at least a dozen of different serial port communications, then you might be right to conclude there’s something broken in the hardware, otherwise it is more likely that you have a problem of configuration and the port is not broken. I would use a scope or a digital analyser to check the TX/RX serial pins, ad use the lowest baud rate (9600?) with 1 stop bit and no parity because it’s more likely to work.
Manuel
2013/06/06
Thanks for your suggestion and i’m sorry for my insistence
greetings
Manuel
Samer
2013/07/09
thanks mr.Balau
i follow your steps and build the test.c file and build the rootfs
every thing is good
then i put the ‘rootfs’ and ‘test’ in ‘/arch/arm/boot/’ directory
then when i enter :
qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -append “root=/dev/ram rdinit=/test”
the simulation start and i have get the boot messages but the hello world doesn’t exist
i check the size of the ‘test’ file it’s 654.9 kB and the ‘rootfs’ is 655.4 kB
i try to remove the ‘ ” ‘ and enter this command :
qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -append root=/dev/ram rdinit=/test
aproblem apear and said :
qemu-system-arm: -append root=/dev/ram: could not open disk image rdinit=/my-root: No such file or directory
can you help me
thanks in advance
Balau
2013/07/09
The
""
double quotes are important because what’s inside them is the argument to the-append
QEMU option.I don’t know what could be wrong, it depends also on the last messages that QEMU prints.
You can also try:
qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -serial stdio -append "console=ttyAMA0 root=/dev/ram rdinit=/test"
It will print the messages on the terminal instead of in the black window.
Also, you can check if the “Hello world” string has a “\n” newline at the end, because if it doesn’t, maybe it isn’t flushed on stdout.
balaji
2013/07/30
Hi Balau,
How should i test PL050 based keyboard of versatile board in qemu at the u-boot level. Though the qemu source is having the support for PL050 keyboard, i am not able to test it. Is there any commands to pass to qemu for keyboard driver invocation or Do i add any code to qemu. I have given the command to the qemu as follows.
qemu-system-arm -M versatilepb -device pl050_keyboard -kernel u-boot .
Please help me in this.
Thanks
balaji
Balau
2013/08/01
I never tried to fiddle with the keyboard, but by looking at QEMU source code it seems the emulation is already there. In “hw/versatilepb.c” it instantiates two PL050 (keyboard and mouse) to two different memory addresses. I think that when you launch QEMU and the black window appears, if you click into the window the mouse are captured, and the relative events are managed with the QEMU emulated PL050 devices. In the same way when the focus in on this window, the key presses are most probably sent to the PL050 emulation.
Balaji
2013/08/02
Thanks Balau. I tested keyboard at the u-boot level by giving the command in qemu (black) window as scankey (A-z)keys.
I have one more question on qemu with tftp support. For giving the tftp support to qemu i included #define CONFIG_SMC91111_EXT_PHY in versatile.h, copied zimage to /tftpboot folder and run the u-boot in qemu with the following command.
qemu-system-arm -M versatilepb -m 256M -nographic -net nic -kernel u-boot.bin.
I tried with the following ip addresses at the u-boot level.
set serverip 192.168.2.117 (My host ip).
set ipaddr 192.168.2.113 (free ip).
I run the tftpboot command after i have given set bootfile zimage command but i did’nt receive the packets.
Do i intall any network packages of qemu for supporting tftp.
Thanks
balaji
Balau
2013/08/02
I never tried tftp boot, but you coud read QEMU documentation on networking as a reference.
You will probably need to connect to 10.0.2.2 because it’s the virtual address of your host inside QEMU virtual network.
You could probably use the tftp option too, something like “
-netdev user,tftp=/home/myself/tftp/,bootfile=/mykernel
“. I don’t think the “-net nic” option is necessary.Anil Kumar Prasad
2014/09/27
Hi Balau,
how to enable usb device support for qemu guest OS. ?
which is connected to the HOST machine.
appreciate if you could provide some help
Balau
2014/09/27
I have never tried to use this functionality, it seems USB “passthrough” is its name. I assume you are referring to ARM emulation because you answered to this post, so I think this command line could be a starting point: http://archlinuxarm.org/forum/viewtopic.php?f=27&t=2229
madhu
2014/11/14
Hi balau
first i configured kernel for versatile_defconfig and i builded successfully
.I got .config file i renamed it as versatile_config and i added android base configuration to that using the following command (ARCH=arm scripts/kconfig/merge_config.sh mini2440_config android/configs/android-base.cfg). Again i builded kernel successfully after that i builded android google source code and i have taken
ramdisk.img from google_src_v4.4/out/target/product/generic. after that i tested using following command (qemu-system-arm -M versatilepb -kernel ./arch/arm/boot/zImage -initrd ramdisk.img -append “console=ttyAMA0 root=/dev/ram0 rw” -serial stdio) but i’m getting the following error
Kernel panic – not syncing: Attempted to kill init! exitcode=0x00000004
CPU: 0 PID: 1 Comm: init Not tainted 3.10.0 #12
[] (unwind_backtrace+0x0/0xe8) from [] (show_stack+0x10/0x14)
[] (show_stack+0x10/0x14) from [] (panic+0x8c/0x1d4)
[] (panic+0x8c/0x1d4) from [] (do_exit+0x7f8/0x8d8)
[] (do_exit+0x7f8/0x8d8) from [] (do_group_exit+0x40/0xd4)
[] (do_group_exit+0x40/0xd4) from [] (get_signal_to_deliver+0x178/0x5c4)
[] (get_signal_to_deliver+0x178/0x5c4) from [] (do_signal+0xd0/0x434)
[] (do_signal+0xd0/0x434) from [] (do_work_pending+0xa8/0xb8)
[] (do_work_pending+0xa8/0xb8) from [] (work_pending+0xc/0x20)
Balau
2014/11/16
I am not understanding well what you are trying to accomplish, but it seems a problem in the ramdisk. Usually it happens when the
init
program is compiled for a wrong architecture or something like that. I suggest you search for “kill init” in this same page just above your comment to see some other user stories and hopefully to find some enlightening info.cowster
2015/01/10
Hi Balau, thank you for writing this blog on getting QEMU working with the ARM. I managed to set the machine type to realvew-pb-a8 and cpu as cortex-a8 and it worked!
Kind regards,
N
Ranjith
2015/02/13
Hi balau,
The following message i am getting when i am trying to emulate versatilepb using qemu…..
“Unable to find the root fs on unknown-block(0 0)”.. I have followed your tutorial to build kernel and rootfs using cpio utility….Please help me to solve this issue…I am a beginner…
Thanks,
Ranjith.
Balau
2015/02/18
Could you copy-paste here the command line that you are running?
Are there other errors in the message log that you can copy-paste here? It could be useful to display the messages directly in the terminal:
qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -append "root=/dev/ram rdinit=/test console=ttyAMA0" -serial stdio
Also you can read the comments above yours, searching for “unknown-block”, and see if the answers to those comments contain some clue for you.
Abdul
2015/04/17
Hi!
This is an awesome tutorial. So I have this zImage compiled, can you please tell me how to create a root file system which emulates an OS completely? (Like how linaro releases it’s flavours)
Balau
2015/04/19
I think it depends on the distribution, for example I know that Debian has debootstrap. It seems for Linaro the process is illustrated here.
ABDUL QADEER
2015/04/25
Thank you so much for your reply. I looked up on creating root file systems and found this link http://elasticsheep.com/2011/01/building-and-emulating-a-basic-arm-linux-system/ which creates it using buildroot. I get an error of kernel panic everytime I try to run it. Can you please update a post for creating a proper root file system corresponding to 3.2 kernel (https://balau82.wordpress.com/2012/03/31/compile-linux-kernel-3-2-for-arm-and-emulate-with-qemu/)
ABDUL
2015/04/26
I tried latest version of buildroot and followed the steps given in your tutorial for creating zImage.
Following is the logfile when I try to run them using command –
qemu-system-arm -M vexpress-a9 -kernel linux-3.2/arch/arm/boot/zImage -initrd ../Downloads/buildroot/buildroot-2015.02/output/images/rootfs.cpio -append “console=tty1”
Uncompressing Linux… done, booting the kernel.
Booting Linux on physical CPU 0
Initializing cgroup subsys cpuset
Linux version 3.2.0 (root@zorro-Inspiron-N5110) (gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-12ubuntu1) ) #2 SMP Sun Apr 26 03:01:28 IST 2015
CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: ARM-Versatile Express
Memory policy: ECC disabled, Data cache writealloc
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956ms
PERCPU: Embedded 7 pages/cpu @805a0000 s4864 r8192 d15616 u32768
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512
Kernel command line: console=ttyAMA0
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 123856k/123856k available, 7216k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 – 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 – 0xfffe0000 ( 896 kB)
vmalloc : 0x88800000 – 0xf8000000 (1784 MB)
lowmem : 0x80000000 – 0x88000000 ( 128 MB)
modules : 0x7f000000 – 0x80000000 ( 16 MB)
.text : 0x80008000 – 0x80429a8c (4231 kB)
.init : 0x8042a000 – 0x80456300 ( 177 kB)
.data : 0x80458000 – 0x8047e1e0 ( 153 kB)
.bss : 0x8047e204 – 0x8049ca28 ( 123 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Hierarchical RCU implementation.
NR_IRQS:128
Console: colour dummy device 80×30
Calibrating delay loop… 436.22 BogoMIPS (lpj=2181120)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 1 counters available
Brought up 1 CPUs
SMP: Total of 1 processors activated (436.22 BogoMIPS).
NET: Registered protocol family 16
L310 cache controller enabled
l2x0: 8 ways, CACHE_ID 0x410000c8, AUX_CTRL 0x02420000, Cache size: 131072 B
hw-breakpoint: debug architecture 0x0 unsupported.
Serial: AMBA PL011 UART driver
mb:uart0: ttyAMA0 at MMIO 0x10009000 (irq = 37) is a PL011 rev1
console [ttyAMA0] enabled
mb:uart1: ttyAMA1 at MMIO 0x1000a000 (irq = 38) is a PL011 rev1
mb:uart2: ttyAMA2 at MMIO 0x1000b000 (irq = 39) is a PL011 rev1
mb:uart3: ttyAMA3 at MMIO 0x1000c000 (irq = 40) is a PL011 rev1
bio: create slab at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Advanced Linux Sound Architecture Driver Version 1.0.24.
Switching to clocksource v2m-timer1
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
UDP hash table entries: 128 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 128 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Unpacking initramfs…
Freeing initrd memory: 1320K
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
msgmni has been set to 244
io scheduler noop registered (default)
clcd-pl11x ct:clcd: PL111 rev2 at 0x10020000
clcd-pl11x ct:clcd: CT-CA9X4 hardware, XVGA display
v2m_cfg_write: writing 03c8eee0 to 00110001
v2m_cfg_write: writing 00000000 to 00710000
v2m_cfg_write: writing 00000002 to 00b10000
Console: switching to colour frame buffer device 128×48
smsc911x: Driver version 2008-10-21
smsc911x-mdio: probed
smsc911x smsc911x: eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=ffffffff:01, irq=-1)
smsc911x smsc911x: eth0: MAC Address: 52:54:00:12:34:56
isp1760 isp1760: NXP ISP1760 USB Host Controller
isp1760 isp1760: new USB bus registered, assigned bus number 1
isp1760 isp1760: Scratch test failed.
isp1760 isp1760: can’t setup
isp1760 isp1760: USB bus 1 deregistered
isp1760: Failed to register the HCD device
Initializing USB Mass Storage driver…
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
mousedev: PS/2 mouse device common for all mice
rtc-pl031 mb:rtc: rtc core: registered pl031 as rtc0
mmci-pl18x mb:mmci: mmc0: PL181 manf 41 rev0 at 0x10005000 irq 41,42 (pio)
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
aaci-pl041 mb:aaci: ARM AC’97 Interface PL041 rev0 at 0x10004000, irq 43
aaci-pl041 mb:aaci: FIFO 512 entries
ALSA device list:
#0: ARM AC’97 Interface PL041 rev0 at 0x10004000, irq 43
oprofile: using arm/armv7-ca9
IPv4 over IPv4 tunneling driver
ip_tables: (C) 2000-2006 Netfilter Core Team
arp_tables: (C) 2002 David S. Miller
TCP cubic registered
NET: Registered protocol family 17
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 0
rtc-pl031 mb:rtc: setting system clock to 2015-04-25 22:39:58 UTC (1430001598)
Freeing init memory: 176K
input: AT Raw Set 2 keyboard as /devices/mb:kmi0/serio0/input/input0
mount: mounting devtmpfs on /dev failed: No such device
can’t open /dev/null: No such file or directory
can’t open /dev/null: No such file or directory
can’t open /dev/null: No such file or directory
can’t open /dev/null: No such file or directory
can’t open /dev/null: No such file or directory
can’t open /dev/null: No such file or directory
Starting logging: input: ImExPS/2 Generic Explorer Mouse as /devices/mb:kmi1/serio1/input/input1
OK
Starting network…
getty: can’t open ‘/dev/null’: No such file or directory
getty: can’t open ‘/dev/null’: No such file or directory
getty: can’t open ‘/dev/null’: No such file or directory
getty: can’t open ‘/dev/null’: No such file or directory
getty: can’t open ‘/dev/null’: No such file or directory
getty: can’t open ‘/dev/null’: No such file or directory
getty: can’t open ‘/dev/null’: No such file or directory
getty: can’t open ‘/dev/null’: No such file or directory
Please help me fix it I really need to solve this problem.
Balau
2015/04/27
By searching for “
mount: mounting devtmpfs on /dev failed: No such device
” the solution seems to enable CONFIG_DEVTMPFS when building the kernel.Otherwise it may be because there’s no /dev/ directory in your root filesystem, and you might want to try to create it.
ABDUL
2015/04/28
Thank you for your reply. It is enabled I checked. Don’t know what the problem is.
I created a busybox rfs using your tutorial and found that iptables doesn’t work (I added it in the kernel). My final aim is to actually run iptables but I guess I am failing always.
ABDUL
2015/04/28
I was successful with buildroot when I made some changes to config file. But now I cannot set up internet. Do you know how to setup NAT internet access to guest?
Balau
2015/04/28
No I never tried neither NAT nor buildroot. QEMU creates by default its own virtual subnet (see http://wiki.qemu.org/Documentation/Networking), for NAT it seems that you need something different: http://wiki.qemu.org/Documentation/Networking/NAT
ABDUL
2015/04/30
Thank you. I made it work. There is a bridged network up but now when I try to update using apt-get, I receive apt-get not found! I searched online how to install this command but I failed. Is it supposed to be configured in the kernel or rootfs?
ABDUL
2015/04/30
I also tried your Debian-Squeeze-x86-root_fs with
qemu-system-arm -M vexpress-a9 -kernel linux-3.2/arch/arm/boot/zImage -hda ../Downloads/Debian-Squeeze-x86-root_fs “root=/dev/sda console=ttyS0” -serial stdio
I got an error qemu-system-arm: -hda ../Downloads/Debian-Squeeze-x86-root_fs: drive with bus=0, unit=0 (index=0) exists
ABDUL
2015/04/30
I mailed you. Please check.
yash
2015/05/18
Dear Balau,
I have followed steps mention in your article ..I am receiving following error — Please help
Trying to unpack rootfs image as initramfs…
Freeing initrd memory: 444K (c0800000 – c086f000)
NetWinder Floating Point Emulator V0.97 (double precision)
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 246
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
clcd-pl11x dev:20: PL110 rev0 at 0x10120000
CLCD: unknown LCD panel ID 0x00001000, using VGA
clcd-pl11x dev:20: Versatile hardware, VGA display
Console: switching to colour frame buffer device 80×60
brd: module loaded
physmap platform flash device: 04000000 at 34000000
physmap-flash physmap-flash.0: map_probe failed
smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre nico@fluxnic.net
eth0: SMC91C11xFD (rev 1) at c8800000 IRQ 57 [nowait]
eth0: Ethernet addr: 52:54:00:12:34:56
mousedev: PS/2 mouse device common for all mice
TCP: cubic registered
NET: Registered protocol family 17
VFP support v0.3: implementor 41 architecture 1 part 10 variant 9 rev 0
Freeing unused kernel memory: 112K (c0352000 – c036e000)
Kernel panic – not syncing: Attempted to kill init! exitcode=0x00000004
yash
2015/05/18
foyour info I have taken LOADADDR = 0x00008000
Balau
2015/05/18
There are many things that could be wrong and many ways to troubleshoot.
– First of all, try to read the comments above here of the people who had the same kernel panic and my answers to them.
– You could increase verbosity by appending kernel parameters debug, earlyprintk, initcall_debug, loglevel=7
– You could start QEMU with -s -S and attach with gdb of the toolchain you are using, loading the vmlinux for symbols, breaking somewhere in init/main.c such as init_post, and trying to understand what happens.
Tushar Joshi
2015/10/24
Hi Balau,
I was trying to perform this lab. When I gave the command
make ARCH=arm CROSS_COMPILE=arm-none-eabi- all
I got the following error:
tushar@tushar-SVE14118FXW:~/Downloads/rtos/linux-4.2.4$ make ARCH=arm CROSS_COMPILE=arm-none-eabi- all
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h’ is up to date.
CHK include/generated/bounds.h
CHK include/generated/timeconst.h
CC arch/arm/kernel/asm-offsets.s
arch/arm/kernel/asm-offsets.c:54:2: error: #error Your compiler is too buggy; it is known to miscompile kernels
#error Your compiler is too buggy; it is known to miscompile kernels
^
arch/arm/kernel/asm-offsets.c:55:2: error: #error and result in filesystem corruption and oopses.
#error and result in filesystem corruption and oopses.
^
make[1]: *** [arch/arm/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2
Please help me out. I am a beginner at this.
Balau
2015/10/26
I went to this file: https://github.com/torvalds/linux/blob/v4.2-rc4/arch/arm/kernel/asm-offsets.c
The code that gives you the error is the following:
#if GCC_VERSION >= 40800 && GCC_VERSION < 40803
#error Your compiler is too buggy; it is known to miscompile kernels
#error and result in filesystem corruption and oopses.
So you were unlucky to try to use a GCC between 4.8.0 and 4.8.2 that has important bugs according to Linux kernel developers.
You should try a newer (or older) version of the same
arm-none-eabi-gcc
compiler.Antonio
2018/06/19
Here is an easier way to start an arm VM
https://github.com/nongiach/arm_now
$ sudo pip3 install arm_now
$ arm_now start armv5-eabi
Welcome to arm_now
buildroot login: root
uname -m
armv7l
Amrutha Somasundar
2021/03/05
Hey,
I followed the exact commands, however, qemu just shows a blank black screen.
If I use console=ttyama0, the following messages show up
Uncompressing Linux… done, booting the kernel.
Error: unrecognized/unsupported machine ID (r1 = 0x00000183).
Available machine support:
ID (hex) NAME
ffffffff Generic DT based system
ffffffff ARM-Versatile (Device Tree Support)
Please check your kernel config and/or bootloader.
How do I resolve this?