[ELDK] eldk arm qemu hello world
Johan
list at fun-tech.se
Thu Jul 22 15:01:48 CEST 2010
Hi again
I went back to read some more documentation,
to avoid doing more "strange things".
So to correct my ways I started to read some kernel docs,
but doing this total confusion started.
In this file:
http://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt
I find this in the "Contents of initramfs" section.
/A good first step is to get initramfs to run a statically linked "hello
world"
program as init, and test it under an emulator like qemu (www.qemu.org) or
User Mode Linux, like so:
cat > hello.c << EOF
#include <stdio.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
printf("Hello world!\n");
sleep(999999999);
}
EOF
gcc -static hello.c -o init
echo init | cpio -o -H newc | gzip > test.cpio.gz
# Testing external initramfs using the initrd loading mechanism.
qemu -kernel /boot/vmlinuz -initrd test.cpio.gz /dev/zero/
But but but, that is more or less what I tried and failed with.
(as a side note I also tried this way and that fails as well)
Do you understand why this is in the docs if it wrong?
Thanks
Johan
On 07/22/2010 12:36 AM, Johan wrote:
> Hi
>
> I could not get the full scale to work,
> so I started to scale down until I could not scale down any more.
>
> I guess I went a little bit to far this time.
>
> BR
> Johan
>
> On 07/22/2010 12:25 AM, Wolfgang Denk wrote:
>> Dear Johan,
>>
>> In message<4C4764AB.10808 at fun-tech.se> you wrote:
>>> I'm trying to follow the basic step to get a simple hello world to
>>> compile and run in qemu (arm).
>> ...
>>> armVFP-gcc -static test.c -o test
>>> echo test | cpio -o --format=newc> rootfs
>> Well, this is NOT a usable root file system. First, static linking
>> with glibc is not excactly doing what you might think it does; second,
>> the kernel tries to start "init", not "test"; third, user space
>> applications expect a certain environment like stnadar input and
>> output channels connected to devices, and all the other things a real
>> init process will do for them.
>>
>>
>> Why don't you use the ramdisk image that comes with the ELDK?
>>
>> Best regards,
>>
>> Wolfgang Denk
>>
>
More information about the eldk
mailing list