Gentoo Embedded with Xorg

This page is intended to help people who want to do one of two things:

1. Install Gentoo Embedded with or without Xorg support and boot from FLASH memory

2. Install Linux on an AMD Geode LX / GX based mini computer

Much of the information here is derived from the guidelines at the following two locations which I recommend reading:

gentoo-wiki.com/TinyGentoo

www.bulah.com/embeddedgentoo.html

Making a Gentoo Image for Compact Flash card on AMD Geode LX

Set your BIOS to use 32MB of RAM for the Display Adapter (or the size you need for your resolution) 

Set up a Gentoo Development CHROOT environment

# Download and install portage under /usr/portage 
# su - 
# cd /opt 
# mkdir /opt/dallur 
# mkdir -p /opt/dallur/usr/portage 
# wget ftp://trumpetti.atm.tut.fi/gentoo/experimental/x86/embedded/stages/stage3-x86-uclibc-2006.1.tar.bz2 
# tar -xjpf stage3-x86-uclibc-2006.1.tar.bz2 -C /opt/dallur 
# echo "mount --bind /usr/portage /opt/dallur/usr/portage" >> enter_chroot.sh 
# echo "mount --bind /dev /opt/dallur/dev" >> enter_chroot.sh 
# echo "mount -t proc proc /opt/dallur/proc" >> enter_chroot.sh 
# echo "chroot /opt/dallur/ /bin/bash --login" >> enter_chroot.sh 
# echo "umount /opt/dallur/usr/portage" >> enter_chroot.sh 
# echo "umount /opt/dallur/dev" >> enter_chroot.sh 
# echo "umount /opt/dallur/proc" >> enter_chroot.sh 
# chmod u+x enter_chroot.sh 
# cp /etc/resolv.conf /opt/dallur/etc/resolv.conf 
# ./enter_chroot.sh 
# emerge --sync 
# emerge -Du world 
# cd /etc/ 
# unlink make.profile 
# ln -s /usr/portage/profiles/uclibc/x86/2005.1 /etc/make.profile 
Edit etc/make/conf to look like: 
USE="minimal acpi alsa uclibc 3dnow mmx X fbcon fbdev png gif jpeg tiff theora a52 aac dts mad svga oggvorbis ffmpeg avi divx4linux mpeg mp3 ogg v4l win32codecs python bitmap-fonts truetype-fonts -gtk -kde -nls" 
CHOST="i586-gentoo-linux-uclibc" 
CFLAGS="-march=k6-2 -Os -pipe -fomit-frame-pointer -mmmx -m3dnow -fno-align-functions -fno-align-loops -fno-align-jumps -fno-align-labels -finline-functions" 
CXXFLAGS="${CFLAGS}" 
FEATURES="ccache buildpkg" 
PKGDIR="${PORTDIR}/packages/uclibc" 
VIDEO_CARDS="nsc fbdev v4l vesa vga" 
INPUT_DEVICES="mouse keyboard" 
# We should consider setting this to K6 or check if there is a K6-2 which would be even better 
UCLIBC_CPU="586MMX" 
PORTDIR_OVERLAY="/usr/local/portage" 
GENTOO_MIRRORS="http://ftp.rhnet.is/pub/gentoo/" 
# env-update 
# source /etc/profile 
# emerge -av python 
# emerge -e system 
# emerge -av grub freetype 

Set up a the TinyGentoo based root environment called dallur

# mkdir /dallur 
# echo "sys-apps/baselayout-lite **" >> /etc/portage/package.keywords 
# ROOT=/dallur USE=make-symlinks emerge -avN baselayout-lite uclibc busybox 
# chroot /dallur /bin/ash 
# passwd 
# addgroup -g 100 users kid 
# adduser -h /home/kid -s /bin/ash -G users kid 
# exit 
# echo "dallur" > /dallur/etc/hostname 
# echo 'dns_domain_lo="localdomain"' > /etc/conf.d/net 
Edit /dallur/etc/fstab to look like: 
/dev/ram0 / cramfs defaults 0 0 
none /proc proc defaults 0 0 
none /dev/shm tmpfs defaults 0 0 
none /tmp tmpfs defaults 0 0 
none /proc proc defaults 0 0 
/dev/sda1 /boot ext2 noauto,ro 0 0 
Edit /dallur/init to look like: 
#!/bin/ash 
echo 
echo 
echo " Welcome to Embedded Gentoo" 
echo 
echo 
echo " * Setting umask.." 
umask 022 
echo " * Mounting /proc.." 
mount -t proc none /proc 
echo " * Trying to make mouse device.." 
mkdir /dev/input 
mknod /dev/input/mice c 13 63 
mknod /dev/mouse c 13 63 
echo " * Starting init.." 
exec <dev/console >dev/console 2>&1 
exec chroot . /sbin/init 
echo " *** Starting init failed! ***" 
echo " * Trying to start a shell.." 
exec /bin/ash 
# cd /dallur 
# rm linuxrc 
# ln -s init linuxrc 
# chmod +x /dallur/init 

Compile custom kernel

If the current kernel version from gentoo-sources is 2.6.19 use them: 
# emerge -av gentoo-sources 
Else use mm-sources for geode framebuffer and cpu patches: 
# echo "sys-kernel/mm-sources ~x86" >> /etc/portage/package.keywords 
# emerge -av mm-sources 
# cd /usr/src/linux 
make menuconfig ARCH="i386" 
Here you will need to make a config for your own hardware depending on which system you have. 
My config for the WAFER-LX-800-R10 is here for reference. 
Config for 2.6.20-rc1-mm1 
# make -j2 ARCH="i386" 

Install Custom Applications

# export KERNEL_DIR=/usr/src/linux 
Install ALSA Sound 
When ASoC (SoC) support is more mature we expect AC97 on the Geode to be there 
# ROOT=/dallur emerge -avN alsa-lib alsa-utils alsa-tools alsa-headers 
CHROOT to the dallur environment within 
# rc-update add alsasound boot 
Install X window environment with Hardware Accelration for AMD Geode LX 
This will change as the driver gets included in Xorg 7.2 and the patch will not be needed. 
Note that the driver might be called AMD instead of NSC in the future. 
# echo "x11-base/xorg-server ~x86" >> /etc/portage/package.keywords 
# echo "x11-drivers/xf86-video-nsc ~x86" >> /etc/portage/package.keywords 
# mkdir -p /usr/local/portage/x11-drivers/xf86-video-nsc/files 
# cd /usr/local/portage/x11-drivers/xf86-video-nsc/ 
# cp /usr/portage/x11-drivers/xf86-video-nsc/xf86-video-nsc-2.8.2.ebuild ./ 
# cp -Rp /usr/portage/x11-drivers/xf86-video-nsc/files/* ./files/ 
# cd /usr/local/portage/x11-drivers/xf86-video-nsc/files 
Edit xf86-video-nsc-2.8.2.ebuild to look like this: 
# Copyright 1999-2006 Gentoo Foundation 
# Distributed under the terms of the GNU General Public License v2 
# $Header: /var/cvsroot/gentoo-x86/x11-drivers/xf86-video-nsc/xf86-video-nsc-2.8.2.ebuild,v 1.1 Exp $ 
# Must be before x-modular eclass is inherited 
#SNAPSHOT="yes" 
XDPVER=4 
inherit x-modular eutils 
DESCRIPTION="Nsc video driver" 
KEYWORDS="~amd64 ~sh ~x86 ~x86-fbsd" 
RDEPEND=">=x11-base/xorg-server-1.0.99" 
DEPEND="${RDEPEND} 
x11-proto/fontsproto 
x11-proto/randrproto 
x11-proto/renderproto 
x11-proto/videoproto 
x11-proto/xextproto 
x11-proto/xf86dgaproto 
x11-proto/xproto" 
src_unpack() { 
unpack ${A} 
cd "${S}" 
epatch "${FILESDIR}"/nsc-amd-geode-lx-R6.patch 
# ebuild xf86-video-nsc-2.8.2.ebuild digest 
Create and edit xorg.conf file 
Create and edit .xinitrc file 
# ROOT=/dallur emerge -avN libXaw xorg-server twm xf86-video-nsc xterm 
Run xorgconfig and configure xorg.conf 
# cp /usr/lib/gcc/i386-gentoo-linux-uclibc/4.1.1/libgcc_s.so.1 /dallur/usr/lib 
# cp /usr/lib/gcc/i386-gentoo-linux-uclibc/4.1.1/libgcc_s.so /dallur/usr/lib 
# cp /usr/lib/gcc/i386-gentoo-linux-uclibc/4.1.1/libstdc++.so.6 /dallur/usr/lib 
Install any application you want with: 
# ROOT=/dallur emerge -avN yourapplication 

Clean up and write to Compact Flash

# cp -Rp /dallur /tmp/ 
# cp /usr/src/linux/arch/i386/boot/bzImage /tmp/vmlinuz-dallur 
# rm -r /tmp/dallur/var/*/* /tmp/dallur/tmp/* /tmp/dallur/usr/src/* /tmp/dallur/usr/src/* 
# du -hs /tmp/dallur 
# cd /tmp/dallur && find . | cpio -H newc -o | gzip -9 > /tmp/initramfs-dallur.igz 
# dd if=/dev/zero of=/dev/sda bs=1 count=512 
# fdisk /dev/sda 
Configure partitions as shown here: 
Command (m for help): n 
Command action 
e extended 
p primary partition (1-4) 
Partition number (1-4): 1 
First cylinder (1-1024, default 1): <enter> 
Using default value 1 
Last cylinder or +size or +sizeM or +sizeK (1-1024, default 1024): +128M 
Command (m for help): a 
Partition number (1-4): 1 
Command (m for help): w 
# mke2fs /dev/sda1 
# mkdir /mnt/cflash 
# mount /dev/sda1 /mnt/cflash 
# mkdir /mnt/cflash/grub 
# cp /boot/grub/stage? /boot/grub/e2fs_stage1_5 /mnt/cflash/grub/ 
# umount /mnt/cflash 
# grub 
Configure grub as shown: 
grub 
grub> device (hd0) /dev/sda 
grub> root (hd0,0) 
grub> setup (hd0) 
grub> quit 
# mount /dev/sda1 /mnt/cflash 
# rm /mnt/cflash/grub/e2fs_stage1_5 
Edit/Create /mnt/cflash/grub/menu.lst to look like: 
timeout 3 
title Gentoo Embedded 
kernel /vmlinuz-dallur video=gxfb:640-480-24@75 
initrd /initramfs-dallur.igz 
# cp /tmp/vmlinuz-dallur /tmp/initramfs-dallur.igz /mnt/cflash/ 

Clean up

umount /dev/sda1 
# rm -Rf /tmp/dallur 
# rm /tmp/vmlinuz-dallur 
# rm /tmp/initramfs-dallur.igz 

To top



Creative Commons License
All content on this site is licensed under a Creative Commons License.