Blog hébergé par Yves et Iris :-)

Aller au contenu | Aller au menu | Aller à la recherche

Bootable flash drive for both Linux and Windows: live Linux

Three years ago, I wrote a small series about having all my favourite tools on a USB flash drive when I am on the go. Some things have changed in these years, so the time has come to write fresh blog posts on the subject. My main aim is a full portable Linux OS, and this third part is about just that!

The Linux distribution I chose for my purpose is TinyCore. This distribution has many features that make it awesome for installation on a flash drive:

  • It is really small: the base system is only 11 MB, and you add whatever you want on top of this. Just 5 MB more and you get a X11 desktop!
  • Its root filesystem is entirely contained in the “initrd” file (named in this instance “rootfs.gz”).
  • Each additional package comes in two read-only files (one for the software, the other listing the dependences), one of which gets mounted at run-time. Thus the system never degrades over time.
  • All the system files are contained in “archive files” (initrd and application-packages), thus making the underlying filesystem (FAT32 in my case) irrelevant.
  • It provides an easy-to-use catalog of applications for all tastes, from the tiny (Ted word processor, Dillo browser…) to the “standard” (LibreOffice, Firefox…), from system rescue tools to games.

I spent a whole year using the dCore x86 port instead, and I liked the fact that any Debian software could be added relatively easily. But I finally decided against it for my purpose, because software management is more complicated in dCore, and because there is no 64-bits version, which makes rescuing 64-bits Linux systems almost impossible.

At this stage of the process, I have a FAT32-formatted flash drive named “FLASH”, with Grub2 as a boot loader. The sole partition of this drive so far only contains the EFI-mandated EFI/ directory, inside of which Linux will get installed.

I will now install TinyCore Linux v7.x (at this time; just change the version if a new release is available). I will assume the flash drive partition is mounted on /media/FLASH:

# wget http://tinycorelinux.net/7.x/x86/release/TinyCore-current.iso
# mkdir tmpiso
# mount -o loop,ro TinyCore-current.iso tmpiso
# mkdir -p /media/FLASH/EFI/tcore/tce/ondemand
# cp -r tmpiso/cde/optional /media/FLASH/EFI/tcore/tce/
# cp tmpiso/cde/onboot.lst /media/FLASH/EFI/tcore/tce/
# umount tmpiso
# rm -rf TinyCore-current.iso tmpiso
# for f in modules.gz modules64.gz rootfs.gz vmlinuz vmlinuz64; do wget -P /media/FLASH/EFI/tcore http://tinycorelinux.net/7.x/x86/release/distribution_files/$f; done
That’s all. Really ;-)

However, I now wish to enable the French keyboard in TinyCore Linux:

# for e in '' .md5.txt; do wget -P /media/FLASH/EFI/tcore/tce/optional http://tinycorelinux.net/7.x/x86/tcz/kmaps.tcz$e; done
# echo kmaps.tcz >>/media/FLASH/EFI/tcore/tce/onboot.lst

There only remains to add TinyCore Linux to the Grub2 menu. In this file, I previously wrote the following comment line:

# … here will come Linux, later …

This line should now be replaced with the following contents:

set corekopt_base="waitusb=5 loop.max_loop=256 showapps lang=fr_FR.utf8 kmap=azerty/fr-latin1 tz=Europe/Paris host=FLASH"
set corekopt_clock="noutc"
set corekopt_nms=
set corekopt_bxh=
set core_back=1
set core_bits=
set tckopt_tce="tce=LABEL=FLASH/EFI/tcore/tce"

menuentry "Start TinyCore Linux: a tiny Linux on USB" {
if [ "$core_back" == "1" ]; then
set corekopt_back="restore=LABEL=FLASH/EFI/tcore"
else
set corekopt_back="norestore"
fi
linux /EFI/tcore/vmlinuz$core_bits $corekopt_nms $corekopt_bxh $corekopt_base $corekopt_clock $tckopt_tce $corekopt_back lst=onboot.lst
initrd /EFI/tcore/rootfs.gz /EFI/tcore/modules$core_bits.gz
}
menuentry "— 64 bits" {
set core_bits=64
}
menuentry "— Do not use backup" {
set core_back=0
}
menuentry "— UTC hardware clock (Linux as main OS)" {
set corekopt_clock=""
}
menuentry "— Option 'nomodeset' (some computers need this)" {
set corekopt_nms="nomodeset"
}
menuentry "— Option 'blacklist=xhci_hcd' (some computers need this)" {
set corekopt_bxh="blacklist=xhci_hcd"
}

For the above to work, it is very important that you use a recent version of Grub2!

TinyCore Linux is ready. It does need a bit of time to configure and get used to, though. Just start it, and use the TinyCore Wiki. Next blog post will be about portable applications for Windows. I’ll come back to TinyCore later.

Ajouter un commentaire

Le code HTML est affiché comme du texte et les adresses web sont automatiquement transformées.

La discussion continue ailleurs

URL de rétrolien : http://yalis.fr/cms/index.php/trackback/94

Fil des commentaires de ce billet