Boot SliTaz in UEFI mode

slitazI mentioned in an earlier post that SliTaz is going to have a 64-bit kernel in 5.0. I was working on the kernel configuration for SliTaz and now I can see that the rolling versions have the 64-bit kernel. SliTaz doesn’t support UEFI devices officially yet but here’s a hack to try it on UEFI systems.

After the EFI support was enabled in the SliTaz kernel on my request I ran my initial tests on a EFI VMware virtual machine with elilo but was unable to boot into SliTaz. However, I got the idea of booting into SliTaz using the already installed grub-efi by Ubuntu from this thread. Instead of creating a new partition I decided to use the EFI System Partition (ESP) installed by Ubuntu. It’s a 64MB partition but less than an MB is actually used. Here’s the detailed way to do it.

NOTE: This procedure is tested on a x86_64 device with 64-bit EFI firmware and Secure Boot disabled. All console operations are ran as root from an existing Ubuntu installation on the device. Steps should be similar for any other OS as well.

  1. Download the slitaz-rolling-core64.iso. At least this is the way to go till SliTaz 5.0 is released.
  2. Mount the iso to a directory named iso.
    # mkdir iso
    # mount -o loop slitaz-rolling-core64.iso iso
  3. Find out your system’s ESP. It should normally be fat32 with the boot flag set.
    # parted
    GNU Parted 2.3
    Using /dev/sda
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) p
    Model: ATA Hitachi HTS54755 (scsi)
    Disk /dev/sda: 500GB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    
    Number Start  End  Size   File system  Name  Flags
     1    1049kB 64.0MB  62.9MB  fat32            boot
     2    64.0MB 30.8GB  30.7GB  ext4           msftdata
     3    30.8GB  500GB   469GB                 msftdata
    
  4. Mount the ESP to a directory named efi and create the directory structure slitaz/boot on it.
    # mkdir efi
    # mount /dev/sda1 efi
    # mkdir -p efi/slitaz/boot
  5. Copy vmlinuz-x.x.xx-slitaz and rootfs.gz files from the mounted iso to the ESP.
    # cp iso/boot/vmlinuz-3.2.53-slitaz efi/slitaz/boot/
    # cp iso/boot/rootfs.gz efi/slitaz/boot/
  6. Unmount the iso and the ESP.
    # umount iso
    # umount /dev/sda1
  7. Get the UUID of the ESP.
    # grub-probe -t fs_uuid -d /dev/sda1
    9BFA-E454
  8. Add the following entry at the end of /etc/grub.d/40_custom. You can omit the explanatory comments in red but read them to change the settings unique to your system.
    menuentry 'Slitaz' {
    set gfxpayload=keep
    insmod gzio
    insmod part_gpt
    #insert the module for partition used. vfat module not required as efi firmware can read fat32
    # insmod vfat
    #gpt1 is the first partition on my only hard disk (hd0)
    set root='hd0,gpt1'
    #set the UUID from Step 7 below
    search --no-floppy --fs-uuid --set 9BFA-E454
    echo 'Loading SliTaz ...'
    #set any device specific options in kernel options
    linux (${root})/slitaz/boot/vmlinuz-3.2.53-slitaz lang=en kmap=en acpi_osi=vendor acpi_backlight=vendor sound=noconf --
    initrd (${root})/slitaz/boot/rootfs.gz
    }
  9. I use the following settings in /etc/default/grub. This way I can press Esc during the GRUB menu countdown and select the entry I want.
    GRUB_DEFAULT=0
    GRUB_HIDDEN_TIMEOUT=0
    GRUB_HIDDEN_TIMEOUT_QUIET=false
    GRUB_TIMEOUT=0
  10. Regenerate GRUB.
    # grub-mkconfig -o /boot/grub/grub.cfg

If everything goes fine you should find the entry for SliTaz in GRUB menu on the next reboot and be able to boot into it on your UEFI device! There’s still a problem I’m facing with English fonts but this whole exercise was experimental.

5 thoughts on “Boot SliTaz in UEFI mode”

  1. How about for a system without any other operating systems on it?
    e.g. Wiping Win7 (non-booting one day, time to switch the laptop to some *nix distro anyway), looking to create bootable USB drive from which to install SliTaz to laptop’s HDD. Then, the plan is, VirtualBox any other desired OS’s over the SliTaz layer.

    My parted info looks a lot like yours, Arun, except:
    Partition Table: msdos
    Disk Flags:

    Number Size File system Flags
    1 209MB ntfs boot
    2 485GB ntfs (Windows saw this as C:\)
    3 14.5GB ntfs (Windows saw this as D:\ , an HP recovery tools partition)
    4 108MB fat32 lba

    Thank you!

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s