LinuxBIOS Graphical

From Linux A Bordo

Jump to: navigation, search

To create a LinuxBIOS graphical distro you need a supported motherboard and 2MB BIOS flash (SST49LF160C = $3,00). Also you need compile Kdrive, Matchbox, Busybox and LinuxBIOS to your motherboard.

Contents

Compiling the uclibc toolchain

Use buildroot to compile to create the toolchain, in "Build options" change "Toolchain and header file location?" to /usr/local/uclibc, it will install the toolchain there. We don't need the busybox compiled by buildroot, we just need it compile toolchain for us.

Note: recents buildroot don't create a valid toolchain to compile tinyx (Kdrive). I suggest you to download a working version from subversion:

svn co svn://uclibc.org/trunk/buildroot -r {2006-12-12}

Compiling busybox

We need a minimal busybox to save space to Kdrive and Matchbox, this article help how to create a rootfs tree with busybox:

http://www.linuxjournal.com/article/4335

Compiling Kdrive

First you need the xfree source code, download this file: xfree86_4.2.1.orig.tar.gz

Decompress:
tar zxvf xfree86_4.2.1.orig.tar.gz

Will be created the xfree86-4.2.1 directory with xfree86-4.2.1.tar.gz inside.
Decompress this created file:
cd xfree86-4.2.1
tar zxvf xfree86-4.2.1.tar.gz

Will be create the xc directory, go to xc/config/cf and create the host.def file with this content:

#define KDriveXServer YES
#define TinyXServer YES
#define XfbdevServer YES
#define XvesaServer YES
#define ForceNormalLib          YES

#define BuildFonts NO
#define BuildServersOnly NO
#define BuildXTrueType             NO
#define BuildScreenSaverExt        NO
#define BuildScreenSaverLibrary    NO

#define KdriveServerExtraDefines -DMAXSCREENS=3
#define ProjectRoot /usr/X11R6
#define NothingOutsideProjectRoot YES
#define UseSeparateConfDir NO

#define UseXwctomb YES
#define HasLibCrypt YES

#define CrossCompiling         YES

Also create the cross.def with this:

#undef Arm32Architecture
#undef i386Architecture
#undef Arm32Architecture
#undef Arm32Architecture

#if defined(__arm__)
#define Arm32Architecture
#endif
#if defined(__i386__)
#defined i386Architecture
#endif
#if defined(__mc68000__)
#define Mc68020Architecture
#endif
#if defined(__mips__)
#define MipsArchitecture
#endif
#if defined(__powerpc__)
#define PpcArchitecture
#endif

#undef OptimizedCDebugFlags
#define OptimizedCDebugFlags    -Os
#define ServerCDebugFlags       -Os
#undef StandardDefines
#define StandardDefines         -Dlinux -D__i386__ -D_POSIX_SOURCE \
                                -D_BSD_SOURCE -D_GNU_SOURCE -DX_LOCALE
#define StdIncDir /usr/local/uclibc/include
#define PreIncDir
#undef PostIncDir
#define PostIncDir /usr/local/uclibc/lib/gcc-lib/i686-linux-uclibc/3.3.3/include
#undef CcCmd
#define CcCmd /usr/local/uclibc/bin/i686-linux-uclibc-gcc
#undef HasCplusplus
#define HasCplusplus NO
#undef CplusplusCmd
#define CplusplusCmd NO
#define DoRanlibCmd YES
#define RanlibCmd /usr/local/uclibc/bin/i686-linux-uclibc-ranlib
#undef ExtraLoadFlags
#define ExtraLoadFlags
#define FbNoPixelAddrCode
#undef TermcapLibrary
#define TermcapLibrary -lncurses

#undef LdPostLib
#define LdPostLib       -L/usr/local/uclibc/i686-linux-uclibc/lib
#undef LdCmd
#define LdCmd /usr/local/uclibc/bin/i686-linux-uclibc-ld

#undef ExtensionOSDefines
#define ExtensionOSDefines

#define ServerXdmcpDefines      /**/

#include <cross.rules>

Move back to xc directory and execute: make World

After a long compilation will be create Xvesa e Xfbdev in programs/Xserver.

You need copy Xvesa to your busybox rootfs tree, also you will need copy some libs, but copy it after compile matchbox. Use the ldd command to verify the matchbox libs depends.

Compiling Matchbox

Download this files:

Decompress all.

Use the follow command to compile matchbox:

env AR=i686-linux-uclibc-ar CC=i686-linux-uclibc-gcc CPP=i686-linux-uclibc-cpp \
CXX=i686-linux-uclibc-g++ RANLIB=i686-linux-uclibc-ranlib \
LD=i686-linux-uclibc-ld ./configure --target=i686-linux --host=i686-linux \
--x-libraries=/xc/exports/lib --x-includes=/xc/exports/include 2>&1 | tee \
configure.log

After the compilation copy mb-windowmanager and mb-panel to your rootfs tree.

Compiling the Linux kernel

Now the rootfs is complete then you just need compile the linux kernel with rootfs build-in (initramfs).

Download the Linux kernel 2.6.20.

Select only the really necessary options:

  • ELF support
  • Mouse and keyboard support
  • TCP/IP support (X Server need it)
  • Enable VM86 support
  • Initramfs support

Also select the Embedded Option (just select printk) and Optimize for Size.

In "Initramfs source file(s)" enter the rootfs tree where is the busybox with kdrive and matchbox binaries.

Compile, it you create an arch/i386/boot/bzImage of ~ 1.7MB

Creating the ELF image

LinuxBIOS need a ELF binary to use as payload, just execute this command:

mkelfImage --append="console=tty0" bzImage linux.elf

LinuxBIOS compilation

Just compile LinuxBIOS to your motherboard using linux.elf as payload. More info about LinuxBIOS compilation read http://www.linuxbios.org/Documentation

Personal tools
Produtos