Gentoo Archives: gentoo-embedded

From: Marc Blumentritt <marc.blumentritt@×××××.de>
To: gentoo-embedded@l.g.o
Subject: [gentoo-embedded] Re: baselayout-2, busybox and uclibc
Date: Fri, 02 Nov 2007 19:42:38
Message-Id: fgfuge$ag0$1@ger.gmane.org
In Reply to: [gentoo-embedded] baselayout-2, busybox and uclibc by Marc Blumentritt
1 Hi,
2
3 I just want to give some feedback how far I'm with this. The base system
4 is quite minimal, only busybox, uclibc, and baselayout-2 is used.
5 Installation of every dependency of baselayout-2 is "blocked" in
6 /etc/portage/profile/package.provided. The system is booting quite fast
7 even with slow bios (did not use stop watch, but it is below 10 secs
8 including bios, which takes more than 3 secs). I use now busybox init
9 with special boot script to get it running with gentoo runlevels. There
10 seems to be a bug with bb init and PPID of processes (I will post this
11 on bb list), but it is not serious (at least I think so). As I wrote
12 earlier, a correct entry in fstab for rootfs is important (option
13 noauto), otherwise there will be an error message or even a broken
14 double mount on /. Consolefont and keymap is set with bb tools (keymap
15 file was created with bb dumpkmap). One error I overlooked up until 3
16 days ago was with checking the file systems. baselayout-2 expects
17 fsck.ext2 (e.g. for my boot partition), but bb provides e2fsck. There
18 seems also to be a bug with bb grep, which I will post on bb list, too
19 (try busybox grep -Fow usbfs /proc/filesystems). I'm using now a modular
20 kernel, because I plan to use lirc in the future, which provides kernel
21 modules. To be sure to have correct configuration files for modules
22 (e.g. /etc/modules.d/*), you have to run update-modules from
23 module-init-tools, which is a bash script. This command is also called
24 by the modules init script. Since I do not have bash in my embedded
25 system, calling this script results in an error. Therefore I have to run
26 it in my build system (linked my embedded /etc to my build /etc).
27
28 One thing I'm still working on is proper use of mdev. Thanks to
29 alpine-baselayout from Natanael, I have now a better idea how to do this.
30
31 @ Natanael: I have a problem with usbdev, which seems to be made for
32 kernel 2.4, doesn't it? Do you have a version for kernel 2.6?
33
34 OK, that's it so far. I post below inittab, start, and stop script for
35 bb init with baselayout-2. These scripts are based on Gentoo BSD
36 scripts. As always, if there are questions, just ask :-)
37
38 Marc
39
40
41
42
43 (build) hive mediamachine # cat devroot/etc/inittab
44 #
45 # System initialization, mount local filesystems, etc.
46 #si::sysinit:/sbin/rc sysinit
47 #::sysinit:/sbin/rc sysinit
48 ::sysinit:/sbin/rc.init
49
50 # TERMINALS
51 tty1::respawn:/sbin/getty 38400 tty1
52 tty2::respawn:/sbin/getty 38400 tty2
53 tty3::respawn:/sbin/getty 38400 tty3
54 tty4::respawn:/sbin/getty 38400 tty4
55 tty5::respawn:/sbin/getty 38400 tty5
56 tty6::respawn:/sbin/getty 38400 tty6
57
58 # What to do at the "Three Finger Salute".
59 #ca:12345:ctrlaltdel:/sbin/shutdown -r now
60 #::ctrlaltdel:/sbin/rc reboot
61 ::ctrlaltdel:/sbin/reboot
62
63 #l0:0:wait:/sbin/rc shutdown
64 #::shutdown:/sbin/rc.shutdown shutdown
65 ::shutdown:/sbin/rc.single
66
67
68 (build) hive mediamachine # cat devroot/sbin/rc.init
69 #!/bin/sh
70 # Copyright 2006-2007 Gentoo Foundation
71 # Distributed under the terms of the GNU General Public License v2
72
73 # Ensure we are called by init
74 echo "PPID = $PPID"
75 #[ "$PPID" == "1" ] || exit 0
76 # Problem with bb PPID?!
77
78 # If $TERM is not set then assume default of cons25
79 # This gives us a nice colour boot :)
80 [ -z "$TERM" -o "$TERM" = "dumb" ] && export TERM="cons25"
81
82 # Handle interupts
83 trap : SIGINT
84 trap "echo 'Boot interrupted'; exit 1" SIGQUIT
85
86 # BSD's init works somewhat differently to sysvinit.
87 # This block should 'translate' from the way init calls it to the way it
88 would
89 # be called by sysvinit on linux.
90 RUNLEVEL="1" /sbin/rc sysinit || exit 1
91 RUNLEVEL="1" /sbin/rc boot || exit 1
92 PREVLEVEL="1" /sbin/rc default
93
94 # We don't actually care if rc default worked or not, we should exit 0
95 # to allow logins
96 exit 0
97
98
99
100 (build) hive mediamachine # cat devroot/sbin/rc.single
101 #!/bin/sh
102 # Copyright 2006-2007 Gentoo Foundation
103 # Distributed under the terms of the GNU General Public License v2
104
105 # Ensure we are called by init
106 echo "PPID = $PPID"
107 #[ "$PPID" = "1" ] || exit 0
108
109 # Handle interupts
110 #trap : SIGINT SIGQUIT
111
112 # Try and use stuff in /lib over anywhere else so we can shutdown
113 # local mounts correctly.
114 export LD_LIBRARY_PATH="/lib${LD_LIBRARY_PATH:+:}${LDLIBRARY_PATH}"
115
116 # If $TERM is not set then assume default of cons25
117 # This gives us a nice colour boot :)
118 [ -z "$TERM" -o "$TERM" = "dumb" ] && export TERM="cons25"
119
120 # BSD's init works somewhat differently to sysvinit.
121 # This block should 'translate' from the way init calls it to the way it
122 would
123 # be called by sysvinit on linux.
124 #case "$1" in
125 # reboot) echo "reboot"; export RUNLEVEL=6;;
126 # shutdown) echo "shutdwon"; export RUNLEVEL=0;;
127 # single) echo "single"; export RUNLEVEL=S;;
128 #esac
129 #exec /sbin/rc single
130
131 # since I use bb init, I only go to single user (remove sulogin!)
132 # reboot or shutdown is done by bb commands
133 RUNLEVEL="S" /sbin/rc single
134 exit 0
135
136
137
138
139 --
140 gentoo-embedded@g.o mailing list

Replies

Subject Author
Re: [gentoo-embedded] Re: baselayout-2, busybox and uclibc Natanael Copa <natanael.copa@×××××.com>