Booting a DoudouLinux ISO from an USB key
The
current stable version of DoudouLinux, Gondwana 1.x, requires to download a
different file if you want to burn a CD or to write an USB key. Since Grub2 is
now able to boot the kernel image that is contained into an ISO file, it is
possible to boot a Live ISO written onto an USB key and then to only use the
ISO file whatever the target support. This is of course very practical but
doesn't work on Debian Squeeze Live images without a dedicated patch called findiso. We have included this patch in the latest
development release, 2013-02, that will be turned into the next stable release
Hyperborea 2.0 around April/May. Doing so provides several advantages:
·
Only one file to be
downloaded, per language.
·
Easy system update on
the USB key: just replace the ISO file with the newer one! (and update Grub
parameters)
·
A single FAT partition
can be preserved on the USB key, allowing the normal use of an USB key,
especially on capricious systems that can only read FAT :p (do you really keep
using these old-fashion systems???).
·
Ability to have
several flavors of DoudouLinux on the same key, for example the stable release
and the development one, or several languages.
·
Does not require to
reformat the USB key and then should lead to better R/W access performances by
preserving factory settings.
Of
course it is better for DoudouLinux developers too since we don't need to test
the USB image anymore. This also solves the issue we had with isohybrid images that don't run on every computer and
also broke our persistence activation tool… So now let's see how to take
benefit of this new feature :). Beware: the process to turn an ISO file into an
USB live system is done from the command line! Ready?
Installing Grub2
NB:
Here we are using Grub2 from a Debian system but, if you don't care about
copying the kernel image and its ramdisk onto the USB key too, this should also
be possible to use any other bootloader (no test ever achieved though).
You
need to have Grub2 installed in your system. If not, install the corresponding
package. A particularity of Grub2 is that it doesn't fit anymore on the very
small 512 first bytes of a disk. It has then 2 alternatives:
·
If the first partition
starts at the cylinder number 1 instead of number 0, there may be enough space
after the first 512 bytes for Grub to copy all its files. As they are outside
any partition, they should be preserved from any modification.
·
If there is not enough
space before the first partition, Grub uses sectors in the first partition and
records their position in the first 512 bytes. Of course the file system in the
first partition may move these sectors without Grub knowing, this is then not 100%
reliable.
If
you are in the second situation and want to change to the first one, you have
no other choice but reformatiing your USB disk. Grub displays a message during
its installation when you are in the second situation.
So
now let's install grub onto the USB key. We need to mount it and launch the
Grub installation command:
$
sudo mount /dev/sdx1 /mnt/
$
sudo grub-install --force --no-floppy --root-directory=/mnt/ /dev/sdx
That's
it! Take care of replacing the USB device path /dev/sdx by the actual path of your key ;).
Making the USB key
bootable
(update of 2013/02/21)
Your
USB key will probably not boot if you don't set its partition as active, the
so-called boot flag. This operation can be quickly achieved with fdisk. First start fdisk onto your USB key:
$
sudo fdisk /dev/sdx
You
should get a prompt. Type p to display information about your disk partitions:
Command
(m for help): p
Disk
/dev/sdh: 2 GB, 2070216704 bytes
64
heads, 62 sectors/track, 1019 cylinders
Units
= cylinders of 3968 * 512 = 2031616 bytes
Device Boot Start End Blocks
Id System
/dev/sdh1 1 1019
2021665 b FAT32
Command
(m for help):
As
you can see, the boot flag (second column of the partition information table) is
not set since there is no * sign in this column. So in the fdisk prompt, type a to activate the partition.fdisk will ask you to enter the partition number
(ie. 1). You then just need to write the partition table by pressing w:
Command
(m for help): a
Partition
number (1-1): 1
Command
(m for help): w
Copying files
You
can now copy the ISO file – it takes few minutes, the Unicode font and the Grub
background image:
$
sudo cp doudoulinux-2013-02-fr.iso /mnt/boot/
$
sudo cp /usr/share/grub/unicode.pf2 /mnt/boot/grub/
$
sudo mkdir /mnt/boot/grub/splash
$
wget http://doudoulinux.org/blog/public/screenshots/install/witch-knight-grub.png
$
sudo mv witch-knight-grub.png /mnt/boot/grub/splash/background.png
$
sudo sync
We
have chosen to put all the files into the /boot directory that Grub made, but you can choose
any other directory on your USB key. The Unicode font is required if you want
translated messages in the Grub splash screen. So now everything is ready to
get DoudouLinux boot, except that Grub hasn't been configured…
Setting Grub2, quickly
The
Grub configuration must be placed in the file “/mnt/boot/grub/grub.cfg” that
does not exist yet. A very basic setting of Grub2, to start the ISO, is the
following:
set
timeout=5
set
default=0
menuentry
"DoudouLinux testing 2013-02" {
set isofile=doudoulinux-2013-02-fr.iso
loopback loop /boot/$isofile
linux (loop)/live/vmlinuz
findiso=boot/$isofile boot=live config locales=fr_FR.UTF-8 keyboard-layouts=fr
keyboard-variant=oss
keyboard-options=grp:alt_shift_toggle,terminate:ctrl_alt_bksp utc=yes
timezone=Europe/Paris nox11autologin quiet splash nomodeset
video=uvesafb:mode_option=640x480-16,mtrr=3,scroll=ywrap persistent
persistent-subtext=doudoulinux username=tux hostname=doudoulinux
initrd (loop)/live/initrd.img
}
Of
course isofile is the name of the ISO you want to boot,
change it to fit your needs! In these settings we tell Grub to mount the ISO
file so that he can access the kernel image and the ramdisk image file into it.
This feature is only needed to launch the kernel with the minimalistic system
in the ramdisk. This minimalistic system will then use the boot parameter findiso to find the ISO file and mount it into the
final Linux system, DoudouLinux.
If
you wonder how we could have written so long a boot parameter line, well, that's
just the LiveCD boot line with few arguments removed or added :). To retrieve
it, mount the DoudouLinux CD and look in the file “isolinux/live.cfg”. Note
that you may have to change the localization parameters of this boot command
for your particular use:
·
locales → your language
settings
·
keyboard-layouts → your keyboard layout
·
keyboard-variant → your keyboard variant
·
keyboard-options → your keyboard options
·
utc → whether your
computer clock is UTC or local time
·
timezone → your timezone
Don't
forget to unmount your key:
$
sudo sync
$
sudo umount /mnt/
So
now you should have a booting USB key that launches DoudouLinux, except that
the Grub screen is not very nice. Let's see how to improve this.
(update of 2013/02/21) NB: once you've launched DoudouLinux on your
USB key, you can use its persistence tool to make a persistence file on the USB
key so that your DoudouLinux system won't loose user's work :).
Setting Grub2 for real
In
the following Grub configuration file we have added:
·
language settings, to
get translated Grub messages
·
video modules to show
the background image
·
colors and background
image
·
classes to the
DoudouLinux system entry, in case you want to graphically customize this entry
This
is a bit more complicated but the result is as expected: a graphical boot as
early as Grub! You now have no reason to not have DoudouLinux everywhere with
you since it can also be on your USB stick of everyday use :).
set
lang=fr
set
timeout=5
set
default=0
function
load_video {
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
insmod png
}
if
loadfont /boot/grub/unicode.pf2 ; then
set gfxmode=640x480
load_video
insmod gfxterm
fi
terminal_output
gfxterm
set
locale_dir=/boot/grub/locale
insmod
gettext
if
background_image /boot/grub/splash/background.png; then
set color_normal=black/black
set color_highlight=black/white
fi
#####################################
menuentry
"DoudouLinux testing 2013-02" --class doudoulinux --class gnu-linux
--class gnu --class os {
set isofile=doudoulinux-2013-02-fr.iso
loopback loop /boot/$isofile
linux (loop)/live/vmlinuz
findiso=boot/$isofile noeject boot=live config locales=fr_FR.UTF-8
keyboard-layouts=fr keyboard-variant=oss
keyboard-options=grp:alt_shift_toggle,terminate:ctrl_alt_bksp utc=yes
timezone=Europe/Paris nox11autologin quiet splash nomodeset
video=uvesafb:mode_option=640x480-16,mtrr=3,scroll=ywrap persistent
persistent-subtext=doudoulinux username=tux hostname=doudoulinux
initrd (loop)/live/initrd.img
}
#####################################
0 comments:
Post a Comment