09

October
2012

Slax Boot installer for Linux

There is already a bootinst.bat script in /slax/boot/ directory, which is used from within Windows to make Slax boot from an USB device you copied it into, but there was no official Linux equivalent to it till now. It's called bootinst.sh and you can find it on Linux Live Kit github.

How it works? First of all, it uses 'df .' to find out which devices are we on. Then, it runs extlinux in order to install boot loader to the current partition. Finally, and this is a bit tricky, it puts MBR (master boot record) to the drives sector zero and uses fdisk to unmark all active partitions (so nothing seems bootable at the device) and then it toggless bootable flag only for the current partition. This way, the MBR code knows where to boot from.

For Slax, I will add similar detection if the user tries to install the bootloader to a partition which resides on the same disk drive like Windows, I did for the windows boot installer.

User comments
Ady 2012-10-09 06:16

Regarding bootinst.sh...

Instead of using cat, MAYBE you might want to use something like

dd bs=440 count=1 conv=notrunc if=mbr/mbr.bin of=/dev/sda

of course replacing "if=" and "of=" with the relevant values in your script.

See the "Write" section of
w w w . s y s l i n u x . o r g /
w i k i / i n d e x . p h p /
M b r

Tomas M 2012-10-09 09:06

I can see what you mean, cat could truncate the target file (if it was a file by mistake, instead of device). Thank you very much for pointing this out, I'll switch to dd then.

tonio 2012-10-10 04:55

Tomas,

Will new slax7 have extlinux? This way we can install slax to ext3, ext4, btrfs, xfs or other native linux filesystem and have nice graphics and boot options and not simple lilo screen :)

I have only tested the slax 64 bit from 09-30 with xorg and firefox and it is very impressive! I only have it on livecd. Have not yet installed on usb. Thanks very much Tomas!

Tomas M 2012-10-10 06:13

Yes extlinux is to be included, however I'll most likely delete the stuff from /usr/share/syslinux/ since it's not needed so much for Slax.