[ELDK] eldk arm qemu hello world

Johan eldk at fun-tech.se
Wed Jul 21 23:20:43 CEST 2010


I'm trying to follow the basic step to get a simple hello world to
compile and run in qemu (arm).

I'm following this guide but I using the eldk toolchain and not and not 
CodeSourcery, and that is why I thought that someone on this list maybe 
can see what is going wrong)

The kernel always breaks with this kernel panic:
VFP support v0.3: implementor 41 architecture 1 part 10 variant 9 rev 0
Freeing init memory: 112K
Kernel panic - not syncing: Attempted to kill init!

But the hello world is so simple I can't see what is wrong with it,
unless there is something strange with how the eldk gcc handle printf.
(but that feels a little strange)

Anyway this is exactly how I did it (hope it is not to much info :)

My pc is running Ubuntu 10.04,

# First I installed eldk:

mkdir -p ~/DDS/eldk/
cd ~/DDS/eldk/

wget ftp://ftp.denx.de/pub/eldk/4.2/arm-linux-x86/iso/arm-2008-11-24.iso
mkdir eldk_iso/
sudo mount -o loop arm-2008-11-24.iso eldk_iso/
sudo mkdir -p /opt/eldk/
sudo chown $USER.users /opt/eldk/

cd eldk_iso/
./install -d /opt/eldk/ armVFP

echo '#DDS eldk stuff...' >> ~/.bashrc
echo 'export PATH=$PATH:/opt/eldk/usr/bin:/opt/eldk/bin' >> ~/.bashrc
echo 'export CROSS_COMPILE=armVFP-linux-' >> ~/.bashrc
echo '' >> ~/.bashrc


# Then I get and compile a standard kernel

mkdir -p ~/DDS/qemu/VersatilePB/
cd ~/DDS/qemu/VersatilePB/

git clone 

cd linux-2.6.34

make ARCH=arm versatile_defconfig
make ARCH=arm menuconfig
- Enable loadable module support
+ Kernel Features -> Use the ARM EABI to compile the kernel
+ Kernel hacking -> Compile the kernel with debug info
Save an Alternate Configuration File = versatile_defconfig_mod.config

# $PARALLEL == -j4
make $PARALLEL ARCH=arm CROSS_COMPILE=arm-linux- all

cd arch/arm/boot

#At this point the kernel boots but is missing init so it stops.
qemu-system-arm -M versatilepb -m 128M \
     -serial stdio  \
     -kernel zImage \
     -append "console=ttyAMA0"

# Then I create a simple hello world

echo '#include <stdio.h>' > test.c
echo '' >> test.c
echo 'void main() {' >> test.c
echo '    printf("Hello World!\n");' >> test.c
echo '    while(1);' >> test.c
echo '}' >> test.c

# Compile it with static so I don't need any libs

armVFP-gcc -static test.c -o test
echo test | cpio -o --format=newc > rootfs

# And try to run it.
qemu-system-arm -M versatilepb -m 128M \
     -serial stdio \
     -kernel zImage \
     -initrd rootfs \
     -append "root=/dev/ram rdinit=/test console=ttyAMA0"

# But I only get this (there is a panic at the end)

Uncompressing Linux... done, booting the kernel.
Linux version (cj at frog) (gcc version 4.2.2) #1 Wed Jul 21 
15:49:58 CEST 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: root=/dev/ram rdinit=/test 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: 126276k/126276k available, 4796k reserved, 0K highmem
Virtual kernel memory layout:
     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
     DMA     : 0xffc00000 - 0xffe00000   (   2 MB)
     vmalloc : 0xc8800000 - 0xd8000000   ( 248 MB)
     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
     modules : 0xbf000000 - 0xc0000000   (  16 MB)
       .init : 0xc0008000 - 0xc0024000   ( 112 kB)
       .text : 0xc0024000 - 0xc02d3000   (2748 kB)
       .data : 0xc02d4000 - 0xc02ee560   ( 106 kB)
Hierarchical RCU implementation.
RCU-based detection of stalled CPUs is enabled.
VIC @f1140000: id 0x00041190, vendor 0x41
Console: colour dummy device 80x30
Calibrating delay loop... 131.07 BogoMIPS (lpj=655360)
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 <bio-0> at 0
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: 544K
NetWinder Floating Point Emulator V0.97 (double precision)
Installing knfsd (copyright (C) 1996 okir at 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 80x60
brd: module loaded
smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre <nico at fluxnic.net>
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: 112K
Kernel panic - not syncing: Attempted to kill init!
[<c00282cc>] (dump_backtrace+0x0/0x10c) from [<c002840c>] 
  r6:00000004 r5:c7c15c40 r4:c7c18000
[<c00283f4>] (dump_stack+0x0/0x1c) from [<c004151c>] (panic+0x48/0xd4)
[<c00414d4>] (panic+0x0/0xd4) from [<c0044518>] (do_exit+0x64/0x5bc)
  r3:c02dbdb8 r2:c7c15d58 r1:c7c19d24 r0:c029b3d8
[<c00444b4>] (do_exit+0x0/0x5bc) from [<c0044b00>] (do_group_exit+0x90/0xc4)
[<c0044a70>] (do_group_exit+0x0/0xc4) from [<c004ec64>] 
[<c004e96c>] (get_signal_to_deliver+0x0/0x330) from [<c002727c>] 
[<c0027210>] (do_notify_resume+0x0/0x5e4) from [<c0024ecc>] 

### ----

Any idea why I don't see a "hello world" here?


More information about the eldk mailing list