From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.43) id 1E1xEF-0000id-9t for garchives@archives.gentoo.org; Mon, 08 Aug 2005 02:19:03 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.4/8.13.4) with SMTP id j782HkSp021889; Mon, 8 Aug 2005 02:17:46 GMT Received: from mercedes.websitewelcome.com (mercedes.websitewelcome.com [67.19.161.34]) by robin.gentoo.org (8.13.4/8.13.4) with ESMTP id j782HiHB007494 for ; Mon, 8 Aug 2005 02:17:45 GMT Received: from ip24-250-143-161.bc.dl.cox.net ([24.250.143.161]:43528 helo=cerebro-hp.lab) by mercedes.websitewelcome.com with esmtpsa (SSLv3:RC4-MD5:128) (Exim 4.50) id 1E1xCD-0005pX-Nq for gentoo-embedded@lists.gentoo.org; Sun, 07 Aug 2005 21:16:57 -0500 From: Heath Holcomb To: gentoo-embedded@lists.gentoo.org Subject: [gentoo-embedded] x86 SBC Gentoo Embedded HotTo version 0.07 Date: Sun, 7 Aug 2005 21:16:59 -0500 User-Agent: KMail/1.8.1 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-embedded@gentoo.org Reply-to: gentoo-embedded@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200508072116.59874.liquidcable@bulah.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - mercedes.websitewelcome.com X-AntiAbuse: Original Domain - lists.gentoo.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - bulah.com X-Source: X-Source-Args: X-Source-Dir: X-Archives-Salt: 503d9202-c4ca-43f4-8ce6-6179ddb9b79d X-Archives-Hash: 9ff7768c08b9650b4ca70e42d7827317 Version 0.07 Please add, delete, modify. Thanks! Several fixes. Root password now works. Several work arounds are no longer need, as the embedded Gentoo team has fixed them (I'm guess because I no longer get those errors). There is still one problem when "emerge -e system" for groff. Bug 98187 (http://bugs.gentoo.org/show_bug.cgi?id=98187). Check out the bug report for the temp fix/work around (USE="-sandbox" emerge -e system). I've update my website with this version also. http://www.bulah.com/embeddedgentoo.html #-------------------------------------------------------------------------------- # Embedded Gentoo How-To for x86 # # A how-to guide to setup a Gentoo embedded environment, you must be root. # These commands are to be run on your development system, # any x86 Gentoo Linux computer will do. The system should be fast, # to speed development. The target can be any x86 based SBC. I'm # using a Geode based SBC. Latter I'll use a Via based SBC. # # version 0.07 # 2005.8.7 # # Heath Holcomb (heath at bulah.com) # Ned Ludd (original commands posted) # Lloyd Sargent (contributor) # Yuri Vasilevski (contributor) # Mike George (contributor) # Kammi Cazze (contributor) # Marius Schaefer (contributor) # # Definitions and Terms # system_rootfs = your regular rootfs, development computer # development_rootfs = what you use to build the embedded_rootfs # embedded_rootfs = rootfs you deploy to the target system # SBC = single board computer (here it's an x86 based) # # References # http://www.gentoo.org/doc/en/handbook/index.xml # http://www.epiawiki.org # http://epia.kalf.org # Gentoo embedded mailing list (gentoo-embedded@lists.gentoo.org) # # # Overview of process (steps) # 1 - Prepare the development_rootfs from your system_rootfs # 2 - Build the development_rootfs # 3 - Build the embedded_rootfs # 4 - Build and install non-system programs to the embedded_rootfs # 5 - Build and install a kernel to the embedded_rootfs # 6 - Deploy embedded_rootfs to target # #-------------------------------------------------------------------------------- #----- Step 1 - Prepare the development_rootfs from your system_rootfs ------- # You must be root. su - # Create the development_rootfs. # I use i586 because of target is a Geode processor. mkdir -p /opt/i586-gentoo-uclibc-linux/usr/portage # Download the latest stage 1 tarball. wget \ http://gentoo.osuosl.org/experimental/x86/embedded/stages/stage1-x86-uclibc-2005.0.tar.bz2 # Untar the stage to the development_rootfs. tar -xvjpf stage1-x86-uclibc-2005.0.tar.bz2 -C /opt/i586-gentoo-uclibc-linux/ # Mount the proc and portage directories to your development_rootfs. # Makes your system_rootfs's proc and portage directory available from inside # of your development_rootfs (after chrooting). mount --bind /proc /opt/i586-gentoo-uclibc-linux/proc/ mount --bind /usr/portage /opt/i586-gentoo-uclibc-linux/usr/portage # Copy over DNS information to the development_rootfs. cp /etc/resolv.conf /opt/i586-gentoo-uclibc-linux/etc/resolv.conf # Chroot into the development_rootfs. chroot /opt/i586-gentoo-uclibc-linux /bin/bash --login #----- Step 2 - Build the development_rootfs --------------------------------- # Create new environment and load variables into memory. env-update source /etc/profile # Modify make.conf file to your liking/needs. nano -w /etc/make.conf # This is for my target, Geode x86 processor. /* USE="bitmap-fonts minimal truetype-fonts mmx" CHOST="i586-gentoo-linux-uclibc" CFLAGS="-march=i586 -Os -pipe -fomit-frame-pointer -mmmx" CXXFLAGS="${CFLAGS}" FEATURES="buildpkg" VIDEO_CARDS="chips" UCLIBC_CPU="586MMX" */ # Set profile to use 2.6 kernel. # The current stage uses 2.4 by default, and for most cases you are going # to want a 2.6.x kernel. cd /etc/ unlink make.profile ln -s ../usr/portage/profiles/uclibc/x86 make.profile # Start the bootstrap script. cd /usr/portage/scripts ./bootstrap.sh -p -v ./bootstrap.sh # Emerge the system ebuild for the development_rootfs. emerge -e system #----- Step 3 - Build the embedded_rootfs ------------------------------------ # Create the embedded_rootfs directory. mkdir /embedded_rootfs # Emerge baselayout-lite into embedded_rootfs. # This gives your system a basic file structure. # 1.0_pre1 is the only one that is stable, right? cd /usr/portage/sys-apps/baselayout-lite/ ROOT=/embedded_rootfs emerge baselayout-lite-1.0_pre1.ebuild # Workaround 1 # Baselayout-lite is still beta, so a few fixes are needed. # There needs to be a directory "log" in /var. # Inittab calls for /usr/bin/tail, but it needs to /usr/bin. mkdir /embedded_rootfs/var/log nano -w /embedded_rootfs/etc/inittab /* #tty3::respawn:/usr/bin/tail -f /var/log/messages tty3::respawn:/bin/tail -f /var/log/messages */ # Emerge uclibc into the embedded_rootfs. # Use the -K option because we don't get the extra files created by the # build/emerge process into our embedded rootfs which needs to be as # small as possible. ROOT=/embedded_rootfs emerge -K uclibc # Emerge busybox into the embedded_rootfs. # First you must emerge it into your development_rootfs. # This does not create the symlinks in our development embedded rootfs. emerge busybox ROOT=/embedded_rootfs emerge -K busybox # Create the symlinks for busybox in the embedded_rootfs. mkdir /embedded_rootfs/proc mount -o bind /proc/ /embedded_rootfs/proc/ chroot /embedded_rootfs /bin/busybox --install -s umount /embedded_rootfs/proc # Set time zone in your embedded_rootfs. # See http://leaf.sourceforge.net/doc/guide/buci-tz.html for details. # For central standard time in the US, use "CST6CDT". nano -w /embedded_rootfs/etc/TZ /* CST6CDT */ # Install a boot loader (usually grug or lilo). # Once you copy/deploy your embedded_rootfs to your target SBC you will # have to run grub on the command line to write to the master boot record # (MBR). # For some reason not all of /boot/grub is copied over to the # embedded_rootfs, so a extra manual copy step is needed. # The --nodeps gets rip of the run time need of ncurses. emerge --nodeps grub ROOT=/embedded_rootfs emerge -K --nodeps grub cp -R /boot/grub /embedded_rootfs/boot/ # Modify your boot configure file. # The example below is for a gurb, for a boot partition on /dev/hda1 and only # one partition on the target SBC system. nano -w /embedded_rootfs/boot/grub/grub.conf /* default 0 timeout 10 splashimage=(hd0,0)/boot/grub/splash.xpm.gz title=Linux 2.6.x root (hd0,0) kernel /vmlinuz-2.6.x root=/dev/hda1 vga=792 */ # Set root password for the embedded_rootfs chromm /embedded_rootfs passwd rm /embedded_rootfs/etc/passwd- exit # Modify fstab. # Below is mine, yours may vary. nano -w /embedded_rootfs/etc/fstab /* /dev/hda1 / reiserfs defaults 0 0 none /proc proc defaults 0 0 none /sys sysfs defaults 0 0 none /dev/shm tmpfs defaults 0 0 */ # Clean up the embedded_rootfs. # Don't know why these files are there in the first place, so if anyone # can tell me why..... rm -R /embedded_rootfs/var/db/pkg/ * rm -R /embedded_rootfs/var/lib/portage/ #---- Step 4 - Build and install non-system programs to the embedded_rootfs -- # Emerge other software you need for you embedded target. # This is very wildly depending on your needs. # Also your proprietary application will be done here. emerge foo* ROOT=/embedded_rootfs emerge -K foo* #---- Step 5 - Build and install a kernel to the embedded_rootfs ------------- # Install a kernel into embedded_rootfs. # First we will emerge it into our development_rootfs, then configure and # build it. emerge vanilla-sources cd /usr/src/ cd linux make menuconfig # Configure your kernel for your TARGET SBC here. I HIGHLY suggest you # configure the kernel to compile everything into the kernel, and nothing # as a module. make ROOT=/embedded_rootfs make modules_install cp /usr/src/linux/arch/i386/boot/bzImage /embedded_rootfs/boot/vmlinuz-2.6.x # A few notes on compiling your kernel. # If deploying to Compact Flash/DiskOnChip/SD use ext2, as the journaling # filing systems "write" to much for a flash device. # If deploying to a hard drive use a journaling filing system, such as # ext3 or reiserfs. #---- Step 6 - Deploy embedded_rootfs to target ------------------------------ # Prepare a Gentoo (or any Linux distro) system on the target SBC using a # harddrive. This is known as the target development rootfs. # We will create a partition (/embedded_rootfs) that will server as our # "test" partition to deploy our embedded_rootfs that we generate on our # development_system. # # I use the following partitions to speed development (yours may vary): # /dev/hda1 - /embedded_rootfs - 1 GB # /dev/hda2 - /boot - 100 MB # /dev/hda3 - swap - (size varies, 512 MB is a good number) # /dev/hda4 - / - (what is left, at least 1.5 GB per 2005.0 install guide specs) # # Copy over your embedded_rootfs from you development system to your target # system and the directory /embedded_rootfs. This needs to be done via NFS as # need to preserve the permissions. # #The following commands are done from the # target development rootfs. mount -t reiserfs /dev/hda1 /mnt/embedded_rootfs mount -t nfs\ 192.168.0.10:/opt/i586-gentoo-uclibc-linux/embedded_rootfs\ /mnt/nfs_embedded_rootfs cp -adpR /mnt/nfs_embedded_rootfs/* /mnt/embedded_rootfs # Modify your target system's gurb.conf (or lilo.conf) for allow you to boot # to the embedded_rootfs partition. # # Reboot, and if all goes well you'll be greeted with a login prompt. # # Fin. -- heath holcomb liquidcable at bulah.com www.bulah.com -- gentoo-embedded@gentoo.org mailing list