Tiny Core Extensions > TCE Tips & Tricks

Howto make a legacy bios/uefi dual boot usb stick with grub2

(1/11) > >>

Juanito:
In case you need to boot tinycore from a usb stick on legacy bios and uefi machines.

Note that you will need to use corepure64 as most efi/uefi are 64-bit.

Format a usb stick using fdisk as follows:
--- Code: ---$ sudo fdisk /dev/sdc
...
   Device Boot      Start         End      Blocks  Id System
/dev/sdc1               2        3670    29471242+ 83 Linux
/dev/sdc2   *        3671        3797     1020127+ ef EFI (FAT-12/16/32)
--- End code ---
Note it is easier to partition on 1mb boundaries using fdisk from the util-linux extension

Format the partitions:
--- Code: ---$ tce-load -i dosfstools e2fsprogs
$ sudo mkfs.ext4 /dev/sdc1
$ sudo mkfs.vfat /dev/sdc2
--- End code ---

Install grub:
--- Code: ---$ tce-load -i grub2-multi
$ sudo mount /dev/sdc1
$ sudo mount /dev/sdc2
$ sudo grub-install --target=x86_64-efi --boot-directory=/mnt/sdc2/EFI/BOOT --efi-directory=/mnt/sdc2 --removable
$ sudo grub-install --target=i386-pc --boot-directory=/mnt/sdc2/EFI/BOOT /dev/sdc

--- End code ---

Copy the distribution files rootfs.gz, rootfs64.gz, modules.gz, modules64.gz, vmlinuz and vmlinuz64 to /mnt/sdc1/boot

..then create a grub.cfg in /mnt/sdc2/EFI/BOOT/grub that will be shared by legacy bios and uefi boot:
--- Code: ---$ cat /mnt/sdc2/EFI/BOOT/grub/grub.cfg
loadfont unicode
insmod all_video
set gfxmode=1366x768x32
set gfxpayload=keep
set gfxterm_font=unicode
terminal_output gfxterm

search --no-floppy --fs-uuid --set=root d4432cde-d21a-4d40-b44b-f097ce72cdba

menuentry "core" {
linux /boot/vmlinuz quiet text tce=UUID="d4432cde-d21a-4d40-b44b-f097ce72cdba" waitusb=10:UUID="d4432cde-d21a-4d40-b44b-f097ce72cdba"
initrd /boot/rootfs.gz /boot/modules.gz
}

menuentry "core64" {
linux /boot/vmlinuz64 quiet text tce=UUID="d4432cde-d21a-4d40-b44b-f097ce72cdba" waitusb=10:UUID="d4432cde-d21a-4d40-b44b-f097ce72cdba"
initrd /boot/rootfs.gz /boot/modules64.gz
}

menuentry "corepure64" {
linux /boot/vmlinuz64 quiet text tce=UUID="d4432cde-d21a-4d40-b44b-f097ce72cdba"/tce64 waitusb=10:UUID="d4432cde-d21a-4d40-b44b-f097ce72cdba"
initrd /boot/rootfs64.gz /boot/modules64.gz
}

menuentry "corepure64 base" {
linux /boot/vmlinuz64 quiet text tce=UUID="d4432cde-d21a-4d40-b44b-f097ce72cdba"/tce64 waitusb=10:UUID="d4432cde-d21a-4d40-b44b-f097ce72cdba" base norestore
initrd /boot/rootfs64.gz /boot/modules64.gz
}

--- End code ---
..where "d4432cde-d21a-4d40-b44b-f097ce72cdba" is the uuid of /dev/sdc1, obtained with "blkid -s UUID /dev/sdc1"

Substitute your machine's native resolution for 1366x768x32 if required.

Note: the efi partition does not need to be set as bootable for this to work with uefi boot, but (on my machine at least) it does need to be set for legacy-bios boot.

Edit: slightly modified grub.cfg for clarity

Edit2: changed grub.cfg insmod efi_gop -> insmod all_video to allow legacy-bios fb at 1366x768

vincentyu1130:
I suppose you'll install CorePure64 after this procedure into sdc1 partition, right?
Thx.
Vincent

Juanito:
Yes - as it says above, "Copy the distribution files rootfs.gz, rootfs64.gz, modules.gz, modules64.gz, vmlinuz and vmlinuz64 to /mnt/sdc1/boot"  ;)

punkgeek:
Thank you.
How can I chose default?

--- Code: ---set default="0"

--- End code ---
It doesn't work

Juanito:
default=menu_label, i.e. default=core in the example above

Navigation

[0] Message Index

[#] Next page

Go to full version