1 |
#--------------------------------------------------------------------------------------- |
2 |
# Embedded Gentoo How-To for x86 |
3 |
# |
4 |
# Commands to setup a Gentoo embedded environment, you must be root. |
5 |
# These commands are to be run on your developement system, |
6 |
# any x86 Gentoo Linux computer will do. The system should be fast, |
7 |
# to speed developement. The target can be any x86 based SBC. I'm |
8 |
# using a Geode based SBC. Latter I'll use a Via based SBC. |
9 |
# |
10 |
# version 0.04 |
11 |
# 2005.11.05 |
12 |
# |
13 |
# Heath Holcomb (heath at bulah.com) |
14 |
# Lloyd Sargent (contributor) |
15 |
# Ned Ludd (embedded Gentoo project lead, original commands posted) |
16 |
# Yuri Vasilevshi (contributor) |
17 |
# Mike George (contributor) |
18 |
# Kammi Cazze (contributor) |
19 |
# |
20 |
# development_rootfs = what you use to build the embedded_rootfs |
21 |
# embedded_rootfs = rootfs you deploy to the target system |
22 |
# SBC = single board computer (here it's an x86 based) |
23 |
# |
24 |
# References |
25 |
# http://www.gentoo.org/doc/en/handbook/index.xml |
26 |
# http://www.epiawiki.org |
27 |
# http://epia.kalf.org |
28 |
# Gentoo embedded mailing list (gentoo-embedded@l.g.o) |
29 |
# |
30 |
# |
31 |
#--------------------------------------------------------------------------------------- |
32 |
|
33 |
# create the development_rootfs |
34 |
# I use i586 becasue of target is a Geode processor |
35 |
mkdir -p /opt/i586-gentoo-uclibc-linux/usr/portage |
36 |
|
37 |
# download the latest stage 1 tarball |
38 |
wget \ |
39 |
http://gentoo.osuosl.org/experimental/x86/embedded/stages/stage1-x86-uclibc-2005.0.tar.bz2 |
40 |
|
41 |
# untar the stage to the development_rootfs |
42 |
tar -xvjf stage1-x86-uclibc-2005.0.tar.bz2 -C /opt/i586-gentoo-uclibc-linux/ |
43 |
|
44 |
# mount the development_rootfs proc and portage directories |
45 |
# don't understand this someone please add comments |
46 |
mount --bind /proc /opt/i586-gentoo-uclibc-linux/proc/ |
47 |
mount --bind /usr/portage /opt/i586-gentoo-uclibc-linux/usr/portage |
48 |
|
49 |
# copy over DNS information to the development_rootfs |
50 |
cp /etc/resolv.conf /opt/i586-gentoo-uclibc-linux/etc/resolv.conf |
51 |
|
52 |
# chroot into the development_rootfs, create new environment, |
53 |
# load variables into memory |
54 |
chroot /opt/i586-gentoo-uclibc-linux /bin/bash --login |
55 |
env-update |
56 |
source /etc/profile |
57 |
|
58 |
# modify make.conf file to your liking |
59 |
nano -w /etc/make.conf |
60 |
# this is for my target, Geode x86 processor |
61 |
USE="uclibc" |
62 |
CHOST="i586-gentoo-linux-uclibc" |
63 |
CFLAGS="-march=i586 -Os -pipe -fomit-frame-pointer -mmmx" |
64 |
CXXFLAGS="${CFLAGS}" |
65 |
FEATURES="buildpkg" |
66 |
|
67 |
# start the bootstrip script |
68 |
cd /usr/portage/scripts |
69 |
./bootstrap.sh -p -v |
70 |
./bootstrap.sh |
71 |
|
72 |
# emerge system for the development rootfs |
73 |
emerge -e system |
74 |
|
75 |
# I'm bulding busybox and uclibc here, what you do may vary |
76 |
# build busybox and uclibc, put into the embedded_rootfs (/embedded_rootfs) |
77 |
# we emerge applications in our developement rootfs and then |
78 |
# emerge -K into our embedded rootfs, that way we don't get the extra files |
79 |
# created by the build/emerge process into our embedded rootfs which needs |
80 |
# to be as small as possible |
81 |
mkdir /embedded_rootfs |
82 |
cd /usr/portage/sys-apps/baselayout-lite/ |
83 |
ROOT=/embedded_rootfs emerge baselayout-lite-1.0_pre1.ebuild |
84 |
ROOT=/embedded_rootfs emerge -K uclibc |
85 |
emerge busybox |
86 |
ROOT=/embedded_rootfs emerge -K busybox |
87 |
|
88 |
# emerge other software you need for you embedded target |
89 |
# this is very wildly depending on your needs |
90 |
emerge foobar* |
91 |
ROOT=/embedded_rootfs emerge -K foobar* |
92 |
|
93 |
# install a kernel into embedded_rootfs, 2.6.11.5 for example |
94 |
emerge vanilla-sources |
95 |
cd /usr/src/ |
96 |
ln -s linux linux-2.6.11.5 |
97 |
cd linux |
98 |
make menuconfig //configure your kernel for your TARGET SBC here |
99 |
cp /usr/src/linux/arch/i386/bzImage /embedded_rootfs/boot/vmlinuz-2.6.11.5 |
100 |
|
101 |
# install a boot loader, grub for example |
102 |
# once you copy/deploy your embedded rootfs program to you target SBC |
103 |
# you will have to run the gurb on the command line to write to the master |
104 |
# boot record (MBR) |
105 |
emerge grub |
106 |
ROOT=/embedded_rootfs emerge -K grub |
107 |
|
108 |
# set time zone in your embedded_rootfs |
109 |
# see http://leaf.sourceforge.net/doc/guide/buci-tz.html for details |
110 |
|
111 |
|
112 |
......... more stuff here ........... |
113 |
......... install xorg-x11, less than 10MB hopefully |
114 |
......... install light window manager (blackbox, windowmaker, ???) |
115 |
......... install very light X11 toolkit (?????) |
116 |
......... purge to the embedded_rootfs of unwanted files and libaries |
117 |
......... edit all config files |
118 |
......... set up the test harddrive on the target SBC |
119 |
......... install grub or lilo on the test harddrive on the target SBC |
120 |
......... transfer embedded_rootfs to the test harddrive on the target SBC |
121 |
......... debug system, and rebuild |
122 |
......... deploy embedded_rootfs from the test harddrive to flash (DiskOnChip, |
123 |
Compact Flash) |
124 |
......... tweak, rebuild, redeploy |
125 |
|
126 |
|
127 |
|
128 |
-- |
129 |
Heath Holcomb |
130 |
heath@×××××.com |
131 |
www.bulah.com |
132 |
-- |
133 |
gentoo-embedded@g.o mailing list |