Gentoo Archives: gentoo-embedded

From: Marc Blumentritt <marc.blumentritt@×××××.de>
To: gentoo-embedded@l.g.o
Subject: [gentoo-embedded] baselayout-2, busybox and uclibc
Date: Wed, 10 Oct 2007 19:15:33
Message-Id: fej6qa$ol0$1@sea.gmane.org
1 Hi,
2
3 first: Be warned, this is a long email!
4
5 I'm working on my first embedded system. I plan to build for my media pc
6 a minimal gentoo, based on uclibc, busybox, and baselayout-2. I want to
7 use standard init.d scripts from gentoo. The root file system will be
8 placed in initramfs for maximum boot speed. Kernel will be monolithic
9 and device files static.
10
11 During my setup I stumbled over a few things, which I want to share with
12 you. Perhaps you have some ideas for better solutions and can answer me
13 some questions, which I have for certain steps I list below (marked by
14 QUESTION).
15
16 Here is what I did so far:
17
18 1.) I started with a stage3-uclibc tarball, which I updated to stable
19 system. Than I changed CHOST from i386... to i686..., since this is the
20 toolchain I want to use for building my embedded system.
21
22 2.) I use for ROOT and PORTAGE_CONFIGROOT to different dirs, because if
23 something went wrong, I can delete ROOT without deleting my portage
24 configuration. I set up wrappers for useful tools (emerge, equery,
25 etc-update, and revdep-rebuild), which use ROOT and PORTAGE_CONFIGROOT.
26
27 3.) Portage configuration:
28
29 3-a.) profile: I use a slightly modified version of the embedded
30 profile, where removed tinylogin and baselayout and added uclibc.
31
32 3-b.) make.conf: since the baselayout does provide only minimal
33 configuration (and I'm not so sure how to tweak profiles), I configure a
34 lot of stuff in make.conf:
35 ---make.conf---
36 # Please consult /etc/make.conf.example for a more detailed example
37 ARCH="x86"
38 ACCEPT_KEYWORDS="x86"
39 CFLAGS="-Os -pipe -march=c3-2 -fomit-frame-pointer"
40 CHOST="i686-gentoo-linux-uclibc"
41 CXXFLAGS="${CFLAGS}"
42 LDFLAGS="-Wl,-z,relro"
43 AUTOCLEAN="yes"
44 MAKEOPTS="-j3"
45 FEATURES="nodoc noinfo noman"
46 USE="minimal make-symlinks uclibc unicode"
47 # uclibc stuff; copied from uclibc profile
48 PORTAGE_LIBC="uClibc"
49 ELIBC=uclibc
50 UCLIBC_CPU="NEHEMIAH"
51 # Set a nice value for portage to get smother working of system
52 PORTAGE_NICENESS=15
53 #overlay
54 PORTDIR_OVERLAY="/usr/portage/local/my_ebuilds"
55 #language setting; only de?
56 LINGUAS="de en"
57 # hardware stuff
58 VIDEO_CARDS="via"
59 ALSA_CARDS="via82xx"
60 # Lirc options
61 LIRC_DEVICES="imon_pad2keys"
62 # LCD options
63 LCD_DEVICES="imon"
64 ---end of make.conf---
65
66 QUESTION: What USE flags do you suggest?
67
68 3-c.) To use baselayout-2.0.0_rc4-r1 I have to unmask it and makedev in
69 package.unmask and in package.keywords. I also set in package.use
70 "kernel_linux" for baselayout. I had to do this, because otherwise
71 baselayout-2 would not compile! QUESTION: Does anyone know why (s.
72 attached file build.log.gz)?
73
74 4.) install system -> installation of uclibc and busybox. Afterward I
75 movved $ROOT/etc/portage/savedefaults to
76 $PORTAGE_CONFIGROOT/etc/portage/savedefaults
77
78 5.) Installation of dropbear and baselayout-2, which pulls in some
79 dependencies. After installation it looks like this:
80 (build) hive mediamachine # mm_equery list
81 [ Searching for all packages in all categories among: ]
82 * installed packages
83 [I--] [ ] net-misc/dropbear-0.49 (0)
84 [I--] [M~] sys-apps/baselayout-2.0.0_rc4-r1 (0)
85 [I--] [ ] sys-apps/busybox-1.6.1 (0)
86 [I--] [ ] sys-apps/coreutils-6.9-r1 (0)
87 [I--] [M~] sys-apps/makedev-3.23.1 (0)
88 [I--] [ ] sys-apps/module-init-tools-3.2.2-r3 (0)
89 [I--] [ ] sys-apps/sysvinit-2.86-r8 (0)
90 [I--] [ ] sys-libs/ncurses-5.6-r1 (5)
91 [I--] [ -] sys-libs/uclibc-0.9.28.3 (0)
92 [I--] [ ] sys-libs/zlib-1.2.3-r1 (0)
93 [I--] [ ] virtual/init-0 (0)
94
95 QUESTION: Are there any useful configuration tips for dropbear?
96
97 OK, the next steps are what I want to do next:
98
99
100 6.) Configuration of busybox: busybox provides a lot of tools, but some
101 tools should not be used. I have so far identified:
102 - start-stop-daemon (provided by baselayout-2)
103 - init (provided by sysvinit)
104 I configure busybox to not provide these tools in
105 $PORTAGE_CONFIGROOT/etc/portage/savedefaults/sys-apps/busybox-1.6.1:
106 Comment the following:
107 # for start-stop-daemon
108 CONFIG_START_STOP_DAEMON=y
109 CONFIG_FEATURE_START_STOP_DAEMON_FANCY=y
110 CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS=y
111 # for init
112 CONFIG_INIT=y
113 # CONFIG_DEBUG_INIT is not set
114 CONFIG_FEATURE_USE_INITTAB=y
115 CONFIG_FEATURE_INIT_SCTTY=y
116 CONFIG_FEATURE_INIT_SYSLOG=y
117 CONFIG_FEATURE_EXTRA_QUIET=y
118 CONFIG_FEATURE_INIT_COREDUMPS=y
119 CONFIG_FEATURE_INITRD=y
120 After configuration reinstall busybox with USE=savedconfig
121
122 QUESTION: Are there any tools I should disable, too? Do I really need
123 coreutils (and ncurses, which is pulled in by coreutils) or are the
124 busybox tools enough (busybox provides about 69% of the tools in coreutils)?
125
126 7.) Device files: create minimum device file set. QUESTION: What is the
127 minimum device file set for booting in ram from initramfs? The following
128 list is taken from "Building Embedded Linux Systems":
129 files:
130 mem, null, zero, random, tty0, tty1, ttyS0 (QUESTION: do I need this? I
131 do not want to use a serial port), tty, console
132 links:
133 fd (link to /proc/self/fd), stdin (link to fd/0), stdout (link to fd/1),
134 stderr (link to fd/2)
135
136 Are there any other files?
137
138 All files I need to fully use my media-pc I will create after booting
139 with mdev (from busybox) and copy them to my build machine, since I want
140 to use static device files.
141
142 8.) System configuration: up to now I have only two QUESTIONs:
143 -How do I use locals with uclibc?
144 -Do I have to tell baselayout-2, that I use ash as shell?
145
146 9.) install grub.
147
148 10.) Build kernel and initramfs from ROOT
149
150 11.) Boot media-pc with livecd and copy kernel, initramfs and grub files
151 to media-pc. QUESTION: Since I have already grub installed on my
152 media-pc, grub installation to boot sector is not a problem, but what do
153 you do, if you do not have grub installed? Boot with livecd, extract
154 initramfs and use installed grub to install grub to boot sector?
155
156 QUESTION: Do you have any remarks?
157
158 OK, thanks for reading.
159 Marc

Attachments

File name MIME type
build.log.gz application/x-gzip

Replies

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