Gentoo Archives: gentoo-embedded

From: Heath H Holcomb <heath@×××××.com>
To: gentoo-embedded@l.g.o
Subject: Re: [gentoo-embedded] x86 SBC Gentoo Embedded HowTo version 0.05 (unfinished)
Date: Mon, 30 May 2005 03:57:56
Message-Id: 200505292258.15352.heath@bulah.com
In Reply to: [gentoo-embedded] x86 SBC Gentoo Embedded HowTo version 0.05 (unfinished) by Heath H Holcomb
1 Should I post this to the embedded Gentoo wiki? Is it far enough along?
2
3 --
4 Heath Holcomb
5 heath at bulah.com
6 www.bulah.com
7
8
9 On 05 29 2005 10:42 pm, Heath H Holcomb wrote:
10 > Version 0.05
11 > Please add, delete, modify. Thanks!
12 >
13 > I've update my website with this version also.
14 > http://www.bulah.com/embeddedgentoo.html
15 >
16 > #--------------------------------------------------------------------------
17 >------------------------ # Embedded Gentoo How-To for x86
18 > #
19 > # Commands to setup a Gentoo embedded environment, you must be root.
20 > # These commands are to be run on your development system,
21 > # any x86 Gentoo Linux computer will do. The system should be fast,
22 > # to speed development. The target can be any x86 based SBC. I'm
23 > # using a Geode based SBC. Latter I'll use a Via based SBC.
24 > #
25 > # version 0.05
26 > # 2005.29.5
27 > #
28 > # Heath Holcomb (heath at bulah.com)
29 > # Ned Ludd (embedded Gentoo project lead, original commands posted)
30 > # Lloyd Sargent (contributor)
31 > # Yuri Vasilevshi (contributor)
32 > # Mike George (contributor)
33 > # Kammi Cazze (contributor)
34 > # Marius Schaefer (contributor)
35 > #
36 > # Definitions and Terms
37 > # system_rootfs = your regular rootfs
38 > # development_rootfs = what you use to build the embedded_rootfs
39 > # embedded_rootfs = rootfs you deploy to the target system
40 > # SBC = single board computer (here it's an x86 based)
41 > #
42 > # References
43 > # http://www.gentoo.org/doc/en/handbook/index.xml
44 > # http://www.epiawiki.org
45 > # http://epia.kalf.org
46 > # Gentoo embedded mailing list (gentoo-embedded@l.g.o)
47 > #
48 > #
49 > # Overview of process (steps)
50 > # 1 - Prepare the development_rootfs from your system_rootfs
51 > # 2 - Build the development_rootfs
52 > # 3 - Build the embedded_rootfs
53 > # 4 - Build and install non-system programs to the embedded_rootfs
54 > # 5 - Build and install a kernel to the embedded_rootfs
55 > # 6 - Deploy embedded_rootfs to target
56 > #--------------------------------------------------------------------------
57 >------------------------
58 >
59 > #---------- Step 1 - Prepare the development_rootfs from your system_rootfs
60 > ----------
61 >
62 > # You must be root.
63 > su
64 >
65 > # Create the development_rootfs.
66 > # I use i586 because of target is a Geode processor.
67 > mkdir -p /opt/i586-gentoo-uclibc-linux/usr/portage
68 >
69 > # Download the latest stage 1 tarball.
70 > wget \
71 > http://gentoo.osuosl.org/experimental/x86/embedded/stages/stage1-x86-uclibc
72 >-2005.0.tar.bz2
73 >
74 > # Untar the stage to the development_rootfs.
75 > tar -xvjf stage1-x86-uclibc-2005.0.tar.bz2 -C
76 > /opt/i586-gentoo-uclibc-linux/
77 >
78 > # Mount the proc and portage directories to your development_rootfs.
79 > # Makes your system_rootfs's proc and portage directory available from
80 > inside # of your development_rootfs (after chrooting).
81 > mount --bind /proc /opt/i586-gentoo-uclibc-linux/proc/
82 > mount --bind /usr/portage /opt/i586-gentoo-uclibc-linux/usr/portage
83 >
84 > # Copy over DNS information to the development_rootfs.
85 > cp /etc/resolv.conf /opt/i586-gentoo-uclibc-linux/etc/resolv.conf
86 >
87 > # Chroot into the development_rootfs.
88 > chroot /opt/i586-gentoo-uclibc-linux /bin/bash --login
89 >
90 >
91 > #---------- Step 2 - Build the development_rootfs
92 > -------------------------------------------
93 >
94 > # Create new environment and load variables into memory.
95 > env-update
96 > source /etc/profile
97 >
98 > # Modify make.conf file to your liking/needs.
99 > nano -w /etc/make.conf
100 > # this is for my target, Geode x86 processor
101 > USE="uclibc"
102 > CHOST="i586-gentoo-linux-uclibc"
103 > CFLAGS="-march=i586 -Os -pipe -fomit-frame-pointer -mmmx"
104 > CXXFLAGS="${CFLAGS}"
105 > FEATURES="buildpkg"
106 >
107 > # Start the bootstrip script.
108 > cd /usr/portage/scripts
109 > ./bootstrap.sh -p -v
110 > ./bootstrap.sh
111 >
112 > # Emerge the system ebuild for the development_rootfs.
113 > emerge -e system
114 >
115 >
116 > #---------- Step 3 - Build the embedded_rootfs
117 > --------------------------------------------
118 >
119 > # Create the embedded_rootfs directory.
120 > mkdir /embedded_rootfs
121 >
122 > # Emerge baselayout-lite into embedded_rootfs.
123 > # This gives your system a basic file structure.
124 > # 1.0_pre1 is the only one that is stable, right?
125 > cd /usr/portage/sys-apps/baselayout-lite/
126 > ROOT=/embedded_rootfs emerge baselayout-lite-1.0_pre1.ebuild
127 >
128 > # Emerge uclibc into the embedded_rootfs.
129 > # Use the -K option because we don't get the extra files created by the
130 > build/emerge
131 > # process into our embedded rootfs which needs to be as small as possible.
132 > ROOT=/embedded_rootfs emerge -K uclibc
133 >
134 > # Emerge busybox into the embedded_rootfs.
135 > # First you must emerge it into your development_rootfs.
136 > # This does not create the symlinks in our development embedded rootfs.
137 > emerge busybox
138 > ROOT=/embedded_rootfs emerge -K busybox
139 >
140 > # Create the symlinks for busybox in the embedded_rootfs.
141 > mkdir /embedded_rootfs/proc
142 > mount -o bind /proc/ /embedded_rootfs/proc/
143 > chroot /embedded_rootfs /bin/busybox --install -s
144 > umount /embedded_rootfs/proc
145 >
146 > # Set time zone in your embedded_rootfs.
147 > # See http://leaf.sourceforge.net/doc/guide/buci-tz.html for details.
148 > # For central standard time in the US, use "CST6CDT".
149 > nano -w /embedded_rootfs/etc/TZ
150 > /*
151 > CST6CDT
152 > */
153 >
154 > # Install a boot loader (usually grug or lilo).
155 > # Once you copy/deploy your embedded_rootfs program to you target SBC you
156 > will # have to run the grub on the command line to write to the master boot
157 > record (MBR).
158 > # Ncurses is needed by grug, it not useing gurb then you don't need
159 > ncurses. # For some reason not all of /boot/grub is copied over to the
160 > embedded_rootfs, so
161 > # a extra manual copy step is needed.
162 > ROOT=/embedded_rootfs emerge -K ncurses
163 > emerge grub
164 > ROOT=/embedded_rootfs emerge -K grub
165 > cp -R /boot/grub /embedded_rootfs/boot/
166 >
167 > # Modify your boot configure file.
168 > # The example below is for a gurb, for a boot partition on /dev/hda1 and
169 > only one
170 > # partition on the target SBC system.
171 > nano -w /embedded_rootfs/boot/grub/grub.conf
172 > /*
173 > default 0
174 > timeout 10
175 > splashimage=(hd0,0)/boot/grub/splash.xpm.gz
176 >
177 > title=Linux 2.6.x
178 > root (hd0,0)
179 > kernel /vmlinuz-2.6.x root=/dev/hda1 vga=792
180 > */
181 >
182 >
183 > #---------- Step 4 - Build and install non-system programs to the
184 > embedded_rootfs ----
185 >
186 > # Emerge other software you need for you embedded target.
187 > # This is very wildly depending on your needs.
188 > # Also your proprietary application will be done here.
189 > emerge foobar*
190 > ROOT=/embedded_rootfs emerge -K foobar*
191 >
192 >
193 > #---------- Step 5 - Build and install a kernel to the embedded_rootfs
194 > --------------------
195 >
196 > # Install a kernel into embedded_rootfs.
197 > # First we will emerge it into our development_rootfs, then configure and
198 > build it.
199 > emerge vanilla-sources
200 > cd /usr/src/
201 > cd linux
202 > make menuconfig
203 > # configure your kernel for your TARGET SBC here
204 > make
205 > ROOT=/embedded_rootfs make modules_install
206 > cp /usr/src/linux/arch/i386/boot/bzImage
207 > /embedded_rootfs/boot/vmlinuz-2.6.x
208 >
209 >
210 > #---------- Step 6 - Deploy embedded_rootfs to target
211 > -------------------------------------
212 >
213 > # Prepare a Gentoo (or any Linux distro) system on the target SBC using a
214 > harddrive.
215 > # We will create a partition (/embedded_rootfs) that will server as our
216 > "test" partition
217 > # to deploy our embedded_rootfs that we generate on our development_system.
218 > #
219 > # Use the following partitions to speed development (yours may vary):
220 > # /dev/hda1 - /embedded_rootfs - 1 GB
221 > # /dev/hda2 - /boot - 100 MB
222 > # /dev/hda3 - swap - (size varies, 512 MB is a good number)
223 > # /dev/hda4 - / - (what ever is left, at least 1.5 GB per 2005.0 install
224 > guide specs)
225 > #
226 > # Copy over your embedded_rootfs from you development system to your target
227 > # system and the directory /embedded_rootfs. Usually this can be done via
228 > a NFS
229 > # or SMB share.
230 > #
231 > # Modify your target system's gurb.conf (or lilo.conf) for allow you to
232 > boot to the
233 > # /embedded_rootfs partition.
234 > #
235 > # Reboot, and if all goes well you'll be greeted with a login prompt.
236 > #
237 > # Fin.
238 >
239 >
240 >
241 > --
242 > Heath Holcomb
243 > heath at bulah.com
244 > www.bulah.com
245
246 --
247 gentoo-embedded@g.o mailing list