CF boot on Epia-MII


Forum: DSL Tips and Tricks
Topic: CF boot on Epia-MII
started by: nickbarker

Posted by nickbarker on Nov. 03 2005,10:59
I have just finished a project of getting LinuxBIOS to boot an EPIA-MII off the onboard CF, and have been using DSL as both the development and host environment.

The source tree for Linuxbios (http://www.linuxbios.org) should fully reflect this work within the next day or so should anyone want to try it.

There are a few steps necessary to prepare DSL for this, and so I have written the howto below.

The epia-m Linuxbios referred to within this howto has also been submitted to Linuxbios, but not yet available. If there is any interest, then I can also post that here.


*****************************************************************************
*
* DSL-EPIA-MII-onboard-cf-boot-howto
*
* or Dam Small Linux on the Via Epia MII booting and running from the onboard
* compact flash using LinuxBIOSv2
*
* Copyright © 2005 Nick Barker nick.barker9@btinternet.com
*
*****************************************************************************

Warning
-------
There are steps in the process described here which could be hazardous. The
hazards include (but are not limited to)
1) destroying your motherboard
2) hurting yourself
3) killing yourself

Because of these hazards, YOU MUST TAKE FULL RESPONSIBILITY if you
decide to install LinuxBIOSv2 following these procedures. Neither the
author of this HOWTO or any organisation or individual associated with
the LinuxBIOSv2 project can be held responsible for any adverse consequences
of your attempt to follow these procedures.

Introduction
------------

The Via Epia-MII and Dam Small Linux are a good combination for quickly creating
small embeded applications.

The Epia-MII has an onboard compact flash (CF), and I believe that many people, like
myself, acquired such a board with the expectation of being able to run a
Linux system entirely from that CF.

However Via, in their wisdom, have not provided the facility to boot from this
compact flash in their bios setup. To date the only way to run from a CF has been
to use a CF IDE adapter plugged onto the IDE drive interface. This adds expense
in terms of the adapter itself, and creates limitations on the enclosure used
as this has to house such an adapter and necessary IDE cables.

It is now possible to boot the EPIA-MII from the onboard CF using LinuxBIOSv2
'http://www.linuxbios.org'. For those unfamiliar with this project, it is an
opensource BIOS replacement for the one provided by the mainboard supplier.

This howto describes how to set up an environment under DSL for both creating
a LinuxBIOS for your machine, and also the steps for running DSL from a machine
with a LinuxBIOS. It is assumed in this howto that both of these activities
are carried out on the same machine.

The howto does not describe in detail the process of creating the BIOS itself,
as this process is adequately described in the EPIA-MII howto hosted on the
LinuxBIOS web site.

You should become familiar with both documents and understand the risks and
pre-requisites for what you are about to do before proceeding with any of it.

About LinuxBIOS
---------------

As has been said, LinuxBIOS is an opensource replacement for the BIOS on your
mainboard. However there are some differences between this bios and the one
you are replacing which you should be familiar with before embarking on this
venture:

LinuxBIOS does the bare minimum to get a Linux kernel up and running, and as such
does away with legacy BIOS functionality such as BIOS calls and VESA graphics calls.
Linux doesn't really use this old 16bit functionality (one exception described
below). However O/S's from other vendors are still highly dependant upon them. So
forget about running versions of windows from this BIOS.

LinuxBIOS is not VESA compatible - which means that the standard VESA X server
supplied in DSL doesn't work. However we can get the X server to work by using
the proper driver for this chipset, as described later in this howto.

LinuxBIOS is a constant work in progress, and there is no guarantee that a
download of the source at any one point in time will build a successful BIOS for
your machine.

LinuxBIOS may not run with your spec of mainboard. At the time of writing it
had only been tested on an MII 6000.

LinuxBIOS is fast. Forget that minute or so wait as the vendor supplied BIOS
seems to be doing something interesting. LinuxBIOS gets to booting the kernel
within 2 to 3 seconds of power up.

Creating the Development Environment
------------------------------------

For the development environment it is assumed that you already have DSL installed
and running on a hard disk partition of your Epia-MII. If not then there are
other howto's on the DSL web site describing how to achieve this.

In order to compile the LinuxBIOS, you need to download and install various
packages into your Development Environment. So as the 'dsl' user download the
following packages from the MyDSL application:

System/gcc1.dsl.info
System/python2.3.info

Next you need to create some symlinks so that these packages can be found easily:

cd /usr/bin
ln -sf gcc cc
ln -sf /opt/python/bin/python python


Creating the Run Time Environmnt
--------------------------------

By run time we are referring to DSL installed on the CF.

Whilst you are developing your run time environment you will need at least a 256Mb CF.
It might be possible to trim this down later.

Under DSL the CF drive is recognised as /dev/hde.

First you need to do a HD install onto the compact flash. This might require that
you firstly partition the drive -(only one partition needed, but you may need to
change the partition type to Linux if the CF has not yet been formated into
Linux format). The HD install should then take care of formating the drive and installing
all the files that are needed.

When asked if you require a bootloader answer no, as such a bootloader is irrelevant to
LinuxBIOS.

Installing the XServer
----------------------

As has been noted, LinuxBIOS is not VESA compatible, and so the standard X server supplied
with DSL won't work under LinuxBIOS. Fortunately the Xserver will run properly if the full
Xserver is downloaded and its configuration files set up appropriately.

This Xserver configuration works equally well under the vendor supplied BIOS as it does
under LinuxBIOS, so we are going to install it first on the Development Environment,
and then on the Run Time environment.

As the 'dsl' user download and install the Xserver package from the MyDSL application:

System/XFree86.dsl.info

You may also need System/xf86config.dsl.info - It shouldn't be necessary but I haven't tried
it without.

Once this has been done, log out from DSL and log in again as the root user.

Next cut and paste the XF86Config file at the bottom of this howto to /etc/X11/XF86Config.
Read through the file, and change any settings to suit, as commented in that file.

Next change the file '.xserverrc' in your home directory to read

exec /usr/X11R6/bin/Xfree86 -nolisten tcp

Also you should change this in the .xserverrc file of the dsl user and any other users
which you have set up on your system.

You should now log out and log in again, at which point the Xserver should start up
using the native driver for this chip set. To verify this take a look at
- /var/log/XFree86.0.log
This is a very verbose file, but you should be able to find references to the
'via' driver being loaded.


Now it is time to install the Xserver onto the run time environment. We could copy through
the files, but there are many, and there are several complicated sym links in there too.

Instead we are going to fool DSL that we are running directly off the CF, and replicate
exactly the steps described above:

As the root user, drop out of Xwindows and back to the Linux command prompt.
Make sure that the CF is mounted
  'mount /dev/hde1 /mnt/hde1'
Change the root directory to the compact flash
  'chroot /mnt/hde1'
Become the dsl user so that we can download stuff
  'su dsl'
Make sure we are in our home directory
  'cd'
Fire up the XServer
  'startx'

Now download the XServer as before. Once complete finish your Xserver session.
Leave user dsl
   'exit'
Leave the chroot
   'exit'

Copy the XF86Config file from /etc/X11 to /mnt/hde1/etc/X11
Copy ~/.xserverrc to /mnt/hde1/root and any other users home directories on the CF.

The X server is now installed properly on the CF.

The X server download is a large one, and this could be an area where some files
could be trimmed if looking to use a smaller CF.

Creating an initrd for the CF
-----------------------------

If you read the LinuxBIOS EPIA-M howto, it describes the need for an initrd.gz
file on your CF, and provides a script 'mkcfinitrd' for creating this file.
Now is the appropriate time to generate this file. Cut and paste the script
somewhere on your hd, make it executable and run it. This will make the
file /tmp/initrd.

Next gzip it:
   'cd /tmp'
   'gzip initrd'

And copy it to the boot directory on the CF
   'cp inird.gz /mnt/hde1/boot'

The CF now contains everything that you need to do a CF boot under
LinuxBIOS.


And on to LinuxBIOS itself
--------------------------

As has been said, this howto does not attempt to replicate the howto
for the bios itself, and you should shortly turn to that howto for the
remaining steps.

Whilst working through that howto, you will come accross filo command
lines which require setting up for the CF boot. The appropriate command
line for this situation is:

AUTOBOOT_FILE = "hde1:/boot/linux24 initrd=hde1:/boot/initrd.gz root=/dev/hde1
    console=tty0 ide4=noprobe" + any other kernel command line options you use.


Now turn to the LinuxBIOS howto for the remaining steps.

Good Luck!!!!!!!!!




####################################################################
# /etc/X11/XF86Config
#
# Copyright © 2005 Nick Barker nick.barker9@btinternet.com
#
# For use on MII 6000 to enable use of native VIA driver for
# CLE266 chipset
#

####################################################################
# Define which extensions to load
####################################################################
Section "Module"
   Load "xtrap"
   Load "record"
   Load "dri"
   Load        "dbe"
   SubSection  "extmod"
     Option    "omit xfree86-dga"
   EndSubSection
   Load        "type1"
   Load        "freetype"
   Load "speedo"
   Load       "glx"
EndSection

#####################################################################
# Define file paths
#####################################################################
Section "Files"
   RgbPath "/usr/X11R6/lib/X11/rgb"
   FontPath   "/usr/X11R6/lib/X11/fonts/local/"
   FontPath   "/usr/X11R6/lib/X11/fonts/misc/"
   FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
   FontPath   "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
   FontPath   "/usr/X11R6/lib/X11/fonts/Type1/"
   FontPath   "/usr/X11R6/lib/X11/fonts/Speedo/"
   FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/"
   FontPath   "/usr/X11R6/lib/X11/fonts/100dpi/"
#    ModulePath "/usr/X11R6/lib/modules"
EndSection

#####################################################################
# Server options - can also be set on command line
#####################################################################
Section "ServerFlags"
#    Option "NoTrapSignals"
#    Option "DontZap"
#    Option "Dont Zoom"
#    Option "DisableVidModeExtension"
#    Option "AllowNonLocalXvidtune"
#    Option "DisableModInDev"
#    Option "AllowNonLocalModInDev"
EndSection

######################################################################
# Configure Keyboard
######################################################################
Section "InputDevice"
   Identifier "Keyboard1"
   Driver "Keyboard"

#   Option     "Protocol"      "Xqueue"
   Option "AutoRepeat" "500 30"
#   Option "Xleds"      "1 2 3"
#   Option "LeftAlt"     "Meta"
#   Option "RightAlt"    "ModeShift"
#   Option "XkbVariant"  ""
#   Option "XkbOptions"  ""
#    Option "XkbDisable"
   Option "XkbRules" "xfree86"
   Option "XkbModel" "pc101"

# pick country layout by uncommenting appropriate option
#    Option "XkbLayout" "us"
   Option "XkbLayout" "gb"
EndSection

######################################################################
# Configure Mouse
######################################################################
Section "InputDevice"
   Identifier "Mouse1"
   Driver "mouse"
   Option "Protocol"    "PS/2"
   Option "Device"      "/dev/psaux"

# may want to configure a 2 button mouse to emulate 3 buttons
#    Option "Emulate3Buttons"
#    Option "Emulate3Timeout"    "50"
EndSection


#####################################################################
# Define Monitor
#####################################################################
Section "Monitor"
   Identifier  "Monitor1"

# If Xserver can't detect monitor capabilities via DDC, or lies about
# them, then set horizontal sync and vertical refresh frequencies
# here and enable option NoDDCValues in the Driver section below
# Make sure you get the range right, or monitor damage might occur.
#    HorizSync   50 - 90
#    VertRefresh 50 - 75

EndSection

#####################################################################
# Graphics device & driver
#####################################################################

Section "Device"
   Identifier  "ViaDriver"
   Driver      "via"
# Necessary to force use of CRT output else X randomly chooses between
# CRT or TV
   Option "Active Device" "CRT"

# See comment in Monitor Section
#   Option "NoDDCValue" "True"
EndSection

#####################################################################
# Screen Section - define required resolutions and color depths
# Via driver seems to want modes declared explicitly
# Declared in reverse order so that generally server will pick
# the best resolution for the detected monitor
#####################################################################

Section "Screen"
   Identifier  "Screen1"
   Device      "ViaDriver"
   Monitor     "Monitor1"
   DefaultDepth 24

   Subsection "Display"
       Depth       8
       Modes       "1280x1024" "1024x768" "800x600" "640x480"      
       ViewPort    0 0
   EndSubsection
   Subsection "Display"
       Depth       16
       Modes       "1280x1024" "1024x768" "800x600" "640x480"  
       ViewPort    0 0
   EndSubsection
   Subsection "Display"
       Depth       24
       Modes       "1280x1024" "1024x768" "800x600" "640x480"
       ViewPort    0 0
   EndSubsection
EndSection

########################################################################
# Server Layout - tie everything together
########################################################################

Section "ServerLayout"
   Identifier  "Layout1"
   Screen "Screen1"
   InputDevice "Mouse1" "CorePointer"
   InputDevice "Keyboard1" "CoreKeyboard"

EndSection

Posted by AwPhuch on Nov. 03 2005,16:08
Without using the LinuxBios stuff would it still use the CFdisk as a standard IDE drive right...

No risk in frying your mobo or whatever?

Brian
AwPhuch

Posted by nickbarker on Nov. 03 2005,16:47
Yes using the standard BIOS Linux will let you use it as a standard drive once it is up and running, but no booting off it.

Nick Barker

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.