Idenity Graphic
About
Store
Downloads
Information
Contact
Linux VR Booting HOWTO

By Bradley D. LaRonde ([email protected])

Introduction

Before you can boot Linux on your device, you must have two things:

* a boot loader
* a kernel

The boot loader part is easy - just download it (see below).

The kernel part is a little more difficult, as you must use one that is specifically designed for your platform. The easy way to get one is to download one from my ftp site (see below). You can build your own kernel (BYOK), but this document doesn't get into that (if you want to BYOK please see my Kernel Building HOWTO).

Booting Linux from Windows CE isn't really that hard, so please give it a try, and if you do, please let me know how it goes ([email protected]).

Getting a Windows CE Boot Loader

There are at least a couple of Windows CE boot loaders them out there. I recommend the newest one, affectionately named CyaCE. :-) Steven Hill and I made it based on pbsdboot (see below). It has a nice interface, and all the configuration is done in a plain-text config file, cyacecfg.txt. It will also open the serial port for you, so you don't have to use the serial console tip mentioned below. You can get it from my ftp site at ftp.ltc.com.

There is also pbsdboot, the boot loader from the PocketBSD project. I used to use a version of pbsdboot until I made CyaCE. It works fine, but it doesn't do auto-booting from a config file like CyaCE does. Last I checked you can get it from here. A warning on this one: older versions did hardware-dependent screen clearing, which was very not good on the Casio E-100/105 because while it thought it was writing to the E-105 framebuffer, it was really totally filpping out the E-105 graphics controller registers instead. IMO the boot loader should either leave the screen alone, or clear it in some hardware indepenent (Win32) way. At this time, CyaCE does neither, but hardware-independent screen clearing is on the to-do list, below handling initrd and compressed kernels. Anyway, it looks #if 0'ed out in latest pbsdboot sources, so it should be OK now, but I haven't tested it.

Getting a Ready-Made Kernel from my FTP Site

There are several kernels up there now:

* The -clio ones are configured for the Vadem Clio, with support for the display and keyboard.
* The -e-105 ones are configured for the Casio E-100/105.
* The -serial ones are configured for the console on the serial port, and no display support.
* The -sas means that they use the stand-alone shell, which is smaller and may be needed for machines with less than 8MB RAM.

I also compressed some of them to a couple of different compression formats, namely bzip2 (use bunzip2) and zip (use your favorite unzipper).

To get a ready-made kernel

1. Get the appropriate vmlinux file for your platform from my ftp site at ftp.ltc.com.
2. Uncompress it (if necessary) to end up with a vmlinux file. This is the kernel image file.

Booting the Kernel

Once you have your boot loader and kernel (vmlinux kernel image file), here's how to boot it.

Obligitory Warning Notice
Don't go any further on this page if you care about any of the data in your device. No, booting Linux on your device won't pysically damage it, void the warranty, or add years to your life (at least not that I know of), but it can (and always does when I do it) erase all of the data in the device's memory. So backup any data that you care about first. OK? When you are finished playing with Linux, push the reset button on your device to get back to Windows CE (most likely with your data all gone). If that doesn't work, try doing a hard reset according to the device manufacturer's directions (if booting Linux didn't erase the memory, then this is virtually guaranteed to do so). Oh, and please don't think that I'm responsible if you lose something - you can't say that I didn't warn you. One more thing - IF YOU GO MUCH FURTHER ON THIS PAGE YOU ARE PRATICALLY GUARANTEED TO ERASE ALL OF THE DATA IN YOUR DEVICE'S MEMORY! There. Now have fun. :-)

To boot Linux from Windows CE

1. Copy the boot loader and the kernel image to the Windows CE device. I like to copy them to the root of a CF card using my notebook computer, then pop the CF card into the CE device.
2. If the kernel is configured to use a serial console, then hook up your device to a serial port on another computer, pull up your serial terminal software (I use minicom on Linux), and set it to 9600 baud.
3. Pause, think carefully, "Do I mind if I wipe out this device's memory?", because the next step is the one that almost for sure will erase all of your device's memory.
4. Launch the boot loader (see below for tips on that). If you are using CyaCE, it will probably automatically boot after a few seconds. If you are using another boot loader, you may need to fill in some blanks and hit "Boot".

Adjusting the Boot Loader Settings

You may need to adjust the boot loader settings. How to do this depends on the bootloader you are using.

Adjusting CyaCE for Ramdisk Root

For ramdisk root, you need to edit the cyacecfg.txt file to tell the kernel to get the root from the /dev/ram0 device. Adjust your cyacecfg.txt file to look something like this:


image=vmlinux
label=linux
append=root=/dev/ram0

Note: earlier kernels didn't need this, but newer kernels do. Those early kernels brokenly always mounted /dev/ram as real root when initrd was configured, whereas the newer kernels do not.

Launching the Boot Loader

This can be a little difficult, especially if you have a Palm-size PC. Here are some options:

* If you have an H/PC, you can simply navigate to the boot loader and double-click on it.
* You might be able to get a "run" dialog to come up even though it doesn't appear on the Start menu (see below).
* Some Casios have a way to get them to auto-boot (see below).
* If none of those options work, you may need to add the boot loader to the Start menu.

Start Menu Run Dialog

Why is there no Run option on the Windows CE P/PC Start menu? I can't answer that question, but even though it doesn't appear on the Start menu, you still might be able to get a Run dialog up on your device. Try this exactly as described:

1. Pull up the on-screen keyboard.
2. Click Start twice (the Start menu appears then goes away). Don't double-click it - just click it once, let it open, then click it again and let it close.
3. Type run23 on the on-screen keyboard.

Once it comes up, you might, for example, type in "\storage card\cyace" (including the quotes) to launch CyaCE from your storage card.

(By the way, for some reason the Clio names the storage card "\Storage Card " - with a space at the end. Odd but true. I wonder if the new Clio will be "backward compatible"? :-) )

If you can't get it to work, try resetting your device then trying again.

Auto-Booting on Casios

Some Casio PsPC machines (but apparently not the E-10) will automatically run \CE\R4100\AutoRun.exe on a CF card when the CF card is inserted (see http://www.deja.com/getdoc.xp?AN=506898353&fmt=text).

To take advantage of this feature, rename your boot loader to AutoRun.exe and put it in \CE\R4100\ on your CF card.

Adding the Boot Loader to the Start Menu

Here is a way to add the boot loader and kernel files to the start menu (based on contribution by Greg Haerr). It requires the use of Windows CE Servces.

1. Open Mobile Devices on the PC.
2. In Mobile Devices, open the folder for your device.
3. Open the "Windows" folder.
4. Open "Start Menu".
5. Drag cyace.exe, cyacecfg.txt, and vmlinux in.
6. Click on the Start menu on the device.
7. Click on cyace.

Adjusting Memory Settings

If you get a "can't allocate heap" error from the boot loader, you may need to adjust your CE memory settings in order to give the boot loader more room to load the kernel. Go to Start, Settings, System, Memory, and set the slider for minimum storage memory and maximum program memory. In addition, there wasn't a simple way for me to figure out how to run CyaCE. The instructions about double-clicking the start menu don't work. Ultimately, I had to transfer the programs over to the Programs/Start Menu area in order for them to appear in the main menu.

Tip on Using the Serial Console

This tip is only useful to people using old versions of CyaCE or pbsdboot. The newer versions of both of those programs have a feature that makes this tip obsolete.

If you are booting a kernel configured for serial console, and you are not getting any output on the serial port when you boot the kernel, try booting it while PC Link is running. Some platforms power down the serial transceiver circuitry via a GPIO when it's not in use to save power. Having PC Link running while you are booting the kernel leaves the serial transceiver circuitry turned on for Linux to use.

Boot Transcript

When Linux boots, it will generate a transcript similar to the one shown below. This transcript was produced by vmlinux-serial as it booted:


Detected 24MB RAM. Will use 24MB RAM.
Loading R4000 MMU routines.
CPU revision is: 00000c52
32 TLB entries
Primary instruction cache 16kb, linesize 16 bytes)
Primary data cache 8kb, linesize 16 bytes)
No secondary cache
Setting TLB page size to 4K (CP0_PAGEMASK = 0x00001800)
Linux version 2.3.9 ([email protected]) (gcc version egcs-2.90.29
980515 (egcs-1.0.3 release)) #21 Wed Sep 1 00:12:41 EDT 1999
Using VR41XX TLB exception handler
Calibrating delay loop... 46.08 BogoMIPS
Memory: 22572k/24572k available (1016k kernel code, 972k data)
Buffer-cache hash table entries: 2048 (order: 1, 8192 bytes)
Page-cache hash table entries: 8192 (order: 3, 32768 bytes)
Checking for 'wait' instruction... unavailable.
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.2
Based upon Swansea University Computer Society NET3.039
NET4: Unix domain sockets 1.0 for Linux NET4.0.
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
TCP: Hash tables configured (established 32768 bind 32768)
Starting kswapd v 1.5
No keyboard driver installed
Serial driver version 4.27 with no serial options enabled
ttyS00 at 0xac000000 (irq = 17) is a 16550A
PIU CNTREG=0x1326 INTREG=0x0000 SIVLREG=0x00a7
Vr41xx touch panel initialized, using IRQ 13.
RAM disk driver initialized: 16 RAM disks of 4096K size
RAMDISK: Compressed image found at block 0
EXT2-fs warning: checktime reached, running e2fsck is recommended
VFS: Mounted root (ext2 filesystem).
Freeing unused kernel memory: 32k freed
Caught CPU trying to run FP instruction 0x44c4f800 at EPC=0x004110fc
Stand-alone shell (version 1.0)
>


The Vr4111 processor does not support floating point and trapping the FP instruction at this point is considered normal. With the latest kernels, FP instruction traps should not be caused by the kernel itself, only user-space programs.

Stand-Alone Shell

All of the pre-built kernels have a small ramdisk and filesystem built into the kernel image, which gets mounted as root. The -sas kernels use a stand-alone shell, which is smaller and may be needed at this time for devices with less than 8MB RAM. The newer kernel images are using a more traditional shell, which is much larger and may require 8MB RAM or more. This section is only for kernels using the stand-alone shell.

Help

You can enter "help" to get a list of available commands. Yes, you must enter "-" in front of some of these commands.


> help
alias [name [command]]
cd [dirname]
-chgrp gid filename ...
-chmod mode filename ...
-chown uid filename ...
-cmp filename1 filename2
-cp srcname ... destname
-dd if=name of=name [bs=n] [count=n] [skip=n] [seek=n]
-echo [args] ...
-ed [filename]
exec filename [args]
exit
-grep [-in] word filename ...
help
-kill [-sig] pid ...
-ln [-s] srcname ... destname
-ls [-lid] filename ...
-mkdir dirname ...
-mknod filename type major minor
-more filename ...
-mount [-t type] devname dirname
-mv srcname ... destname
-printenv [name]
prompt string
-pwd
quit
-rm filename ...
-rmdir dirname ...
setenv name value
source filename
-sync
-tar [xtv]f devname filename ...
-touch filename ...
umask [mask]
-umount filename
unalias name
>


Proc Filesystem

/proc is available for your perusal. On the stand-alone shell ramdisks, it must first be mounted as shown below.


> -mount -t proc none /proc


The -ls shell command displays the files within /proc:


> -ls /proc
.
..
1
2
3
bus
cmdline
cpuinfo
devices
dma
filesystems
fs
giuinfo
interrupts
ioports
kcore
kmsg
ksyms
loadavg
locks
meminfo
memory
misc
modules
mounts
net
partitions
scsi
self
slabinfo
stat
swaps
sys
sysvipc
tty
uptime
version


/proc/cpuinfo

On a serial-sas kernel, in order to see the contents of a /proc file, you must copy it to the serial port device, /dev/ttyS0. Here is the CPU information from /proc:


> -cp /proc/cpuinfo /dev/ttyS0
cpu : MIPS
cpu model : NEC Vr41xx V5.2
system type : Vr41xx-based Vadem Clio
BogoMIPS : 46.08
byteorder : little endian
unaligned accesses : 0
wait instruction : no
microsecond timers : no
extra interrupt vector : no
hardware watchpoint : yes
VCED exceptions : not available
VCEI exceptions : not available


/proc/meminfo

Here is memory usage information from /proc. Pretty modest size, eh?


> -cp /proc/meminfo /dev/ttyS0
total: used: free: shared: buffers: cached:
Mem: 23146496 3940352 19206144 1044480 2097152 749568
Swap: 0 0 0
MemTotal: 22604 kB
MemFree: 18756 kB
MemShared: 1020 kB
Buffers: 2048 kB
Cached: 732 kB
SwapTotal: 0 kB
SwapFree: 0 kB


/proc/giuinfo

The /proc/giuinfo file displays information on the general-purpose I/O (GPIO) ports.


> -cp /proc/giuinfo /dev/ttyS0
giuiosell: 0x0000
giuioselh: 0xfc00
giupiodl: 0x3ef6
giupiodh: 0xe377
giupodatl: 0x44b1


Contributors

Well, of course me, but also...

* P.J. Drongowski
* Greg Haerr
* probably some others that I've failed to mention (please let me know)
Screenshots | About | Store | Downloads | Information | Contact | Home | Mailing List | People | Message Boards | Online Chat