Gentoo Archives: gentoo-embedded

From: Natanael Copa <mlists@××××××.org>
To: gentoo-embedded@l.g.o
Subject: [gentoo-embedded] dynamic linked init and initrd
Date: Wed, 04 Aug 2004 15:55:40
Message-Id: 4111069B.8090102@tanael.org
1 I'm working on a cdrom where an uclibc system is running from RAM.
2
3 The idea is to build runtime modules that is pulled during boot, just
4 like leaf (I'm actually porting a bering based cd)
5
6 I have some problem with the init program when it is dynamically linked.
7
8 The init program is supposed to be a shell script that only start a
9 busybox shell. Thats a start. But no matter what I do, busybox won't
10 start my script and I think it is because busybox is dynamically linked.
11 I want it to be so.
12
13 My kernel parameter is
14
15 init=/linuxrc
16
17 where linuxrc is a shell script:
18 #!/bin/busybox sh
19
20 /bin/busybox sh
21
22
23 Just for testing I wrote a hello world program and used it as init.
24 (init=/hello)
25
26 When this is linked statically, this is what I get:
27
28 Hello world!
29 Kernel panic: Attempted to kill init!
30
31 The hello world is executed and "init" exits. Fine. Everything works.
32
33 But when I link my hello program dynamically, linux says:
34
35 Kernel panic: No init found. Try passing init= option to kernel.
36
37 Those are the files that are on my initrd image:
38 bin/busybox
39 bin/sh
40 lib/libm.so.0
41 lib/libcrypt.so.0
42 lib/libc.so.0
43 lib/ld-uClibc.so.0
44 hello
45 dev/console
46 sbin/ldconfig
47
48 When I run ldd on /sbin/init on the ucgentoo build box it says that init
49 also is dynamically linked:
50 ucgentoo:/usr/src/bsn2 # ldd /sbin/init
51 libc.so.0 => /lib/libc.so.0 (0x40007000)
52 ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x40000000)
53
54 So it *is* possible to have a dynamically linked init program. But I am
55 missing something.
56 If anywone could give me hint, links about init/dynamic linking whatever
57 that could push me forward, I would be very thankful.
58
59 Thanks!
60
61
62 --
63 gentoo-embedded@g.o mailing list

Replies

Subject Author
Re: [gentoo-embedded] dynamic linked init and initrd Mike Frysinger <vapier@g.o>
Re: [gentoo-embedded] dynamic linked init and initrd Natanael Copa <mlists@××××××.org>