![]() |
|
|||||||
| Mobile Linux Discussion of Linux on mobile and embedded devices. |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Here you find some scripts, the first is to create an USB stick which can be booted on several motherboards - vendor independ to check out the system. The second script can be seen as an optional way to create a hd image which can be used together with VirtualBox to start the system. VirtualBox has to be configured to automatically enable the USB stick - best using the USB filter setting as the apps are loaded via USB. I use the kernel which is stored on the interal SSD therefore you need to emulate it. In order to store additional data on the stick, two partitions are made. If you try it on real hardware and you can not boot from USB, just put the ce_bz kernel from the stick onto your hd and boot it with your standard bootloader. When you are able to start it but you don't have got LAN working, the cheapest solution is to add a Realtek 1 GBit ethernet adapter - this is supported. You might experince problems with front usb connectors - in that case try the ones directly onboard - even there try all ports if needed.
a) Create USB stick Change DEVICE to match your stick. Also set IMAGE to the image you want to use. Required tools which are not always preinstalled are: lilo (or mbr with a simple change), syslinux Code:
#!/bin/sh
DEVICE="/dev/USBSTICK"
IMAGE="FILE.IMG"
offset=$(($(sfdisk -d $IMAGE|grep start=|head -n1|sed 's/.*start=\s*//;s/,.*//')*512))
OPTIONS="umask=000,shortname=mixed,quiet,utf8"
DIR=/tmp/target
INPUT=/tmp/input
umount ${DEVICE}1 $INPUT
mkdir -p $DIR $INPUT
mount -o loop,offset=$offset,$OPIONS $IMAGE $INPUT
dd if=/dev/zero of=$DEVICE count=1
sfdisk -D -uM $DEVICE <<EOT
,240,6,*
,,b
EOT
#install-mbr -p D ${DEVICE}
lilo -s /dev/null -M ${DEVICE}
mkdosfs -F16 -nDVMUSB ${DEVICE}1
mkdosfs -F32 -nDATA ${DEVICE}2
syslinux -s ${DEVICE}1
mount -o $OPTIONS ${DEVICE}1 $DIR
cat > $DIR/syslinux.cfg <<EOT
default /ce_bz
EOT
cp -av $INPUT/* $DIR/
umount ${DEVICE}1 $INPUT
sync
Set IMAGE to the image you want to use. Also check the postition of the grub stage1/2 files. Example for 32 bit Debian/Ubuntu. Code:
#!/bin/sh
IMAGE="FILE.IMG"
offset=$(($(sfdisk -d $IMAGE|awk '/start=/{print $4}'|head -n1|sed 's/,//')*512))
uuid=$(dd if=$IMAGE skip=$((0x27+$offset)) bs=1 count=4 2>/dev/null|hexdump -e '"%X"'|sed 's/\(....\)/\1-/')
LOOP="/dev/loop0"
OPTIONS="umask=000,shortname=mixed,quiet,utf8"
DIR=/tmp/target
mkdir -p $DIR
losetup -d $LOOP
losetup $LOOP $IMAGE
umount $DIR
mount -o loop,offset=$offset,$OPIONS $IMAGE $DIR
mkdir -p $DIR/boot/grub
cat > $DIR/boot/grub/menu.lst <<EOT
timeout 0
title Test
kernel /ce_bz
EOT
cp -v /usr/lib/grub/i386-pc/stage1 $DIR/boot/grub
cp -v /usr/lib/grub/i386-pc/stage2 $DIR/boot/grub
grub --device-map=/dev/null --batch <<EOT
device (hd0) $LOOP
root (hd0,0)
setup --stage2=$DIR/boot/grub/stage2 (hd0)
EOT
cat > $DIR/splash.idx <<EOT
root=UUID=$uuid
EOT
umount $DIR
losetup -d $LOOP
Code:
qemu -m 256 -hda FILE.IMG Requires qemu. Code:
qemu-img convert FILE.IMG -O vmdk test.vmdk Requires grub. Code:
#!/bin/sh PARTITION="/dev/partition" IMAGE="FILE.IMG" offset=$(($(sfdisk -d $IMAGE|grep start=|head -n1|sed 's/.*start=\s*//;s/,.*//')*512)) OPTIONS="umask=000,shortname=mixed,quiet,utf8" DIR=/tmp/target INPUT=/tmp/input umount $PARTITION $INPUT mkdir -p $DIR $INPUT mount -o loop,offset=$offset,$OPIONS $IMAGE $INPUT mount $PARTITION $DIR mkdir -p $DIR/boot/grub cat > $DIR/boot/grub/menu.lst <<EOT timeout 0 title Test kernel /TEST.IT/ce_bz EOT grub-install --recheck --no-floppy --root-directory=$DIR $PARTITION grub-install --recheck --no-floppy --root-directory=$DIR $PARTITION mkdir -p $DIR/TEST.IT cp -av $INPUT/* $DIR/TEST.IT/ cat > $DIR/splash.idx <<EOT root=UUID=$(/lib/udev/vol_id -u $PARTITION) /TEST.IT /TEST.IT EOT umount $PARTITION $INPUT sync Edit: I looked a bit at the Win installer (which you can use of course too, just boot ce_bz with any bootloader you want to use, like grub4dos) and found that there was a file called splash.idx in the root of the partition. Then it was fully clear to me what to do - the file needs to be there when you don't want to start it via USB (emulates the SSD). The structure is easy: Code:
root=UUID=$uuid /DIR.SYSTEM /DIR.USERDATA Edit 2: Use 240 mb instead of 220 mb in order to add more custom addons. You can use even more if want to add extra apps. Extra hint: If you want to modify existing packages you can get rid of the error message that the install was corrupted using: Code:
dd of=version bs=1 seek=32 count=0 Last edited by Kano; 08-19-2008 at 07:45 AM. |
|
#2
|
|||
|
|||
|
Thank you for the scripts.
I ran the first script, but when Itry to boot from USB stick, I get an error message that says approximately: "This device is not bootable, please insert bootable floppy and press return." I'm not sure yet what I did wrong. Is this a problem with lilo's MBR? |
|
#3
|
|||
|
|||
|
Well I simply test the stick using
qemu -hda /dev/USBSTICK If that at least shows that the kernel is loaded then it is bootable. There are several problems that can occur when you try to boot from USB: a) USB sticks are used as superfloppy, in the BIOS care does not work. Saidly none of the available virtual nics are supported, hopefully one of it gets added to a newer release. As it is pretty hard to copy the kernel to a Linux partition when there is none, I just installed a grub bootloader with the 2nd script. Thats of course huger than it has to be, if lled USB-ZIP, that will not work when it is a partitioned stick. Interestingly serveral Gigabyte boards do not correctly boot from USB-HDD, even when selected this as first boot device. Therefore you have to enable the USB legacy storage option and then you find it as harddisk in the menu. New boards have got a menu on a hotkey, F12 for Gigabyte, otherwise change the boot order between the harddisk. You may need to reboot to see the device when USB storage support was turned off. b) Only some usb ports work, thats a bit stupid, when you are able to start the system, but then you see something like: not installed correctly, please run installer. Just try all possible ports to see if one works, had that problem on a Gigabyte GA-G33-DS3R. No way to boot from front usb and not even all directly available ports from the board worked. c) If it does not work at all to boot from USB, don't give up. Just copy the ce_bz file from your stick to /boot and add a short entry to your grub menu (usually /boot/grub/menu.lst) - fetch values for X,Y from the already available kernel/root entries. Code:
title Test kernel (hdX,Y)/boot/ce_bz e) Rare, but possible: it is lilo's fault as you asked before, in that case use the install-mbr command instead of the lilo command (install-mbr is in the mbr Debian package). It writes MBR on screen when the MBR is loaded. Last edited by Kano; 07-26-2008 at 04:26 AM. |
|
#4
|
|||
|
|||
|
Thanks for the info.
I will try some of the things you say, but a few things to note: The machines I tried to boot are capable to boot from the same USB stick with another Linux on it, for example Puppy Linux. That's why I think maybe something went wrong with the installation process. I might enable more echo and re-run the script to see if any of the commands reports a problem. Maybe I will also try GRUB instead of syslinux. |
|
#5
|
|||
|
|||
|
Yes you can try grub too - just be sure that the stage1/2 location is correct. Therefore I basically rewrote it. This script uses grub:
Code:
#!/bin/sh
DEVICE="/dev/USBSTICK"
IMAGE="FILE.IMG"
offset=$(($(sfdisk -d $IMAGE|grep start=|head -n1|sed 's/.*start=\s*//;s/,.*//')*512))
OPTIONS="umask=000,shortname=mixed,quiet,utf8"
DIR=/tmp/target
INPUT=/tmp/input
umount ${DEVICE}1 $INPUT
mkdir -p $DIR $INPUT
mount -o loop,offset=$offset,$OPIONS $IMAGE $INPUT
dd if=/dev/zero of=$DEVICE count=1
sfdisk -D -uM $DEVICE <<EOT
,220,6,*
,,b
EOT
mkdosfs -F16 -nDVMUSB ${DEVICE}1
mkdosfs -F32 -nDATA ${DEVICE}2
mount -o $OPTIONS ${DEVICE}1 $DIR
mkdir -p $DIR/boot/grub
cat > $DIR/boot/grub/menu.lst <<EOT
timeout 0
title Test
kernel /ce_bz
EOT
cp -v /usr/lib/grub/i386-pc/stage1 $DIR/boot/grub
cp -v /usr/lib/grub/i386-pc/stage2 $DIR/boot/grub
grub --device-map=/dev/null --batch <<EOT
device (hd0) $DEVICE
root (hd0,0)
setup (hd0)
EOT
cp -av $INPUT/* $DIR/
umount ${DEVICE}1 $INPUT
sync
|
|
#6
|
|||
|
|||
|
OK, it works now (the original syslinux version). I must have had a BIOS setting wrong.
I could boot it up on my Dell laptop, but unfortunately no wireless (Intel 3945) or LAN support ![]() I thought it might have this since Asus uses it on some laptops, but no luck.. |
|
#7
|
|||
|
|||
|
Well as soon as they are shipping laptops with it this could happen. Right now the wireless seems to be limited to AR5007 cards similar to the used one from the Eee PC and the RT2870 chip which is on newer WiFi boards.
|
|
#8
|
|||
|
|||
|
Quote:
|
|
#9
|
|||
|
|||
|
Well you don't miss that much as you can read here:
http://www.phoronix.com/forums/showthread.php?t=11644 It is not really inteded to replace a full OS install. It boots relatively fast, but with several drawback. |
|
#10
|
|||
|
|||
|
Quote:
So, I'm wondering, what makes it boot so fast, and could we build a similar fully OSS distro that boots into X in 10 seconds and supports just internet access? Could it be some of the following: 1. Disable UDEV auto detection - do autodetection during install and then assume the same fixed set of hardware after that. 2. Compile all of the common modules into the kernel. 3. Of course, run only very minimal amount of daemons necessary to support internet access - no CUPS, no HPLIP, no GDM, etc. 4. Use a minimal X environment and WM, possibly tinyx and blackbox similar to splashtop. 5 ????????? It must be possible since splashtop does it, and we could have a fully OSS version that supports more hardware |
![]() |
| Thread Tools | |
| Display Modes | |
|
|