Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Marc Blumentritt <marc.blumentritt-KvP5wT2u2U0 <at> public.gmane.org>
Subject: baselayout-2, busybox and uclibc
Newsgroups: gmane.linux.gentoo.embedded
Date: Wednesday 10th October 2007 18:48:42 UTC (over 9 years ago)
Hi,

first: Be warned, this is a long email!

I'm working on my first embedded system. I plan to build for my media pc
 a minimal gentoo, based on uclibc, busybox, and baselayout-2. I want to
use standard init.d scripts from gentoo. The root file system will be
placed in initramfs for maximum boot speed. Kernel will be monolithic
and device files static.

During my setup I stumbled over a few things, which I want to share with
you. Perhaps you have some ideas for better solutions and can answer me
some questions, which I have for certain steps I list below (marked by
QUESTION).

Here is what I did so far:

1.) I started with a stage3-uclibc tarball, which I updated to stable
system. Than I changed CHOST from i386... to i686..., since this is the
toolchain I want to use for building my embedded system.

2.) I use for ROOT and PORTAGE_CONFIGROOT to different dirs, because if
something went wrong, I can delete ROOT without deleting my portage
configuration. I set up wrappers for useful tools (emerge, equery,
etc-update, and revdep-rebuild), which use ROOT and PORTAGE_CONFIGROOT.

3.) Portage configuration:

3-a.) profile: I use a slightly modified version of the embedded
profile, where removed tinylogin and baselayout and added uclibc.

3-b.) make.conf: since the baselayout does provide only minimal
configuration (and I'm not so sure how to tweak profiles), I configure a
lot of stuff in make.conf:
---make.conf---
# Please consult /etc/make.conf.example for a more detailed example
ARCH="x86"
ACCEPT_KEYWORDS="x86"
CFLAGS="-Os -pipe -march=c3-2 -fomit-frame-pointer"
CHOST="i686-gentoo-linux-uclibc"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-Wl,-z,relro"
AUTOCLEAN="yes"
MAKEOPTS="-j3"
FEATURES="nodoc noinfo noman"
USE="minimal make-symlinks uclibc unicode"
# uclibc stuff; copied from uclibc profile
PORTAGE_LIBC="uClibc"
ELIBC=uclibc
UCLIBC_CPU="NEHEMIAH"
# Set a nice value for portage to get smother working of system
PORTAGE_NICENESS=15
#overlay
PORTDIR_OVERLAY="/usr/portage/local/my_ebuilds"
#language setting; only de?
LINGUAS="de en"
# hardware stuff
VIDEO_CARDS="via"
ALSA_CARDS="via82xx"
# Lirc options
LIRC_DEVICES="imon_pad2keys"
# LCD options
LCD_DEVICES="imon"
---end of make.conf---

QUESTION: What USE flags do you suggest?

3-c.) To use baselayout-2.0.0_rc4-r1 I have to unmask it and makedev in
package.unmask and in package.keywords. I also set in package.use
"kernel_linux" for baselayout. I had to do this, because otherwise
baselayout-2 would not compile! QUESTION: Does anyone know why (s.
attached file build.log.gz)?

4.) install system -> installation of uclibc and busybox. Afterward I
movved $ROOT/etc/portage/savedefaults to
$PORTAGE_CONFIGROOT/etc/portage/savedefaults

5.) Installation of dropbear and baselayout-2, which pulls in some
dependencies. After installation it looks like this:
(build) hive mediamachine # mm_equery list
[ Searching for all packages in all categories among: ]
 * installed packages
[I--] [  ] net-misc/dropbear-0.49 (0)
[I--] [M~] sys-apps/baselayout-2.0.0_rc4-r1 (0)
[I--] [  ] sys-apps/busybox-1.6.1 (0)
[I--] [  ] sys-apps/coreutils-6.9-r1 (0)
[I--] [M~] sys-apps/makedev-3.23.1 (0)
[I--] [  ] sys-apps/module-init-tools-3.2.2-r3 (0)
[I--] [  ] sys-apps/sysvinit-2.86-r8 (0)
[I--] [  ] sys-libs/ncurses-5.6-r1 (5)
[I--] [ -] sys-libs/uclibc-0.9.28.3 (0)
[I--] [  ] sys-libs/zlib-1.2.3-r1 (0)
[I--] [  ] virtual/init-0 (0)

QUESTION: Are there any useful configuration tips for dropbear?

OK, the next steps are what I want to do next:


6.) Configuration of busybox: busybox provides a lot of tools, but some
tools should not be used. I have so far identified:
- start-stop-daemon (provided by baselayout-2)
- init (provided by sysvinit)
I configure busybox to not provide these tools in
$PORTAGE_CONFIGROOT/etc/portage/savedefaults/sys-apps/busybox-1.6.1:
Comment the following:
# for start-stop-daemon
CONFIG_START_STOP_DAEMON=y
CONFIG_FEATURE_START_STOP_DAEMON_FANCY=y
CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS=y
# for init
CONFIG_INIT=y
# CONFIG_DEBUG_INIT is not set
CONFIG_FEATURE_USE_INITTAB=y
CONFIG_FEATURE_INIT_SCTTY=y
CONFIG_FEATURE_INIT_SYSLOG=y
CONFIG_FEATURE_EXTRA_QUIET=y
CONFIG_FEATURE_INIT_COREDUMPS=y
CONFIG_FEATURE_INITRD=y
After configuration reinstall busybox with USE=savedconfig

QUESTION: Are there any tools I should disable, too? Do I really need
coreutils (and ncurses, which is pulled in by coreutils) or are the
busybox tools enough (busybox provides about 69% of the tools in
coreutils)?

7.) Device files: create minimum device file set. QUESTION: What is the
minimum device file set for booting in ram from initramfs? The following
list is taken from "Building Embedded Linux Systems":
files:
mem, null, zero, random, tty0, tty1, ttyS0 (QUESTION: do I need this? I
do not want to use a serial port), tty, console
links:
fd (link to /proc/self/fd), stdin (link to fd/0), stdout (link to fd/1),
stderr (link to fd/2)

Are there any other files?

All files I need to fully use my media-pc I will create after booting
with mdev (from busybox) and copy them to my build machine, since I want
to use static device files.

8.) System configuration: up to now I have only two QUESTIONs:
-How do I use locals with uclibc?
-Do I have to tell baselayout-2, that I use ash as shell?

9.) install grub.

10.) Build kernel and initramfs from ROOT

11.) Boot media-pc with livecd and copy kernel, initramfs and grub files
to media-pc. QUESTION: Since I have already grub installed on my
media-pc, grub installation to boot sector is not a problem, but what do
you do, if you do not have grub installed? Boot with livecd, extract
initramfs and use installed grub to install grub to boot sector?

QUESTION: Do you have any remarks?

OK, thanks for reading.
Marc
 
CD: 3ms