Skip to content

Installation on hard disk

rofl0r edited this page May 13, 2018 · 9 revisions

installing sabotage on a hard disk is conceptually equivalent to what is described in bootstrap-to-hd-image

check out squash-tool usage for a different approach to installing sabotage

you have to

  • create the partitions
  • format them
  • copy the rootfs (including kernel! - you have to build it explicitly)
  • install the bootloader

to do so, you should have full exclusive access to the harddrive. this may be accomplished by attaching (e.g. external usb case) the target HD to another linux PC or by booting the PC with the HD using an existing live CD/pendrive (e.g. an old ubuntu CD lying around) or similar which has basic tools like fdisk (and if you want to encrypt a partition, with cryptsetup and luks support) available.

note that encryption of the root partition requires an initramfs with busybox and cryptsetup installed, and usage of the cryptdevice parameter (parameter on the kernel command line, which is passed to the initramfs) https://wiki.archlinux.org/index.php/Dm-crypt/System_configuration#cryptdevice
take a look at KEEP/squash-tool (mkinitramfs function) for how to create such an initramfs.
related: encrypted-filesystems

Run-down for MBR installation

  • use fdisk to create a 100 MB boot partition, followed by the root partition and optionally a swap partition and mark the boot partition as bootable
  • format the boot partition with ext3 and mount it
  • format the root partition with ext4 and mount it
  • copy the contents of /boot from the sabotage rootfs to the boot mount
  • copy the contents of the sabotage rootfs to the root mount (with cp -a to prevent symlinks)
  • edit extlinux.conf on the boot mount and point the kernel to boot from the root partition (if done as described, usually /dev/sda2)
  • unmount both mounts
  • dd mbr.bin (ships with extlinux) to what is to become /dev/sda in the final sys (use with the same options as in utils/write-hd-image.sh)
  • run extlinux -i on the partition that is to become the boot partition

Run-down for (u)EFI (64bit) installation

Most systems use 64bit efi, exceptions are intel itanium and maybe some older apple hardware. Syslinux efi can only be built on a 64bit sabotage system.

  • you need to install the syslinux6 package
  • build your kernel
  • your first partition on your hard disk needs to be a fat32 (vfat) partition - this usage is authorised by microsoft without a license
  • in the fat partition, create a /EFI/BOOT directory
  • copy the files menu.c32, libutil.c32, ldlinux.e64 and syslinux.efi from /lib/syslinux/efi64 to the /EFI/BOOT on the fat partition
  • create the file syslinux.cfg on the fat partition, example contents for a boot menu would be
    UI menu.c32
    PROMPT 0
    TIMEOUT 100
    DEFAULT $config_name
    LABEL $config_name
          MENU LABEL $config_name
          KERNEL $your_kernel
          INITRD $your_initrd
          APPEND $your_boot_params
  • you do not have to have an initrd, if you don't, just leave the line out of the config
  • $your_boot_params should at least contain a correct boot= stanza
  • $config_name can be anything.
  • the block between LABEL and APPEND can be repeated any number of times, for alternate kernels, rootfs-es, options etc.
  • create a file /EFI/BOOT/syslinux.cfg that contains just the line

INCLUDE /syslinux.cfg

  • this is just so one can boot MBR and efi syslinux with the same configuration, if you do not need this functionality, just put all the lines in /EFI/BOOT/syslinux.cfg without the include

  • you will now need to run the command syslinux -i $dev where $dev is your installation's boot (vfat) partition's device identifier (e.g. /dev/sda1)

installation on USB media

when the kernel tries to open the rootfs, USB drivers may not be loaded yet. thus you should add rootwait to the kernel command line, e.g. root=/dev/sdb1 rootwait