Before I get into the actual content of this post/article, I'd like to point out that this isn't a complete tutorial; I'm hoping by putting this in a regular forum (as opposed to the
Tutorial section) others with netbook and UMPC experience can add to it. Hopefully this is too detailed and there are simpler ways to do what I've done.
This article is based on a very specific machine; however, the principles used should apply to almost any SD-bootable machine without an optical drive (with the possible exception of the absurd system Toshiba uses.) There are quite a few tutorials and software systems out there for installing pre-packaged distros onto a flash drive that often work with SD cards. Some of these are limited in that they require a FAT file system and/or an ISO image and a record of changes to the root partition, plus a very limited choice of distributions. For those who want more control over their system, this should be of some help.
Background.
I purchased a Raon Digital Everun Note several weeks ago because I wanted something small, but with some power behind it. Additionally, I wanted to be able to confine the operating system to an SD card, leaving the hard drive for data only. I was unsatisfied with the STFI solutions; therefore, I had to come up with my own. These are the results of my endeavor, although incomplete.
Requirements.
Unfortunately this tutorial isn't M$-friendly, although you might be able to complete it with a rescue disk or a live CD (with some extra effort.) Surprisingly, most of this can be done without the actual machine. If you have a USB DVD drive, you might be able to perform this from the Everun Note itself, however.
Resources:
- x86_64-compatible machine that can boot a slamd64 install CD/DVD and write to an SD card
- slamd64 12.2 install CD or DVD
- Any functioning Linux system with SYSLINUX and EXTLINUX
- SD card with at least 8GB capacity that can be completely erased (I have a Class 6 card, don't know if it's overkill yet)
Skills/Other:
- Willingness to do "dirty work" in a real terminal
- root or sudo access on the working machine (everything below needs to be done as root)
- Patience and something to occupy yourself with
- A way to reference these instructions (your x86_64 won't be free; print or use another computer to view)
The Job.
Step 1: Preparing the SD Card.
The first step in this long process is to ready your SD card for booting, etc. In order to do that, you'll need to insert/connect your card, then determine where exactly it is in
/dev (I'll refer to the base of the device as
<device> for the rest of the tutorial.) If you already know how to do this, identify the root of the device (e.g.
/dev/sdb) and continue on. If you have a built-in card reader, you might need to insert the modules
mmc_block and
sdhci-pci with
modprobe. It might take a little bit of work to find out where exactly it is; I'd like to go through all of that, but there are too many possibilities.
fdisk -l and
tail /var/log/messages can help you determine where it is with a USB card reader. With an internal card reader it will probably be
/dev/mmcblk0, otherwise it will probably be
/dev/sd[abc]. If for some reason you don't have
/dev/mmcblk0 and you have an internal card reader, try the following as root:
Code:
mknod /dev/mmcblk0 b 179 0
blockdev --getsz /dev/mmcblk0
You shouldn't get an error with the second line if your card is connected (ask here or in a separate thread if you have problems.) Once you determine the correct device, continue on.
The most important part of this step is to make sure the card can boot. This is a very simple process when SYSLINUX is installed.
Code:
dd if=/usr/lib/syslinux/mbr.bin of=<device>
cfdisk -z <device>
Once you're in the
cfdisk session, do the following:
- Create a primary partition at the beginning 20-100MB. This will be /boot and will hold the kernel images and initrd. Make it type 82 and bootable.
- Partition the rest as you see fit. (I only have two partitions: the second one is the root partition. This tutorial assumes your second partition is the root partition.)
Write the partition table and exit. Once you write the table, you should have a separate device for each partition. For example,
/dev/sd[abc]1 for a USB reader and
/dev/mmcblk0p1 for an internal card reader, etc. Create an ext2 or ext3 file system on the first partition as follows:
Code:
mkfs -t ext3 <device p1>
Create file systems for the rest of your partitions and
fsck -f each of them. Lastly, mount the first partition somewhere (e.g.
/mnt) and execute the following (note that this is done against the
mount point and not the device in
/dev):
Code:
extlinux <mount point>
umount <mount point>
You'll need a patched
powernow-k8 module for CPU frequency scaling to work; therefore, download the
patched module (thanks to
marzeal and the hacker who patched it) and save it to your SD card. If that link no longer works, save the
attached patch somewhere on your SD card. Unmount all of the partitions on the SD card.
Step 2: Initial Installation.
Once you have your SD card prepared, begin the installation process by booting the slamd64 12.2 installation CD on your x86_64 machine. If this is a different machine than the one used to set up the SD card, you might need to figure out what device your SD card is now. If you're still using an internal card reader, the following additional steps might be required once you get to the command line for the installation CD.
Code:
cd /
mount /dev/hdc /cdrom #mount the installation CD
tar -xvvzf /cdrom/slackware/a/kernel-modules-2.6.27.7-x86_64_slamd64-1.tgz lib #retrieve kernel modules
cd /lib/modules/2.6.27.7/kernel/drivers/mmc
insmod core/mmc_core.ko
insmod card/mmc_block.ko
insmod host/sdhci.ko
insmod host/sdhci-pci.ko
mknod /dev/mmcblk0p1 b 179 1
mknod /dev/mmcblk0p2 b 179 2 #once for each additional partition
This should get you to the point where you can use
/dev/mmcblk0p[12]. Proceed once you determine the devices for your partitions and you can see them in
/dev.
Unlike with the normal Slackware installation process, you should pre-mount your partitions. If you're using an internal card reader you probably have no choice. Start by mounting your root partition to
/mnt. Depending on your file system, you might need to load other modules into the kernel (doubtful.) Next,
mkdir /mnt/boot and mount the first partition there. Execute
setup once all of your target partitions are mounted.
Select the "TARGET" option to start with and scroll down to "done adding partitions". This is necessary to appease the setup program. Set up your installation as you see fit, but make sure you install the kernel sources and gcc at the very least. Execute the installation and take a nap. This part took about 1:45, which is mostly based on the card and reader.
You can do basic configuration once installation is complete. Here are a few notes and reminders, however:
- Don't set up the network
- Don't set the clock if you aren't on the Everun Note
- Don't set the root password
- Don't install or run lilo
Once you exit the setup program
do not restart the computer! Stay where you are; there's still a lot to do.
If you were able to download the patched
powernow-k8 module, copy the .h and .c from the zip file to
/mnt/usr/src/linux/arch/x86/kernel/cpu/cpufreq. If you downloaded the patch from this post, copy that patch to
/mnt/usr/src/linux.
Step 3: While You're Here.
You need to do several things within your new installation to make sure everything works the first time you start your Everun Note. Perform the following steps in order:
Code:
mount --bind /proc /mnt/proc
chroot /mnt #enter the new installation
pico /etc/fstab
#add these lines (replace jfs if necessary, leave sda):
/dev/sda2 / jfs defaults 1 1
/dev/sda1 /boot ext3 defaults 1 2
pico /boot/extlinux.conf
#add these lines:
DEFAULT linux
LABEL linux
KERNEL vmlinuz
APPEND ro vga=normal initrd=initrd.gz
cp /boot/config-huge-2.6.27.7 /usr/local/linux/.config
The steps above will make sure the card actually boots the system, although a few things are still required.
If you want to be able to use the ATI graphics driver, you need to rebuild your kernel with PCI-MSI support. If you're using another distro you can
grep the default configuration for
CONFIG_PCI_MSI=y to save yourself the trouble. slamd64 12.2 doesn't have this by default, however. To set this option, enter
/usr/src/linux,
make menuconfig and enable "Message Signaled Interrupts (MSI and MSI-X)" in "Bus options (PCI etc.)". You might feel like configuring other things while you're at it. Now's your chance! Don't mess with what you don't understand, however.
If you're using the
patch file for the
powernow-k8 module, execute the following from
/usr/src/linux:
Code:
patch -p0 < powernow-k8-everun.patch.txt
When you're done configuring, execute the commands below. If you have a boot partition of less than 30-40MB, you might want to clear out unwanted kernels before executing this to make room.
Code:
make && make modules && make modules_install && make install
It's
very important that you place
make install last; it will fail at the very last second because lilo won't work. This is normal; if you get to that point, everything is fine. Let this run and take another nap.
Once the kernel builds and installs, you need to make an initrd. This should be done for the following reasons:
- If for some reason your root partition won't mount, you have a shell to work with
- You can build in a delay between kernel load and mounting the root partition; this is necessary because of hardware initialization
Execute the following to give yourself a basic initrd:
Code:
#create a link named /boot/vmlinuz if you didn't rebuild the kernel
mkinitrd -c -k 2.6.27.7 -r /dev/sda2 -w 3 #"-w 3" provides a slight delay
mkinitrd
Now you're ready to exit and clean up:
Code:
exit #exits chroot session
umount /mnt/proc
umount /mnt/boot
#unmount other target partitions except the root
umount /mnt
Remove your SD card and reboot or turn off your machine.
Step 4: Basic Drivers.
You should download a few basic drivers from your working Linux machine and place them on your SD card before using it. I put my drivers in
/usr/drivers on the root partition of the SD card, but you might not like that. Just remember where they are. Download the following drivers:
- At the AMD driver site, find the x86_64 Linux ATI Radeon X1300 driver. Save the installation instructions, also.
- Download the wireless-card firmware from the Marvell driver site. The "Network Controller" for "Linux 2.6 - Fedora" is what you want. (Thanks again to marzeal.)
Unmount all partitions on your SD card and remove it.
Step 5: Starting Your Everun Note.
Insert your prepared SD card into the card slot and start the Everun Note. Press F2 to enter the BIOS settings and place the boot device starting with "USB HDD:" at the top. You might move the hard drive to the "disabled" list, also. Save and exit, allowing the machine to boot from the SD card. Everything should boot correctly. If not, please post your difficulties here!
The first order of business is setting the time so your timestamps won't be thrown off:
Code:
zic -l <timezone> #see /usr/share/zoneinfo for a list of timezones
date -s "month day, year time"
While you're here, only set up the very basics; you'll want a relatively clean system to create a backup image of a few steps from now.
Install the ATI driver per the instructions. There are a few things you need to execute after you execute the installer; they should work correctly as described in the instructions. The following additional step is required after setup, however:
Code:
ln -s /usr/lib64/dri/fglrx_dri.so /usr/lib64/xorg/modules/dri/
To get the wireless to work, install the firmware as described by
marzeal. In case the link no longer works, I quote him/her here:
Quote:
|
Originally Posted by marzeal
Open the downloaded archive, open and extract the contents of the second level archive:
SD-8686-FEDORA26FC6-SYSKT-GPL-9.70.3.p24-26409.P45.tar
Go to the FwImage directory. Rename helper_sd.bin to sd8686_helper.bin
Now navigate to the FwImage directory in a terminal and enter the following commands:
sudo mv sd* /lib/firmware
|
If you have the portable battery charger + ethernet port, you don't need a separate driver. You can use the
mcs7830 module included with the kernel.
You can control the CPU frequency by loading the
powernow-k8 module (only if you patched it as instructed.) You also might want to load the
cpufreq_stats module to retreive information. You'll need to download and install
cpufrequtils, then use the
cpufreq-info and
cpufreq-set commands (this can be done later.)
You'll need to make a few changes to your xorg.conf to get everything to work together. Open
/etc/X11/xorg.conf with an editor (
pico is the simplest) and make the following changes:
- Search for Section "ServerLayout" and make sure these are the only input devices:
Code:
InputDevice "touchscreen" "CorePointer"
InputDevice "Keyboard1" "CoreKeyboard"
InputDevice "Mouse1" #"eyeball" mouse
InputDevice "Mouse2" #USB mouse
- Add a section for the touch screen:
Code:
Section "InputDevice"
Identifier "touchscreen"
Driver "evdev"
Option "Device" "/dev/input/event3"
Option "DeviceName" "touchscreen"
Option "SendCoreEvents" "On"
EndSection
- Add a section for a USB mouse:
Code:
Section "InputDevice"
Identifier "Mouse2"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mouse3"
Option "ZAxisMapping" "4 5"
Option "Button Mapping" "1 2 3 6 7"
Option "HWheelRelativeAxisButtons" "7 6"
EndSection
- Find Identifier "Mouse1" and change the input device from /dev/mouse to /dev/input/mouse1.
Make sure you can
startx, then shut your system down.
Step 6: Create an Emergency Backup.
Because you'll have limited boot options, you should make an emergency backup of your SD card with the basic configuration. To do this, start any Linux machine that can read and write the SD card.
Perform the following in order to clean up your system before imaging.
- Mount all of your SD card partitions R/W
- Execute the following from the directory where your root partition is mounted. Note that the leading / is left off! Do not put it in there because it might corrupt your working Linux installation. These steps will allow your image to be used by others without security compromises.
Code:
rm etc/ssh/ssh_host* #remove ssh keys
rm root/.bash_history #remove your command history
rm -r tmp/* #remove temporary files (don't remove the two . directories)
echo -n > var/log/messages #clean up your logs
echo -n > var/log/dmesg
echo -n > var/log/syslog
- Before you actually create an image of your card, you should reduce the complexity of your free space with the following procedure (inspired by the Eraser program for W$.) Execute the command below where each partition is mounted. Make sure the devices are actually mounted! This might crash your system otherwise! Wait for "DONE" to appear, then move on to the next partition. This command appends zeros to a file until the file system is full, then deletes the file, thereby setting all free space to zero (making it highly compressible.)
Code:
{ dd if=/dev/zero of=zero; rm zero; echo DONE; } &
- Unmount all of your partitions. This part is very important! If you don't, your image will always appear to have uncleanly unmounted file systems. Lastly, fsck -f each partition.
Once you've cleaned up your partitions, you can proceed with the backup image. The image should take up less than 1.7GB if you didn't install kdei, even if the card is > 8GB.
Code:
dd if=<device> | md5sum #record a hash if you really feel like it
dd if=<device> | bzip2 > slamd64-12.2-ren-sd.bz2 #bzip2 an image of the card
Both steps will take a while. The imaging alone took about 50 minutes on my Turion X2 machine.
Note that this image should only be rewritten to a card of the same size, brand, and type! Otherwise, you might fall short by a block or more, causing your last partition to be corrupted.
Proceed with the rest of your customization and setup once you have the clean image. For example, set the root password, add users, etc. Your machine will regenerate its ssh keys the first time you restart. It's important that they aren't a part of your clean image for security reasons.
I created a second image of my card after I customized my system. Unlike the previous image, however, I piped the output of
bzip2 through an encryption program so that my security settings weren't "just out there". The two images together were around 3.1GB, fitting onto a single DVD.
THE END!
Additional Notes.
Here are a few things that need work:
- Built-in camera. I haven't tried anything with this, but it seems as though Raon uses custom software to drive it. They ship a variant of the machine with Ubuntu; therefore, the only version I know of is in binary form. I haven't actually tried to get the camera to work, though. It could be very simple.
- Other hardware. Other than audio, I haven't tried to set up any other hardware. Audio sets up easy with alsaconf.
PLEASE POST ANYTHING ADDITIONAL YOU MIGHT HAVE! THANKS.
Kevin P. Barry
____________________
Changes and Additions.
Change 1: I attached a
CPU-scaling script I wrote to control the frequency based on whether or not power is connected. Rename the script file by removing the .txt extension, place it in
/usr/local/sbin or similar, and make it executable. Within e.g.
/etc/rc.d/rc.local, you can start it as a daemon by adding a line like this:
Code:
/usr/local/sbin/cpu-scale.sh auto &
Make sure you use the &, otherwise it will freeze the startup process! This script requires
cpufrequtils,
powernow-k8,
cpufreq_performance, and
cpufreq_powersave, and ACPI.