├── README.md ├── add-autoiso ├── add-chntpw ├── add-chntpw14 ├── add-debian-installer ├── add-efifs-drivers ├── add-hbcd ├── add-netboot ├── add-trinity-rescue-kit ├── add-ubcd ├── add-ubuntu ├── add-uefi-support ├── add-uefi-toolkit ├── add-usb-loader ├── add-virtualbox-additions-vfd ├── add-windows-10-recovery ├── data ├── allinone.patch ├── autoiso.patch ├── chntpw.cfg ├── chntpw14.cfg ├── debian-installer-findiso ├── debian-installer.cfg ├── extra.sh ├── extras.cfg ├── generate-ubcd-menu.pl ├── grml-resize-tmpfs.sh ├── grub.cfg ├── hbcd.cfg ├── kbds.tar.xz ├── netbootme.cfg ├── patch-grub-mbr.pl ├── patch-grub-secure-boot.pl ├── run-chntpw.sh ├── run-chntpw14.sh ├── run-debian-installer.sh ├── trinity-rescue-kit.cfg ├── trk-mountcd.patch ├── usb-loader.cfg ├── win10efi.cfg └── win10recovery.cfg ├── make-grml-plus └── sign-uefi-for-secure-boot /README.md: -------------------------------------------------------------------------------- 1 | # NO LONGER MAINTAINED 2 | 3 | This repo is no longer maintained. Users are advised to switch to [usb-modboot](https://github.com/schierlm/usb-modboot/) instead. 4 | It provides all the features in grml-plus, and more. 5 | 6 | To make the migration easier, a 7 | [special module](https://github.com/schierlm/usb-modboot/releases/download/v0.9/module.grml-plus-legacy.zip) is provided which can be used 8 | to integrate existing grml-plus menus into the usb-modboot menu, as well as boot usb-modboot via grml-plus' USB-Loader media. 9 | 10 | grml-plus 11 | ========= 12 | 13 | Script to add grml (from grml.org) and more stuff to a USB key 14 | 15 | 16 | Design principles 17 | ----------------- 18 | 19 | - The USB key uses a PC (MBR) partition table and a single FAT32 formatted partition, 20 | to make it usable by as many devices as possible. It is also possible to move all 21 | files to a different disk and back later, and the USB device can still be booted (GRUB2 22 | is installed to the MBR to make this possible, and the boot block is slightly patched 23 | to avoid it being detected as unpartitioned FAT device by some Windows CE systems). 24 | 25 | - All files are stored inside `grml-plus` directory, as far as possible 26 | (GRUB2 is installed on MBR and efi boot loader has to be in /efi, for example). The installation 27 | script does not touch any other places; your previous data on the USB key remains there. 28 | 29 | - Modular design; only add to the USB key what you want and do not bloat it with things you do 30 | not need (adding one GRML iso and less than 10MB of GRUB and scripts is mandatory, though). 31 | 32 | - ISO files (GRML and other distributions) are stored as is on the USB key, to make it easy 33 | to use them on (virtual) machines that do not support USB booting. GRUB2's loopback feature is 34 | used to mount and boot them. 35 | 36 | - Everything that can be downloaded for free can be added - it does not have to be open source or 37 | even freely redistributable. That's why tools like Kon-Boot and PLOP are available here, which 38 | cannot be redistributed with grml itself due to licensing issues. 39 | 40 | Installation 41 | ------------ 42 | 43 | grml-plus is designed to be run from within `grml 2017.05`. I use VirtualBox with USB support, but 44 | other virtualization software (or even running it on bare metal) should work as well. Theoretically, 45 | it should also be possible to run it on any other Linux distribution, but that use case is not 46 | supported by me. You should run is as `root` though, as it does quite some mounting and unmounting of 47 | downloaded ISO files. 48 | 49 | First, make sure that your USB key is indeed formatted as FAT32. The filesystem type of the primary 50 | partition should be 0x0B for maximum compatibility, and the partition should be marked bootable 51 | (While GRUB2 happily boots even if the partition is not bootable, some - especially newer - BIOSes 52 | hide the USB key in the boot device menu if it is formatted with a PC (MBR) partition table but there 53 | are no bootable partitions on it). 54 | 55 | Create a directory called `grml-plus` on it and drop any grml 2017.05 ISO file in it (I use grml96-full, 56 | but any other one should work too). In case you like to add some Ubuntu live ISOs, drop them into that 57 | directory as well. 58 | 59 | Find the partition name of your USB device (`cat /proc/partitions` may help), and run the following 60 | (assuming /dev/sda1) 61 | 62 | root@grml ~ # git clone git://github.com/schierlm/grml-plus 63 | root@grml ~ # cd grml-plus 64 | root@grml ~/grml-plus (git)-[master] # ./make-grml-plus /dev/sda1 65 | root@grml ~/grml-plus (git)-[master] # ./add-ubuntu 66 | root@grml ~/grml-plus (git)-[master] # ./add-chntpw 67 | 68 | The last two commands are optional, if you want to add ubuntu and/or chntpw ISO (the latter is downloaded 69 | automatically) to the menu. 70 | 71 | Expect more `add-` commands to appear over time, or if you are missing any (and the ISO in question can 72 | indeed be loopback booted), feel free to add them and create a pull request. 73 | 74 | 75 | Enjoy! 76 | -------------------------------------------------------------------------------- /add-autoiso: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | . data/extra.sh 4 | 5 | if [ ! -f grml-plus/grub/autoiso.cfg ]; then 6 | echo "Adding autoiso.cfg" 7 | SERVER=http://git.savannah.gnu.org/cgit/grub.git/plain 8 | wget -P .. -nc $SERVER/docs/autoiso.cfg 9 | wget -P .. -nc $SERVER/docs/osdetect.cfg 10 | patch -d .. <$DATADIR/autoiso.patch 11 | cp ../autoiso.cfg ../osdetect.cfg grml-plus/grub 12 | fi 13 | 14 | mkdir -p grml-plus/ISOs 15 | cat <>grml-plus/grub/extras.cfg 16 | menuentry "Auto-detect ISOs in /grml-plus/ISOs/" { 17 | configfile \$images/grub/autoiso.cfg 18 | } 19 | 20 | menuentry "Auto-detect operating systems on disk(s)" { 21 | configfile \$images/grub/osdetect.cfg 22 | } 23 | 24 | EOF 25 | 26 | extra_cleanup 27 | -------------------------------------------------------------------------------- /add-chntpw: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | . data/extra.sh 4 | 5 | if [ ! -f grml-plus/chntpw.iso ]; then 6 | echo "Adding chntpw." 7 | wget -P .. -nc http://pogostick.net/~pnh/ntpasswd/cd110511.zip 8 | unzip ../cd110511.zip -d ../chntpw 9 | cp ../chntpw/cd110511.iso grml-plus/chntpw.iso 10 | fi 11 | 12 | cat $DATADIR/chntpw.cfg >>grml-plus/grub/extras.cfg 13 | cp $DATADIR/run-chntpw.sh grml-plus/run-chntpw.sh 14 | 15 | extra_cleanup 16 | -------------------------------------------------------------------------------- /add-chntpw14: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | . data/extra.sh 4 | 5 | if [ ! -f grml-plus/chntpw14.iso ]; then 6 | echo "Adding chntpw-140201." 7 | wget -P .. -nc http://pogostick.net/~pnh/ntpasswd/cd140201.zip 8 | unzip ../cd140201.zip -d ../chntpw14 9 | cp ../chntpw14/cd140201.iso grml-plus/chntpw14.iso 10 | fi 11 | 12 | cat $DATADIR/chntpw14.cfg >>grml-plus/grub/extras.cfg 13 | cp $DATADIR/run-chntpw14.sh grml-plus/run-chntpw14.sh 14 | 15 | extra_cleanup 16 | -------------------------------------------------------------------------------- /add-debian-installer: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | . data/extra.sh 4 | 5 | DEBIAN_FOUND= 6 | mkdir -p ../debmnt 7 | 8 | for iso in grml-plus/debian-*.iso; do 9 | DEBIAN_FOUND=$iso 10 | mount $iso ../debmnt -o ro,loop 11 | ISOFILE=`basename $iso` 12 | if [ -f ../debmnt/.disk/info ]; then 13 | DEBNAME=`cat ../debmnt/.disk/info` 14 | else 15 | DEBNAME=${ISOFILE%.iso} 16 | fi 17 | echo "Adding $DEBNAME..." 18 | DEBNAME_QUOTED=`echo $DEBNAME | sed 's/"/\\\"/g'` 19 | DEBIAN_ARCH= 20 | for candidate in 386 amd; do 21 | test -f ../debmnt/install.${candidate}/vmlinuz && \ 22 | DEBIAN_ARCH=${candidate} 23 | done 24 | if [ -f ../debmnt/linux ]; then 25 | DEBIAN_VMLINUZ=/linux 26 | DEBIAN_INITRD=/initrd.gz 27 | DEBIAN_GTK_INITRD= 28 | elif [ -z "${DEBIAN_ARCH}" ]; then 29 | echo "Warning: Could not determine architecture for $ISOFILE" 30 | continue 31 | else 32 | DEBIAN_VMLINUZ="/install.${DEBIAN_ARCH}/vmlinuz findiso=/grml-plus/$ISOFILE" 33 | DEBIAN_INITRD=/install.${DEBIAN_ARCH}/initrd.gz 34 | DEBIAN_GTK_INITRD=/install.${DEBIAN_ARCH}/gtk/initrd.gz 35 | for initrd in $DEBIAN_INITRD $DEBIAN_GTK_INITRD; do 36 | INITRD_OUT=grml-plus/grub/${ISOFILE%.iso}/initrd.gz 37 | if [ "$initrd" = "$DEBIAN_GTK_INITRD" ]; then 38 | INITRD_OUT=grml-plus/grub/${ISOFILE%.iso}/gtkinitrd.gz 39 | fi 40 | if [ ! -f $INITRD_OUT ]; then 41 | echo "Building $INITRD_OUT" 42 | mkdir -p grml-plus/grub/${ISOFILE%.iso} 43 | mkdir ../debinit ../debloop 44 | for mod in ../debmnt/pool/main/l/linux/loop-modules-*.udeb; do 45 | dpkg -x $mod ../debloop 46 | done 47 | pushd ../debinit 48 | zcat ../debmnt$initrd | cpio -i 49 | # only copy modules for matching kernels 50 | for dest in lib/modules/*; do 51 | cp -r ../debloop/$dest/* $dest 52 | done 53 | cp $DATADIR/debian-installer-findiso lib/debian-installer-startup.d/S99findiso 54 | chmod a+x lib/debian-installer-startup.d/S99findiso 55 | find . | cpio -o -H newc | gzip -9 \ 56 | >../mnt/$INITRD_OUT 57 | popd 58 | rm -R ../debinit ../debloop 59 | fi 60 | done 61 | DEBIAN_INITRD=\$cfgprefix/${ISOFILE%.iso}/initrd.gz 62 | DEBIAN_GTK_INITRD=\$cfgprefix/${ISOFILE%.iso}/gtkinitrd.gz 63 | fi 64 | umount ../debmnt 65 | cat <>grml-plus/grub/extras.cfg 66 | 67 | menuentry "$DEBNAME_QUOTED" { 68 | set DEBIAN_VMLINUZ="${DEBIAN_VMLINUZ}" 69 | set DEBIAN_INITRD="${DEBIAN_INITRD}" 70 | set DEBIAN_GTK_INITRD="${DEBIAN_GTK_INITRD}" 71 | export DEBIAN_VMLINUZ DEBIAN_INITRD DEBIAN_GTK_INITRD 72 | loopback deb \$images/$ISOFILE 73 | set root=(deb) 74 | configfile \$cfgprefix/debian-installer.cfg 75 | set root=\$orig_root 76 | loopback -d deb 77 | } 78 | EOF 79 | done 80 | 81 | if [ -z "$DEBIAN_FOUND" ]; then 82 | echo "grml-plus/debian-*.iso not found." 83 | fi 84 | 85 | cp $DATADIR/debian-installer.cfg grml-plus/grub 86 | cp $DATADIR/run-debian-installer.sh grml-plus 87 | 88 | extra_cleanup 89 | -------------------------------------------------------------------------------- /add-efifs-drivers: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | . data/extra.sh 4 | 5 | mkdir -p efi/tools/efifs ../efifs 6 | 7 | if [ ! -f efi/tools/efifs/README ]; then 8 | wget -P ../efifs -r -nd -np -nc 'http://efi.akeo.ie/downloads/efifs-0.8/x86_64/' 9 | cp ../efifs/*.efi efi/tools/efifs 10 | echo 'Load these files using the "load" command, followed by "map -r".' >> efi/tools/efifs/README 11 | fi 12 | 13 | extra_cleanup 14 | -------------------------------------------------------------------------------- /add-hbcd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | . data/extra.sh 4 | 5 | addprogram() { 6 | CMDFILE=$1 7 | shift 8 | echo '@pushd "%~dp0"' >../script 9 | echo -n '@7z.exe x -o"%TEMP%\HBCDFiles" -y ..\..\grml-plus\'>>../script 10 | echo -n "Hiren's.BootCD.15.2.iso HBCD\\Programs\\$CMDFILE " >>../script 11 | for FILE in "$@"; do 12 | echo -n "HBCD\\Programs\\$FILE " >>../script 13 | done 14 | echo "" >>../script 15 | echo '@copy 7z.* "%TEMP%\HBCDFiles\HBCD\Programs"' >>../script 16 | echo '@"%TEMP%\HBCDFiles\HBCD\Programs\'$CMDFILE'"' >>../script 17 | unix2dos ../script 2>/dev/null 18 | cp ../script HBCD/Programs/$CMDFILE 19 | } 20 | 21 | autoaddprogram() { 22 | CMDFILE=$1 23 | DEPS= 24 | for FILE in $(grep '7z\.exe .* Files\\' $CMDFILE | \ 25 | sed 's/.*Files\\/Files\\/;s/[\r& ].*//'); do 26 | DEPS="$DEPS $FILE" 27 | done 28 | addprogram `basename $CMDFILE` $DEPS 29 | } 30 | 31 | if [ -f grml-plus/Hiren\'s.BootCD.15.2.iso ]; then 32 | 33 | if [ ! -d HBCD ]; then 34 | echo "Building /HBCD directory" 35 | mkdir -p ../hbcdmnt 36 | mount grml-plus/Hiren\'s.BootCD.15.2.iso ../hbcdmnt -o ro,loop,norock 37 | mkdir -p HBCD/Dos HBCD/XP HBCD/Programs/Files 38 | cp ../hbcdmnt/HBCD/HBCDMenu.exe HBCD 39 | cp ../hbcdmnt/HBCD/Dos/* HBCD/Dos 40 | cp ../hbcdmnt/HBCD/XP/{X,XP.wim,XPCustomize.cmd} HBCD/XP 41 | cp ../hbcdmnt/HBCD/Programs/Files/DLL.7z HBCD/Programs/Files 42 | for FILE in EasyUHA.exe HBCDCustomizer.exe IBProcMan.exe \ 43 | KillBox.exe R-Kill.com Splitter.exe 7z.exe 7z.dll \ 44 | StartupMonitor.exe HBCDMenu.csv; do 45 | cp ../hbcdmnt/HBCD/Programs/$FILE HBCD/Programs 46 | done 47 | echo '@echo This commercial application is not included in the package' >../notinc 48 | echo '@pause>nul' >> ../notinc 49 | unix2dos ../notinc 2>/dev/null 50 | for FILE in SpywareBlaster.cmd ERDComputerManagement.cmd \ 51 | AcronisDiskDirector.cmd ERDExplorer.cmd GetDataFAT.cmd \ 52 | GetDataNTFS.cmd Ghost32.cmd GhostExp.cmd Undelete.cmd; do 53 | cp ../notinc HBCD/Programs/$FILE 54 | done 55 | addprogram ComboFix.cmd ComboFix.exe 56 | addprogram ERUNT.cmd ComboFix.exe 57 | addprogram ProcessExplorer.cmd ProcExp.exe 58 | addprogram SnapShot.cmd snapshot.exe 59 | addprogram NT6xFastInstaller.cmd \ 60 | Files\\NT6xFastInstaller.7z Files\\GImageX.7z 61 | 62 | for CMDFILE in ../hbcdmnt/HBCD/Programs/*.cmd; do 63 | if [ ! -f HBCD/Programs/`basename $CMDFILE` ]; then 64 | if grep -q '7z\.exe .* Files\\' $CMDFILE; then 65 | autoaddprogram $CMDFILE 66 | else 67 | cp $CMDFILE HBCD/Programs 68 | fi 69 | fi 70 | done 71 | umount ../hbcdmnt 72 | fi 73 | cat <>grml-plus/grub/extras.cfg 74 | 75 | menuentry "Hiren's BootCD 15.2" { 76 | set iso_path="/grml-plus/Hiren\'s.BootCD.15.2.iso" 77 | set usbroot=\$root 78 | export iso_path usbroot 79 | loopback hbcd \$images/Hiren\'s.BootCD.15.2.iso 80 | set root=(hbcd) 81 | configfile \$cfgprefix/hbcd.cfg 82 | set root=\$orig_root 83 | loopback -d hbcd 84 | } 85 | EOF 86 | cp $DATADIR/hbcd.cfg grml-plus/grub 87 | else 88 | echo "grml-plus/Hiren_s.BootCD.15.2.iso not found." 89 | fi 90 | 91 | extra_cleanup 92 | -------------------------------------------------------------------------------- /add-netboot: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | . data/extra.sh 4 | 5 | if [ ! -f grml-plus/grub/bfo.lkrn ]; then 6 | echo "Adding boot.fedoraproject.org" 7 | wget -P grml-plus/grub -nc \ 8 | http://dl.fedoraproject.org/pub/alt/bfo/bfo.lkrn 9 | fi 10 | cat $DATADIR/netbootme.cfg >>grml-plus/grub/extras.cfg 11 | 12 | extra_cleanup 13 | -------------------------------------------------------------------------------- /add-trinity-rescue-kit: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | . data/extra.sh 4 | 5 | TRK_FOUND= 6 | mkdir -p ../trkmnt 7 | 8 | for iso in grml-plus/trinity-rescue-kit*.iso; do 9 | TRK_FOUND=$iso 10 | mount $iso ../trkmnt -o ro,loop 11 | ISOFILE=`basename $iso` 12 | TRKNAME=`grep "^menu label Run" ../trkmnt/isolinux.cfg | sed 's/.*\^\(.*\)(.*/\1/'` 13 | echo "Adding $TRKNAME..." 14 | INITRD_OUT=grml-plus/grub/${ISOFILE%.iso}/initrd.gz 15 | 16 | if [ ! -f $INITRD_OUT ]; then 17 | echo "Building $INITRD_OUT" 18 | mkdir -p grml-plus/grub/${ISOFILE%.iso} 19 | mkdir ../trkinit 20 | zcat ../trkmnt/initrd.trk >../trkinitrd || true 21 | mount ../trkinitrd ../trkinit -o loop 22 | patch -d ../trkinit -p0 <$DATADIR/trk-mountcd.patch 23 | umount ../trkinit 24 | gzip -c --best ../trkinitrd >$INITRD_OUT 25 | rm -R ../trkinit ../trkinitrd 26 | fi 27 | 28 | TRK_INITRD=\$cfgprefix/${ISOFILE%.iso}/initrd.gz 29 | umount ../trkmnt 30 | cat <>grml-plus/grub/extras.cfg 31 | 32 | menuentry "$TRKNAME" { 33 | set iso_path="/$iso" 34 | set TRK_INITRD="${TRK_INITRD}" 35 | export iso_path TRK_INITRD 36 | loopback trk \$images/$ISOFILE 37 | set root=(trk) 38 | configfile \$cfgprefix/trinity-rescue-kit.cfg 39 | set root=\$orig_root 40 | loopback -d trk 41 | } 42 | EOF 43 | done 44 | 45 | if [ -z "$TRK_FOUND" ]; then 46 | echo "grml-plus/trinity-rescue-kit*.iso not found." 47 | fi 48 | 49 | cp $DATADIR/trinity-rescue-kit.cfg grml-plus/grub 50 | 51 | extra_cleanup 52 | -------------------------------------------------------------------------------- /add-ubcd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | . data/extra.sh 4 | 5 | UBCD_FOUND= 6 | mkdir -p ../ubcdmnt 7 | 8 | for iso in grml-plus/ubcd*.iso; do 9 | UBCD_FOUND=$iso 10 | mount $iso ../ubcdmnt -o ro,loop 11 | UBCDNAME=`cat ../ubcdmnt/ubcd/menus/syslinux/defaults.cfg | \ 12 | grep "^MENU TITLE" | sed 's#MENU TITLE \(.*\) http://.*#\1#' \ 13 | | sed 's/ *$//'` 14 | ISOFILE=`basename $iso` 15 | CONFDIR=grml-plus/grub/${ISOFILE%.iso} 16 | echo "Adding $UBCDNAME..." 17 | if [ ! -d $CONFDIR ]; then 18 | mkdir $CONFDIR 19 | perl $DATADIR/generate-ubcd-menu.pl ../ubcdmnt $CONFDIR 20 | fi 21 | umount ../ubcdmnt 22 | cat <>grml-plus/grub/extras.cfg 23 | 24 | menuentry "$UBCDNAME" { 25 | loopback ubcd \$images/${ISOFILE} 26 | set iso_path="/$iso" 27 | export iso_path 28 | configfile \$images/grub/${ISOFILE%.iso}/ubcd.cfg 29 | loopback -d ubcd 30 | } 31 | 32 | EOF 33 | done 34 | 35 | if [ -z "$UBCD_FOUND" ]; then 36 | echo "grml-plus/ubcd*.iso not found." 37 | fi 38 | 39 | extra_cleanup 40 | -------------------------------------------------------------------------------- /add-ubuntu: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | . data/extra.sh 4 | 5 | UBUNTU_FOUND= 6 | mkdir -p ../ubumnt 7 | 8 | for iso in grml-plus/ubuntu-*.iso; do 9 | UBUNTU_FOUND=$iso 10 | mount $iso ../ubumnt -o ro,loop 11 | UBUNAME=`cat ../ubumnt/.disk/info` 12 | UBUNAME_QUOTED=`echo $UBUNAME | sed 's/"/\\\"/g'` 13 | ISOFILE=`basename $iso` 14 | umount ../ubumnt 15 | echo "Adding $UBUNAME..." 16 | cat <>grml-plus/grub/extras.cfg 17 | 18 | menuentry "$UBUNAME_QUOTED" { 19 | iso_path="/$iso" 20 | export iso_path 21 | loopback ubu \$images/$ISOFILE 22 | set root=(ubu) 23 | configfile (ubu)/boot/grub/loopback.cfg 24 | set root=\$orig_root 25 | loopback -d ubu 26 | terminal_output console 27 | } 28 | 29 | EOF 30 | done 31 | 32 | if [ -z "$UBUNTU_FOUND" ]; then 33 | echo "grml-plus/ubuntu-*.iso not found." 34 | fi 35 | 36 | extra_cleanup 37 | -------------------------------------------------------------------------------- /add-uefi-support: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | . data/extra.sh 4 | 5 | mkdir -p efi/boot 6 | 7 | if [ ! -f efi/boot/grub.efi ]; then 8 | UUID=`grub-probe -d $DEVICE -t fs_uuid` 9 | GRML_ISO= 10 | for i in grml-plus/grml*.iso; do GRML_ISO=`basename $i`; done 11 | echo "search.fs_uuid $UUID root" >../load.cfg 12 | echo "loopback grml (\$root)/grml-plus/$GRML_ISO" >>../load.cfg 13 | echo "set prefix=(grml)/boot/grub" >>../load.cfg 14 | echo "insmod normal" >>../load.cfg 15 | echo 'set EFI=1' >>../load.cfg 16 | echo 'export EFI' >>../load.cfg 17 | echo 'set prefix=($root)/grml-plus/grub' >>../load.cfg 18 | grub-mkimage -c ../load.cfg -d /usr/lib/grub/x86_64-efi -O x86_64-efi \ 19 | --output=efi/boot/grub.efi --prefix=/ \ 20 | fat iso9660 part_msdos loopback test all_video search_fs_uuid 21 | fi 22 | 23 | if [ ! -f efi/boot/bootx64.efi ]; then 24 | wget -P .. -nc 'http://github.com/schierlm/grml-plus-uefi-tools/releases/download/v0.1/protector.efi' 25 | cp ../protector.efi efi/boot/bootx64.efi 26 | fi 27 | 28 | if [ ! -f efi/boot/efi-shell.efi ]; then 29 | wget -P .. -nc 'http://sourceforge.net/p/edk2/code/15566/tree/branches/UDK2014/EdkShellBinPkg/FullShell/X64/Shell_Full.efi?format=raw' 30 | cp '../Shell_Full.efi?format=raw' efi/boot/efi-shell.efi 31 | fi 32 | 33 | if [ ! -f efi/boot/uefi-shell.efi ]; then 34 | wget -P .. -nc 'http://sourceforge.net/p/edk2/code/15566/tree/branches/UDK2014/ShellBinPkg/UefiShell/X64/Shell.efi?format=raw' 35 | cp '../Shell.efi?format=raw' efi/boot/uefi-shell.efi 36 | fi 37 | 38 | if [ ! -f efi/boot/memtest.efi ]; then 39 | wget -P .. -nc \ 40 | http://www.memtest86.com/downloads/memtest86-iso.zip 41 | mkdir -p ../efimemtest/mnt 42 | unzip ../memtest86-iso.zip -d ../efimemtest 43 | mount ../efimemtest/Memtest86-*.iso ../efimemtest/mnt -o ro,loop 44 | cp ../efimemtest/mnt/efi/boot/bootx64.efi efi/boot/memtest.efi 45 | umount ../efimemtest/mnt 46 | rm -r ../efimemtest 47 | fi 48 | 49 | 50 | extra_cleanup 51 | -------------------------------------------------------------------------------- /add-uefi-toolkit: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | . data/extra.sh 4 | 5 | mkdir -p efi/tools efi/python/lib 6 | 7 | if [ ! -f efi/tools/mkramdisk.efi ]; then 8 | wget -P .. -nc 'http://sourceforge.net/projects/efi-toolkit/files/Official%20Releases/EFI_Toolkit_2.0.0.1.zip/download' 9 | unzip ../download -d .. 10 | cp ../EFI_Toolkit_2.0/binaries/em64t/*.efi efi/tools 11 | pushd ../EFI_Toolkit_2.0/cmds/python/Lib 12 | zip python24.zip * 13 | popd 14 | cp ../EFI_Toolkit_2.0/cmds/python/Lib/python24.zip efi/python/lib 15 | fi 16 | 17 | extra_cleanup 18 | -------------------------------------------------------------------------------- /add-usb-loader: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | . data/extra.sh 4 | 5 | # override this with "biosdisk" to test in a VM without USB support 6 | USB_MODULES=${USB_MODULES:=uhci ohci ehci} 7 | 8 | if [ ! -f grml-plus/grub/usb-loader-core.img ]; then 9 | UUID=`grub-probe -d $DEVICE -t fs_uuid` 10 | GRML_ISO= 11 | for i in grml-plus/grml*.iso; do GRML_ISO=`basename $i`; done 12 | echo "echo Core loaded from USB. Press [Return] to boot." >../load.cfg 13 | echo "read tmp" >>../load.cfg 14 | echo "search.fs_uuid $UUID root" >>../load.cfg 15 | echo "loopback grml (\$root)/grml-plus/$GRML_ISO" >>../load.cfg 16 | echo "set prefix=(grml)/boot/grub" >>../load.cfg 17 | echo "insmod normal" >>../load.cfg 18 | echo 'set prefix=($root)/grml-plus/grub' >>../load.cfg 19 | grub-mkimage -c ../load.cfg -d /usr/lib/grub/i386-pc -O i386-pc \ 20 | -o grml-plus/grub/usb-loader-core.img --prefix=/ \ 21 | at_keyboard usb_keyboard usbms $USB_MODULES fat iso9660 \ 22 | part_msdos loopback test all_video search_fs_uuid read echo 23 | fi 24 | 25 | if [ ! -f grml-plus/usb-loader-cd.iso ]; then 26 | dd if=/dev/zero of=../ul-floppy.img bs=1k count=1440 27 | mkfs.vfat ../ul-floppy.img 28 | mkdir -p ../ul-floppy 29 | mount grml-plus/allinone.img ../ul-floppy -o ro,loop -t msdos 30 | cp ../ul-floppy/boot/plpbt.bin ../plpbt.bin 31 | umount ../ul-floppy 32 | LOOP=`losetup -f` 33 | losetup $LOOP ../ul-floppy.img 34 | mount $LOOP ../ul-floppy -t vfat 35 | mkdir -p ../ul-floppy/boot/grub/i386-pc 36 | echo -e "(fd0)\011$LOOP" >../ul-floppy.map 37 | grub-mkimage -d /usr/lib/grub/i386-pc -O i386-pc -p '(fd0)/boot/grub' \ 38 | -o ../ul-floppy/boot/grub/core.img \ 39 | biosdisk fat part_msdos \ 40 | at_keyboard usb_keyboard chain parttool drivemap read sleep \ 41 | configfile linux ntldr ext2 ntfs btrfs xfs legacycfg \ 42 | normal video search reboot halt linux16 cat minicmd ls \ 43 | usbms gzio loopback multiboot help configfile nativedisk echo 44 | grub-bios-setup -f -a -d ../ul-floppy/boot/grub -m ../ul-floppy.map \ 45 | -b ../../../../../usr/lib/grub/i386-pc/boot.img $LOOP || true 46 | grub-bios-setup -f -a -d ../ul-floppy/boot/grub -m ../ul-floppy.map \ 47 | -b ../../../../../usr/lib/grub/i386-pc/boot.img $LOOP 48 | cp /usr/lib/grub/i386-pc/{command,moddep}.lst \ 49 | /usr/lib/grub/i386-pc/{pci,cs5536,{u,o,e}hci}.mod \ 50 | ../ul-floppy/boot/grub/i386-pc 51 | cp ../plpbt.bin grml-plus/kon-boot.img.gz \ 52 | /lib/live/mount/medium/boot/addons/{memdisk,ipxe.lkrn} \ 53 | grml-plus/grub/memtest86{,plus}.bin \ 54 | ../ul-floppy/boot 55 | sed '/# END/Q' $DATADIR/usb-loader.cfg >../ul-floppy/boot/grub/grub.cfg 56 | umount $LOOP 57 | losetup -d $LOOP 58 | cp ../ul-floppy.img grml-plus/usb-loader-floppy.img 59 | mkdir -p ../ul-iso/boot/grub/i386-pc 60 | cp grml-plus/{usb-loader-floppy,allinone}.img ../ul-iso/boot 61 | LOADER_CORE="/grml-plus/grub/usb-loader-core.img" 62 | echo "search.file $LOADER_CORE root" >../load.cfg 63 | echo "multiboot $LOADER_CORE" >>../load.cfg 64 | echo "boot" >>../load.cfg 65 | grub-mkimage -c ../load.cfg -d /usr/lib/grub/i386-pc -O i386-pc \ 66 | -o ../ul-iso/boot/usb-loader-multiboot.img --prefix=/ \ 67 | at_keyboard usb_keyboard usbms $USB_MODULES fat \ 68 | part_msdos all_video search_fs_file multiboot boot 69 | grub-mkimage -d /usr/lib/grub/i386-pc -O i386-pc-eltorito \ 70 | -p '(cd)/boot/grub' -o ../ul-iso/boot/grub/eltorito.img \ 71 | biosdisk iso9660 72 | 73 | cp /usr/lib/grub/i386-pc/*.{lst,mod} \ 74 | ../ul-iso/boot/grub/i386-pc 75 | cp ../plpbt.bin grml-plus/kon-boot.img.gz \ 76 | /lib/live/mount/medium/boot/addons/{memdisk,ipxe.lkrn} \ 77 | grml-plus/grub/memtest86{,plus}.bin \ 78 | ../ul-iso/boot 79 | cp $DATADIR/usb-loader.cfg ../ul-iso/boot/grub/grub.cfg 80 | genisoimage -l -r -J -b boot/grub/eltorito.img -c boot/boot.cat \ 81 | -no-emul-boot -boot-info-table \ 82 | -o grml-plus/usb-loader-cd.iso ../ul-iso 83 | fi 84 | 85 | extra_cleanup 86 | -------------------------------------------------------------------------------- /add-virtualbox-additions-vfd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | . data/extra.sh 4 | 5 | EDITION=`cat /etc/grml_version | sed 's/-.*//'` 6 | 7 | if [ ! -f grml-plus/$EDITION-virtualbox-additions.vfd ]; then 8 | echo "Adding $EDITION VirtualBox Additions VFD." 9 | apt-get update 10 | apt-get -y install linux-headers-4.9.0-1-grml-all 11 | grep 'deb .*ing main' /etc/apt/sources.list.d/debian.list | sed 's/testing/unstable/' >/etc/apt/sources.list.d/unstable.list 12 | apt-get update 13 | apt-get -y install virtualbox-guest-utils virtualbox-guest-dkms 14 | dd if=/dev/zero of=../vfd bs=10K count=144 15 | mkfs.vfat ../vfd 16 | mkdir ../vfdloop 17 | mount ../vfd ../vfdloop -o loop 18 | cp /var/cache/apt/archives/virtualbox-guest-utils*.deb ../vfdloop 19 | cp /lib/modules/`uname -r`/updates/dkms/*.ko ../vfdloop 20 | cat <<'EOF' >../vfdloop/vboxload.sh 21 | #!/bin/sh 22 | set -e 23 | chdir `dirname $0` 24 | modprobe drm 25 | insmod vboxguest.ko 26 | insmod vboxsf.ko 27 | dpkg -i *.deb 28 | EOF 29 | umount ../vfdloop 30 | rmdir ../vfdloop 31 | mv ../vfd grml-plus/$EDITION-virtualbox-additions.vfd 32 | fi 33 | 34 | extra_cleanup 35 | -------------------------------------------------------------------------------- /add-windows-10-recovery: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | SRC=$(realpath "$1") 4 | . data/extra.sh 5 | 6 | if [ ! -f boot/BCD ]; then 7 | echo "Adding Windows 10 Recovery from $SRC" 8 | cp -R $SRC/boot $SRC/sources . 9 | cp $SRC/bootmgr boot/bootmgr 10 | if [ -f $SRC/efi/boot/bootx64.efi ]; then 11 | echo "Adding EFI support, too." 12 | mkdir -p efi 13 | cp -R $SRC/efi/microsoft efi 14 | cp $SRC/efi/boot/bootx64.efi efi/microsoft 15 | fi 16 | fi 17 | 18 | cat $DATADIR/win10recovery.cfg >>grml-plus/grub/extras.cfg 19 | if [ -f efi/microsoft/bootx64.efi ]; then 20 | cat $DATADIR/win10efi.cfg >>grml-plus/grub/extras.cfg 21 | fi 22 | 23 | extra_cleanup 24 | -------------------------------------------------------------------------------- /data/allinone.patch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/schierlm/grml-plus/68e63169c187bd8a9e1403b6b401c70306d41f07/data/allinone.patch -------------------------------------------------------------------------------- /data/autoiso.patch: -------------------------------------------------------------------------------- 1 | --- 1/autoiso.cfg_orig 2014-04-24 18:03:24.000000000 +0000 2 | +++ 2/autoiso.cfg 2014-04-24 17:27:14.000000000 +0000 3 | @@ -1,6 +1,7 @@ 4 | # Sample GRUB script to autodetect operating systems 5 | # 6 | # Copyright (C) 2010 Free Software Foundation, Inc. 7 | +# Copyright (C) 2014 Michael Schierl 8 | # 9 | # GRUB is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | @@ -52,13 +53,13 @@ 12 | loopdev="$3" 13 | 14 | result=1 15 | - for dir in /boot/grml /boot/grmlsmall /boot/grmlmedium; do 16 | - if ! test -f ${dir}/linux26 -a -f ${dir}/initrd.gz; then continue; fi 17 | + for gdir in /boot/grml /boot/grmlsmall /boot/grmlmedium; do 18 | + if ! test -f ${gdir}/linux26 -a -f ${gdir}/initrd.gz; then continue; fi 19 | 20 | echo grml $isopath: yes 21 | result=0 22 | menuentry "GRML Linux from ${realdev}${isopath}" \ 23 | - "$realdev" "$isopath" "$dir" { 24 | + "$realdev" "$isopath" "$gdir" { 25 | set device="$2" 26 | set isopath="$3" 27 | set grmldir="$4" 28 | @@ -200,10 +201,8 @@ 29 | } 30 | 31 | function scan_isos { 32 | - isodirs="$1" 33 | - 34 | - for dev in (*); do 35 | - for dir in $isodirs; do 36 | + for dev in ($root); do 37 | + for dir in /grml-plus/ISOs; do 38 | for file in ${dev}${dir}/*.iso ${dev}${dir}/*.ISO; do 39 | if ! test -f "$file"; then continue; fi 40 | 41 | @@ -226,19 +225,35 @@ 42 | set root=$saved_root 43 | loopback -d loopdev_scan 44 | done 45 | + for file in ${dev}${dir}/*.bin ${dev}${dir}/*.BIN; do 46 | + if ! test -f "$file"; then continue; fi 47 | + 48 | + echo linux16 $file: yes 49 | + menuentry "Linux16 binary from $file" "$file" { 50 | + linux16 $2 51 | + } 52 | + done 53 | + for file in ${dev}${dir}/*.img ${dev}${dir}/*.IMG; do 54 | + if ! test -f "$file"; then continue; fi 55 | + 56 | + echo memdisk $file: yes 57 | + menuentry "Memdisk image from $file" "$file" { 58 | + linux16 (grml)/boot/addons/memdisk 59 | + initrd16 $2 60 | + } 61 | + done 62 | + for file in ${dev}${dir}/*.cfg ${dev}${dir}/*.CFG; do 63 | + if ! test -f "$file"; then continue; fi 64 | + 65 | + echo configfile $file: yes 66 | + source $file 67 | + done 68 | done 69 | done 70 | return 0 71 | } 72 | 73 | -# XXX Remove later 74 | -insmod serial 75 | -serial 76 | -terminal_output --append serial 77 | -# terminal_input --append serial 78 | - 79 | langcode="$lang" 80 | 81 | insmod regexp 82 | -scan_isos /iso /boot/iso 83 | - 84 | +scan_isos 85 | -------------------------------------------------------------------------------- /data/chntpw.cfg: -------------------------------------------------------------------------------- 1 | menuentry "Offline NT Password & Registry Editor (chntpw)" { 2 | loopback nt $images/chntpw.iso 3 | linux (nt)/vmlinuz 4 | initrd (nt)/initrd.cgz (nt)/scsi.cgz 5 | } 6 | 7 | -------------------------------------------------------------------------------- /data/chntpw14.cfg: -------------------------------------------------------------------------------- 1 | menuentry "Offline NT Password & Registry Editor (chntpw-140201)" { 2 | loopback nt $images/chntpw14.iso 3 | linux (nt)/vmlinuz 4 | initrd (nt)/initrd.cgz (nt)/scsi.cgz 5 | } 6 | 7 | -------------------------------------------------------------------------------- /data/debian-installer-findiso: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | mkdir /loop 2>/dev/null || true 6 | mkdir /cdrom 2>/dev/null || true 7 | 8 | insmod /lib/modules/`uname -r`/kernel/drivers/block/loop.ko 9 | 10 | for arg in $(cat /proc/cmdline); do 11 | case $arg in 12 | findiso=*) 13 | FINDISO=/loop/${arg#findiso=/} 14 | ;; 15 | esac 16 | done 17 | 18 | echo Locating and loop-mounting ISO file... 19 | sleep 5 20 | 21 | umount /loop 2>/dev/null || true 22 | 23 | for fs in "usb-partition" "partition"; do 24 | devices="$(list-devices $fs)" 25 | for loopdev in $devices; do 26 | LOOPFS=$(/sbin/blkid -s TYPE -o value $loopdev 2>/dev/null) 27 | if mount -o ro,exec -t $LOOPFS $loopdev /loop; then 28 | if [ -f $FINDISO ] && mount -o loop,ro,exec -t iso9660 $FINDISO /cdrom; then 29 | if [ -e /cdrom/.disk/info ]; then 30 | break 2 31 | fi 32 | umount /cdrom 2>/dev/null || true 33 | fi 34 | umount /loop 35 | fi 36 | done 37 | done 38 | echo ISO file mounted. 39 | -------------------------------------------------------------------------------- /data/debian-installer.cfg: -------------------------------------------------------------------------------- 1 | menuentry "Install${DESKTOPHINT}" { 2 | linux ${DEBIAN_VMLINUZ} ${DESKTOP} vga=788 -- quiet 3 | initrd ${DEBIAN_INITRD} 4 | } 5 | 6 | if [ -n "${DEBIAN_GTK_INITRD}" ]; then 7 | menuentry "Graphical Install${DESKTOPHINT}" { 8 | linux ${DEBIAN_VMLINUZ} ${DESKTOP} video=vesa:ywrap,mtrr vga=788 -- quiet 9 | initrd ${DEBIAN_GTK_INITRD} 10 | } 11 | fi 12 | 13 | submenu "Advanced options${DESKTOPHINT}" { 14 | menuentry "Expert install${DESKTOPHINT}" { 15 | linux ${DEBIAN_VMLINUZ} ${DESKTOP} priority=low vga=788 -- 16 | initrd ${DEBIAN_INITRD} 17 | } 18 | 19 | menuentry "Rescue mode${DESKTOPHINT}" { 20 | linux ${DEBIAN_VMLINUZ} vga=788 rescue/enable=true -- quiet 21 | initrd ${DEBIAN_INITRD} 22 | } 23 | 24 | menuentry "Automated install${DESKTOPHINT}" { 25 | linux ${DEBIAN_VMLINUZ} ${DESKTOP} auto=true priority=critical vga=788 -- quiet 26 | initrd ${DEBIAN_INITRD} 27 | } 28 | 29 | if [ -n "${DEBIAN_GTK_INITRD}" ]; then 30 | menuentry "Graphical expert install${DESKTOPHINT}" { 31 | linux ${DEBIAN_VMLINUZ} ${DESKTOP} priority=low video=vesa:ywrap,mtrr vga=788 -- 32 | initrd ${DEBIAN_GTK_INITRD} 33 | } 34 | 35 | menuentry "Graphical rescue mode${DESKTOPHINT}" { 36 | linux ${DEBIAN_VMLINUZ} video=vesa:ywrap,mtrr vga=788 rescue/enable=true -- quiet 37 | initrd ${DEBIAN_GTK_INITRD} 38 | } 39 | 40 | menuentry "Graphical automated install${DESKTOPHINT}" { 41 | linux ${DEBIAN_VMLINUZ} ${DESKTOP} auto=true priority=critical video=vesa:ywrap,mtrr vga=788 -- quiet 42 | initrd ${DEBIAN_GTK_INITRD} 43 | } 44 | fi 45 | 46 | if [ -z "${DESKTOP}" ]; then 47 | submenu "Alternative desktop environments" { 48 | menuentry "KDE" { 49 | set DESKTOP="desktop=kde" 50 | set DESKTOPHINT=" (KDE)" 51 | export DESKTOP DESKTOPHINT 52 | configfile $cfgprefix/debian-installer.cfg 53 | } 54 | 55 | menuentry "LXDE" { 56 | set DESKTOP="desktop=lxde" 57 | set DESKTOPHINT=" (LXDE)" 58 | export DESKTOP DESKTOPHINT 59 | configfile $cfgprefix/debian-installer.cfg 60 | 61 | } 62 | 63 | menuentry "Xfce" { 64 | set DESKTOP="desktop=xfce" 65 | set DESKTOPHINT=" (KDE)" 66 | export DESKTOP DESKTOPHINT 67 | configfile $cfgprefix/debian-installer.cfg 68 | } 69 | } 70 | fi 71 | } 72 | 73 | if [ -n "${DEBIAN_GTK_INITRD}" ]; then 74 | menuentry "Install with speech synthesis${DESKTOPHINT}" { 75 | linux ${DEBIAN_VMLINUZ} ${DESKTOP} vga=788 speakup.synth=soft -- quiet 76 | initrd ${DEBIAN_GTK_INITRD} 77 | } 78 | fi -------------------------------------------------------------------------------- /data/extra.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | if [ ! -f /tmp/grml-plus/devicename ]; then 4 | echo "run make-grml-plus first!" >&2 5 | exit 1 6 | fi 7 | . /tmp/grml-plus/devicename 8 | echo "Mounting $DEVICE to /tmp/grml-plus/mnt." 9 | mkdir -p /tmp/grml-plus/mnt 10 | umount /tmp/grml-plus/mnt 2>/dev/null || true 11 | mount $DEVICE /tmp/grml-plus/mnt 12 | cd `dirname $0`/data 13 | DATADIR=`pwd` 14 | cd /tmp/grml-plus/mnt 15 | 16 | extra_cleanup() { 17 | echo "Cleaning up." 18 | cd $DATADIR/.. 19 | umount /tmp/grml-plus/mnt 20 | echo "Done. Enjoy your new grml-plus USB drive or add more extras!" 21 | } 22 | -------------------------------------------------------------------------------- /data/extras.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /data/generate-ubcd-menu.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | $isodir=$ARGV[0]; 4 | $confdir=$ARGV[1]; 5 | ($grubconfdir=$confdir) =~ s#.*grml-plus/#\$images/#; 6 | 7 | sub initrdline { 8 | my ($initrd) = @_; 9 | if (`file $isodir/$initrd` =~ /gzip compressed/) { 10 | my $size = `zcat $isodir/$initrd | wc -c` + 0; 11 | if ($size % 512 != 0) { 12 | die $initrd . "'s size $size is not 512-byte aligned."; 13 | } 14 | return " loopback initrd (ubcd)$initrd\n" . 15 | " initrd16 (initrd)+" . ($size / 512) . "\n"; 16 | } else { 17 | return " initrd16 (ubcd)$initrd\n"; 18 | } 19 | } 20 | 21 | open MAIN, "<", "$isodir/ubcd/menus/syslinux/main.cfg" or die $!; 22 | open MENU, ">", "$confdir/ubcd.cfg" or die $!; 23 | open DESC, ">", "$confdir/main.txt" or die $!; 24 | 25 | print MENU <) { 41 | last if /^LABEL -\r?\n$/; 42 | } 43 | 44 | while(
) { 45 | s/ *\r?\n$//; 46 | if (/^LABEL -$/ or /^$/) { 47 | # ignore 48 | } elsif (/^MENU LABEL (.*)$/) { 49 | $label=$1; 50 | } elsif (/^TEXT HELP$/) { 51 | print DESC "$label:\n\n"; 52 | while(
) { 53 | s/\r?\n$//; 54 | last if /^ENDTEXT$/; 55 | print DESC $_.$/; 56 | } 57 | print DESC $/.$/; 58 | } elsif (/^CONFIG \/ubcd\/custom\/custom.cfg$/) { 59 | last; 60 | } elsif (/^CONFIG (\/pmagic\/[^ ]+)( [^ ]+)?$/) { 61 | print MENU "submenu \"$label\" {\n"; 62 | print MENU <", "$confdir/$base.txt" or die $!; 80 | 81 | print MENU <) { 96 | last if /^CONFIG \/ubcd\/menus\/syslinux\/main.cfg\r?\n$/; 97 | } 98 | 99 | while() { 100 | s/ *\r?\n$//; 101 | if (/^LABEL -$/ or /^$/) { 102 | # ignore 103 | } elsif (/^MENU LABEL (.*)$/) { 104 | $label=$1; 105 | } elsif (/^TEXT HELP$/) { 106 | print SUBDESC "$label:\n\n"; 107 | while() { 108 | s/\r?\n$//; 109 | last if /^ENDTEXT$/; 110 | print SUBDESC $_.$/; 111 | } 112 | print SUBDESC $/.$/; 113 | } elsif (/^COM32 linux.c32 memdisk$/) { 114 | $_=; 115 | s/\r?\n$//; 116 | die unless /^INITRD ([^ ]+)$/; 117 | $initrd=$1; 118 | $_=; 119 | $_="" unless defined $_; 120 | s/\r?\n$//; 121 | if (/^$/) { 122 | $cmd=""; 123 | } elsif (/^APPEND (.*)$/) { 124 | $cmd=" $1"; 125 | } else { 126 | die "Unexpected option for $label in $base.cfg: '$_'\n"; 127 | } 128 | print MENU "menuentry \"$label\" {\n"; 129 | print MENU " linux16 (grml)/boot/addons/memdisk$cmd\n"; 130 | print MENU initrdline($initrd); 131 | print MENU "}\n"; 132 | } elsif (/^COM32 linux.c32 \/([^ ]+)$/) { 133 | $kernel=$1; 134 | $_=; 135 | if (defined $_) { 136 | s/\r?\n$//; 137 | die unless /^INITRD ([^ ]+)$/; 138 | $initrd=$1; 139 | $_=; 140 | s/\r?\n$//; 141 | if (/^$/) { 142 | $cmd=""; 143 | } elsif (/^APPEND (.*)$/) { 144 | $cmd=" $1"; 145 | } else { 146 | die "Unexpected option for $label in $base.cfg: '$_'\n"; 147 | } 148 | } else { 149 | $initrd=""; 150 | $cmd=""; 151 | } 152 | print MENU "menuentry \"$label\" {\n"; 153 | print MENU " linux16 (ubcd)/$kernel$cmd\n"; 154 | print MENU initrdline($initrd) unless $initrd eq ""; 155 | print MENU "}\n"; 156 | } elsif (/^CONFIG \/pmagic\/.*$/) { 157 | print MENU "menuentry \"$label (via Parted Magic)\" {\n"; 158 | print MENU " echo \"Run Parted Magic!\"\n"; 159 | print MENU " read tmp\n"; 160 | print MENU " unset tmp\n"; 161 | print MENU "}\n"; 162 | } elsif (/^LINUX \/(.*)$/) { 163 | $kernel=$1; 164 | print MENU "menuentry \"$label\" {\n"; 165 | print MENU " linux16 (ubcd)/$kernel\n"; 166 | print MENU "}\n"; 167 | } elsif (/^CONFIG \/ubcd\/boot\/memtest.*$/) { 168 | print MENU "menuentry \"$label\" {\n"; 169 | print MENU " linux16 (ubcd)/ubcd/boot/memtest86/memtest\n"; 170 | print MENU "}\n"; 171 | } elsif (/^CONFIG \/(ubcd\/menus\/syslinux\/hdd\/.*)$/) { 172 | $scfgfile=$1; 173 | ($sbase=$scfgfile) =~ s#.*/(.*)\.cfg#$1#; 174 | 175 | open SSUB, "<", "$isodir/$scfgfile" or die $!; 176 | open SSUBDESC, ">", "$confdir/$sbase.txt" or die $!; 177 | 178 | print MENU <) { 194 | last if /^CONFIG \/ubcd\/menus\/syslinux\/hdd.cfg\r?\n$/; 195 | } 196 | 197 | while() { 198 | s/ *\r?\n$//; 199 | if (/^LABEL -$/ or /^$/) { 200 | # ignore 201 | } elsif (/^MENU LABEL (.*)$/) { 202 | $label=$1; 203 | } elsif (/^TEXT HELP$/) { 204 | print SSUBDESC "$label:\n\n"; 205 | while() { 206 | s/\r?\n$//; 207 | last if /^ENDTEXT$/; 208 | print SSUBDESC $_.$/; 209 | } 210 | print SSUBDESC $/.$/; 211 | } elsif (/^COM32 linux.c32 memdisk$/) { 212 | $_=; 213 | s/\r?\n$//; 214 | die unless /^INITRD ([^ ]+)$/; 215 | $initrd=$1; 216 | $_=; 217 | $_="" unless defined $_; 218 | s/\r?\n$//; 219 | if (/^$/) { 220 | $cmd=""; 221 | } elsif (/^APPEND (.*)$/) { 222 | $cmd=" $1"; 223 | } else { 224 | die "Unexpected option for $label in $sbase.cfg: '$_'\n"; 225 | } 226 | print MENU "menuentry \"$label\" {\n"; 227 | print MENU " linux16 (grml)/boot/addons/memdisk$cmd\n"; 228 | print MENU initrdline($initrd); 229 | print MENU "}\n"; 230 | } elsif (/^COM32 linux.c32 \/([^ ]+)$/) { 231 | $kernel=$1; 232 | $_=; 233 | if (defined $_) { 234 | s/\r?\n$//; 235 | die unless /^INITRD ([^ ]+)$/; 236 | $initrd=$1; 237 | $_=; 238 | s/\r?\n$//; 239 | if (/^$/) { 240 | $cmd=""; 241 | } elsif (/^APPEND (.*)$/) { 242 | $cmd=" $1"; 243 | } else { 244 | die "Unexpected option for $label in $base.cfg: '$_'\n"; 245 | } 246 | } else { 247 | $initrd=""; 248 | $cmd=""; 249 | } 250 | print MENU "menuentry \"$label\" {\n"; 251 | print MENU " linux16 (ubcd)/$kernel$cmd\n"; 252 | print MENU initrdline($initrd) unless $initrd eq ""; 253 | print MENU "}\n"; 254 | } elsif (/^CONFIG \/pmagic\/.*$/) { 255 | print MENU "menuentry \"$label (via Parted Magic)\" {\n"; 256 | print MENU " echo \"Run Parted Magic!\"\n"; 257 | print MENU " read tmp\n"; 258 | print MENU " unset tmp\n"; 259 | print MENU "}\n"; 260 | } elsif (/^LINUX \/(.*)$/) { 261 | $kernel=$1; 262 | print MENU "menuentry \"$label\" {\n"; 263 | print MENU " linux16 (ubcd)/$kernel\n"; 264 | print MENU "}\n"; 265 | } else { 266 | die "Unexpected line in $sbase.cfg: '$_'\n"; 267 | } 268 | } 269 | close(SSUB); 270 | close(SSUBDESC); 271 | print MENU "}\n"; 272 | } elsif (/^COM32 hdt.c32$/) { 273 | $_=; 274 | die unless /^APPEND pciids=.*$/; 275 | # COMBOOT not supported by GRUB2! 276 | } else { 277 | die "Unexpected line in $base.cfg: '$_'\n"; 278 | } 279 | } 280 | close(SUB); 281 | close(SUBDESC); 282 | print MENU "}\n"; 283 | } elsif (/^COM32 linux.c32 memdisk$/) { 284 | $_=
; 285 | s/\r?\n$//; 286 | die unless /^INITRD ([^ ]+)$/; 287 | $initrd=$1; 288 | $_=
; 289 | s/\r?\n$//; 290 | die unless /^(APPEND floppy raw c=32 h=16 s=63)?$/; 291 | print MENU "menuentry \"$label\" {\n"; 292 | print MENU " linux16 (grml)/boot/addons/memdisk\n"; 293 | print MENU initrdline($initrd); 294 | print MENU "}\n"; 295 | } else { 296 | die "Unexpected line: '$_'\n"; 297 | } 298 | } 299 | 300 | close(MAIN); 301 | close(MENU); 302 | close(DESC); 303 | 304 | print "UBCD menu created.\n"; 305 | -------------------------------------------------------------------------------- /data/grml-resize-tmpfs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ -z "$1" ]; then 6 | echo "Usage: grml-resize-tmpfs [size]" 7 | echo "Example: grml-resize-tmpfs 512M" 8 | exit 1 9 | fi 10 | 11 | while [ $(grep "^tmpfs /lib/live/mount/overlay" /proc/mounts | wc -l) -gt 1 ]; do 12 | umount /lib/live/mount/overlay 13 | done 14 | 15 | mount -o remount,size=$1 /lib/live/mount/overlay 16 | mount -o size=$1 -t tmpfs tmpfs /lib/live/mount/overlay 17 | -------------------------------------------------------------------------------- /data/grub.cfg: -------------------------------------------------------------------------------- 1 | insmod test 2 | if [ -z "$COLOR_SCHEME_SELECTED" ]; then 3 | insmod iso9660 4 | insmod loopback 5 | if [ -n "$EFI" ]; then 6 | set FIRMWARE_NAME=UEFI 7 | set efiroot=($root)/efi/boot 8 | export efiroot 9 | else 10 | loopback grml /grml-plus/%GRML_ISO% 11 | set FIRMWARE_NAME=BIOS 12 | fi 13 | set cfgprefix=$prefix 14 | set prefix=(grml)/boot/grub 15 | set images=($root)/grml-plus 16 | set orig_root=$root 17 | export cfgprefix images FIRMWARE_NAME 18 | set color_normal=light-gray/black 19 | set menu_color_normal=light-gray/blue 20 | set menu_color_highlight=yellow/blue 21 | export color_normal menu_color_normal menu_color_highlight 22 | fi 23 | set default=1 24 | 25 | submenu "GRUB2 Keyboard Configuration" { 26 | menuentry "Default ${FIRMWARE_NAME} keyboard layout" { 27 | terminal_input console 28 | } 29 | 30 | menuentry "German" { 31 | loopback aio $images/allinone.img 32 | terminal_input at_keyboard 33 | keymap (aio)/boot/grub2/kbd/de.gkb 34 | loopback -d aio 35 | } 36 | 37 | menuentry "Austrian" { 38 | loopback aio $images/allinone.img 39 | terminal_input at_keyboard 40 | keymap (aio)/boot/grub2/kbd/at.gkb 41 | loopback -d aio 42 | } 43 | 44 | menuentry "Swiss" { 45 | loopback aio $images/allinone.img 46 | terminal_input at_keyboard 47 | keymap (aio)/boot/grub2/kbd/ch.gkb 48 | loopback -d aio 49 | } 50 | 51 | menuentry "Spanish" { 52 | loopback aio $images/allinone.img 53 | terminal_input at_keyboard 54 | keymap (aio)/boot/grub2/kbd/es.gkb 55 | loopback -d aio 56 | } 57 | 58 | menuentry "French" { 59 | loopback aio $images/allinone.img 60 | terminal_input at_keyboard 61 | keymap (aio)/boot/grub2/kbd/fr.gkb 62 | loopback -d aio 63 | } 64 | 65 | menuentry "US English" { 66 | loopback aio $images/allinone.img 67 | terminal_input at_keyboard 68 | keymap (aio)/boot/grub2/kbd/us.gkb 69 | loopback -d aio 70 | } 71 | 72 | menuentry "Czech" { 73 | loopback aio $images/allinone.img 74 | terminal_input at_keyboard 75 | keymap (aio)/boot/grub2/kbd/cz.gkb 76 | loopback -d aio 77 | } 78 | } 79 | 80 | menuentry "GRML Menu" { 81 | iso_path="/grml-plus/%GRML_ISO%" 82 | export iso_path 83 | set root=(grml) 84 | configfile /boot/grub/loopback.cfg 85 | set root=$orig_root 86 | terminal_output console 87 | } 88 | 89 | source $cfgprefix/extras.cfg 90 | 91 | if [ -z "$EFI" ]; then 92 | menuentry "Kon-Boot" { 93 | loopback kon $images/kon-boot.img.gz 94 | linux16 (grml)/boot/addons/memdisk 95 | initrd16 (kon)+2880 96 | } 97 | 98 | menuentry "All-In-One Boot Floppy" { 99 | linux16 (grml)/boot/addons/memdisk 100 | initrd16 $images/allinone.img 101 | } 102 | 103 | menuentry "Hardware Detection Tool" { 104 | linux16 (grml)/boot/addons/memdisk 105 | initrd16 $images/hdt.img 106 | } 107 | 108 | menuentry "Memtest86" { 109 | linux16 $images/grub/memtest86.bin 110 | } 111 | 112 | menuentry "Memtest86+" { 113 | linux16 $images/grub/memtest86plus.bin 114 | } 115 | 116 | menuentry "List all VESA Graphics Modes" { 117 | set pager=1 118 | vbeinfo 119 | set tmp=$color_normal 120 | set color_normal=$color_highlight 121 | echo -n --MORE-- 122 | set color_normal=$tmp 123 | read tmp 124 | unset tmp 125 | unset pager 126 | } 127 | else 128 | menuentry "UEFI Shell" { 129 | chainloader $efiroot/uefi-shell.efi 130 | } 131 | 132 | menuentry "EFI Shell" { 133 | chainloader $efiroot/efi-shell.efi 134 | } 135 | 136 | menuentry "Memtest86 (EFI)" { 137 | chainloader $efiroot/memtest.efi 138 | } 139 | fi 140 | 141 | submenu "GRUB templates (edit manually to boot from hard disk)" { 142 | menuentry "Boot from Master Boot Record of a disk" { 143 | set root=(hdX) 144 | chainloader +1 145 | } 146 | 147 | menuentry "Activate and boot a partition" { 148 | set root=(hdX,msdosY) 149 | parttool $root boot+ 150 | chainloader +1 151 | } 152 | 153 | menuentry "Activate a partition (but do not boot it)" { 154 | parttool (hdX,msdosY) boot+ 155 | } 156 | 157 | menuentry "Swap two hard disks" { 158 | drivemap -s (hdX) (hdY) 159 | } 160 | 161 | menuentry "Load legacy configfile from partition /" { 162 | legacy_configfile (hdX,msdosY)/boot/grub/menu.lst 163 | } 164 | 165 | menuentry "Load legacy configfile from partition /boot" { 166 | legacy_configfile (hdX,msdosY)/grub/menu.lst 167 | } 168 | 169 | menuentry "Load configfile from partition /" { 170 | legacy_configfile (hdX,msdosY)/boot/grub/grub.cfg 171 | } 172 | 173 | menuentry "Load configfile from partition /boot" { 174 | configfile (hdX,msdosY)/grub/grub.cfg 175 | } 176 | 177 | menuentry "Boot GNU/Linux" { 178 | set root=(hdX,msdosY) 179 | linux /vmlinuz root=/dev/hdX ro 180 | initrd /initrd.img 181 | } 182 | 183 | # the following entries are untested; they are just copied and 184 | # adapted from All-In-One Boot Floppy (which copied them from 185 | # an old version of Super Grub Disk. 186 | 187 | menuentry "Boot DOS from Windows NT partition" { 188 | set root=(hdX,msdosY) 189 | parttool $root boot+ 190 | chainloader /bootsect.dos 191 | } 192 | 193 | menuentry "Boot GNU (also known as GNU/Hurd)" { 194 | set root=(hdX,msdosY) 195 | multiboot /boot/gnumach.gz root=device:hdXsY 196 | module /hurd/ext2fs.static \ 197 | '--multiboot-command-line=${kernel-command-line}' \ 198 | '--host-priv-port=${host-port}' \ 199 | '--device-master-port=${device-port}' \ 200 | '--exec-server-task=${exec-task}' \ 201 | -T typed '${root}' '$(task-create)' '$(task-resume)' 202 | module /lib/ld.so.1 /hurd/exec '$(exec-task=task-create)' 203 | } 204 | 205 | menuentry "Boot GNU/kFreeBSD" { 206 | set root=(hdX,msdosY,bsdZ) 207 | kfreebsd /boot/loader.gz 208 | } 209 | 210 | menuentry "Boot GNU/kNetBSD" { 211 | set root=(hdX,netbsdY) 212 | knetbsd /boot/knetbsd.gz 213 | } 214 | 215 | menuentry "Boot Utah Mach4 multiboot (kernel from floppy)" { 216 | set root=(hdX,Y) 217 | echo Insert the diskette now!! 218 | read tmp 219 | unset tmp 220 | multiboot (fd0)/boot/kernel root=hd0s3 221 | module (fd0)/boot/bootstrap 222 | } 223 | 224 | menuentry "Boot FreeBSD" { 225 | set root=(hd0,2,bsd1) 226 | kfreebsd /boot/loader 227 | } 228 | 229 | menuentry "Boot NetBSD" { 230 | set root=(hd0,netbsd2) 231 | knetbsd /netbsd 232 | } 233 | 234 | menuentry "Boot OpenBSD" { 235 | set root=(hd0,netbsd2) 236 | knetbsd /bsd 237 | } 238 | 239 | menuentry "Boot OS/2" { 240 | set root=(hd0,msdos1) 241 | parttool $root boot+ 242 | chainloader /boot/chain.os2 243 | } 244 | 245 | menuentry "Boot Windows XP via NTLDR" { 246 | set root=(hdX,msdosY) 247 | ntldr /ntldr 248 | } 249 | 250 | menuentry "Boot Windows 7 via NTLDR" { 251 | set root=(hdX,msdosY) 252 | ntldr /bootmgr 253 | } 254 | 255 | menuentry "Hide a partition" { 256 | parttool (hdX,msdosY) hidden+ 257 | } 258 | 259 | menuentry "Unhide a partition" { 260 | parttool (hdX,msdosY) hidden- 261 | } 262 | } 263 | 264 | if [ -z "$COLOR_SCHEME_SELECTED"]; then 265 | submenu "Select Color Scheme" { 266 | menuentry "Apply current scheme and return to main menu" { 267 | set COLOR_SCHEME_SELECTED=1 268 | export COLOR_SCHEME_SELECTED 269 | configfile $cfgprefix/grub.cfg 270 | } 271 | 272 | menuentry "Preview: Default scheme" { 273 | set menu_color_normal=light-gray/blue 274 | set menu_color_highlight=yellow/blue 275 | } 276 | 277 | menuentry "Preview: Inverted" { 278 | set menu_color_normal=light-gray/brown 279 | set menu_color_highlight=light-blue/brown 280 | } 281 | 282 | menuentry "Preview: Barlond" { 283 | set menu_color_normal=white/cyan 284 | set menu_color_highlight=yellow/blue 285 | } 286 | 287 | menuentry "Preview: Barlond2" { 288 | set menu_color_normal=white/blue 289 | set menu_color_highlight=yellow/cyan 290 | } 291 | 292 | menuentry "Preview: Simple Black" { 293 | set menu_color_normal=light-gray/black 294 | set menu_color_highlight=yellow/blue 295 | } 296 | 297 | menuentry "Preview: Matrix" { 298 | set menu_color_normal=green/black 299 | set menu_color_highlight=light-green/green 300 | } 301 | 302 | menuentry "Preview: Dalton Bros." { 303 | set menu_color_normal=red/green 304 | set menu_color_highlight=green/red 305 | } 306 | 307 | menuentry "Preview: Debian" { 308 | set menu_color_normal=cyan/blue 309 | set menu_color_highlight=white/blue 310 | } 311 | 312 | menuentry "Preview: BW" { 313 | set menu_color_normal=light-gray/black 314 | set menu_color_highlight=black/light-gray 315 | } 316 | 317 | menuentry "Preview: BW Inverse" { 318 | set menu_color_normal=black/light-gray 319 | set menu_color_highlight=light-gray/black 320 | } 321 | 322 | menuentry "Preview: SGD Non Default" { 323 | set menu_color_normal=black/cyan 324 | set menu_color_highlight=yellow/black 325 | } 326 | } 327 | fi 328 | 329 | menuentry "Exit to ${FIRMWARE_NAME}" { 330 | exit 331 | } 332 | 333 | menuentry "Reboot" { 334 | reboot 335 | } 336 | 337 | menuentry "Halt" { 338 | halt 339 | } 340 | -------------------------------------------------------------------------------- /data/hbcd.cfg: -------------------------------------------------------------------------------- 1 | menuentry "Mini Windows Xp" { 2 | set root=$usbroot 3 | ntldr (hbcd)/HBCD/XP/XP.BIN 4 | } 5 | 6 | menuentry "Dos Programs" { 7 | loopback f /HBCD/Dos/dos.gz 8 | linux16 /HBCD/Boot/memdisk floppy 9 | initrd16 (f)+2880 10 | } 11 | 12 | menuentry "Windows Memory Diagnostic" { 13 | loopback f /HBCD/Boot/wmemtest.gz 14 | linux16 /HBCD/Boot/memdisk 15 | initrd16 (f)+2880 16 | } 17 | 18 | menuentry "MemTest86+" { 19 | loopback f /HBCD/Boot/memtest.gz 20 | linux16 /HBCD/Boot/memdisk 21 | initrd16 (f)+2880 22 | } 23 | 24 | menuentry "Offline NT/2000/XP/Vista/7 Password Changer" { 25 | linux16 /HBCD/Boot/chntpw vga=1 26 | initrd16 /HBCD/Boot/chntpw.gz 27 | } 28 | 29 | menuentry "Kon-Boot" { 30 | loopback f /HBCD/Boot/konboot.gz 31 | linux16 /HBCD/Boot/memdisk 32 | initrd16 (f)+2880 33 | } 34 | 35 | menuentry "Seagate DiskWizard (Powered by Acronis Trueimage, Error? ALT+T+O+K)" { 36 | linux16 /HBCD/Boot/SeagatDW vga=788 rw ramdisk_size=32768 acpi=off quiet noapic mbrcrcs on 37 | initrd16 /HBCD/Boot/SeagatDW.gz 38 | } 39 | 40 | menuentry "PLoP Boot Manager" { 41 | linux16 /HBCD/Boot/plpbt.bin 42 | } 43 | 44 | menuentry "Smart Boot Manager 3.7.1" { 45 | loopback f /HBCD/Boot/smartbm.gz 46 | linux16 /HBCD/Boot/memdisk 47 | initrd16 (f)+2880 48 | } 49 | 50 | menuentry "Fix \"NTLDR is Missing\"" { 51 | loopback f /HBCD/Boot/ntldr.gz 52 | linux16 /HBCD/Boot/memdisk 53 | initrd16 (f)+2880 54 | } 55 | 56 | menuentry "Darik's Boot and Nuke - Hard Drive Eraser" { 57 | loopback f /HBCD/Boot/dban.gz 58 | linux16 /HBCD/Boot/memdisk 59 | initrd16 (f)+2880 60 | } 61 | -------------------------------------------------------------------------------- /data/kbds.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/schierlm/grml-plus/68e63169c187bd8a9e1403b6b401c70306d41f07/data/kbds.tar.xz -------------------------------------------------------------------------------- /data/netbootme.cfg: -------------------------------------------------------------------------------- 1 | if [ -z "$EFI" ]; then 2 | menuentry "Boot from Internet (netboot.xyz)" { 3 | linux16 (grml)/boot/addons/netboot.xyz.lkrn 4 | } 5 | 6 | menuentry "Boot Fedora from Internet (boot.fedoraproject.org)" { 7 | linux16 $images/grub/bfo.lkrn 8 | } 9 | 10 | menuentry "Boot from LAN (IPXE)" { 11 | linux16 (grml)/boot/addons/ipxe.lkrn 12 | } 13 | fi 14 | -------------------------------------------------------------------------------- /data/patch-grub-mbr.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | # GRUB 1.99 by default starts its MBR with EB 63 90, which is used by 4 | # some crappy embedded devices to mis-detect it as a FAT32 boot record, 5 | # thereby assuming that the device is not partitioned, but a FAT32 6 | # filesystem is stored directly on the device. This assumption makes 7 | # it impossible to use this USB drive with these devices. Therefore, we 8 | # patch the MBR to start with the (as far as x86 instructions are 9 | # concerned) equivalent code 90 EB 62. 10 | # 11 | # While we are at it, we will also patch the loading message to read 12 | # GRUB USB MBR 13 | # to make it easier to distinguish it from another GRUB installed on the 14 | # machine we want to use our device on. 15 | 16 | open DEV, "+<", $ARGV[0] or die $!; 17 | binmode DEV; 18 | 19 | sub patch { 20 | my ($index, $before, $after) = @_; 21 | my $actual; 22 | read(DEV, $actual, length $before); 23 | if ($before eq $actual) { 24 | print "Applying patch $index...\n"; 25 | seek(DEV, - length $before, 1); 26 | print DEV $after; 27 | } elsif ($after eq $actual) { 28 | print "Patch $index already applied.\n"; 29 | } else { 30 | die("Patch $index failed, unexpected bytes detected."); 31 | } 32 | } 33 | 34 | patch(1, "\xEB\x63\x90", "\x90\xEB\x62"); 35 | seek(DEV, 816, 1); 36 | patch(2, "loading", "USB MBR"); 37 | close(DEV); 38 | 39 | print "MBR patched successfully\n"; 40 | -------------------------------------------------------------------------------- /data/patch-grub-secure-boot.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | # Debian's grub version has been patched (no-insmod-on-sb.patch) to 4 | # disallow loading modules when Secure Boot is enabled. This is 5 | # presumably used in scenarios where the whole chain from GRUB down to 6 | # the kernel image is signed - as GRUB modules cannot be signed, the 7 | # easiest way to disable this bypass is to disable GRUB module loading 8 | # altogether and instead use a monolithic GRUB image. As we don't want 9 | # to do this and are too lazy to compile our own GRUB, just patch the 10 | # variable names that are used for the Secure Boot check. 11 | 12 | open DEV, "+<", $ARGV[0] or die $!; 13 | binmode DEV; 14 | 15 | sub patch { 16 | my ($index, $before, $after) = @_; 17 | my $actual; 18 | read(DEV, $actual, length $before); 19 | if ($before eq $actual) { 20 | print "Applying patch $index...\n"; 21 | seek(DEV, - length $before, 1); 22 | print DEV $after; 23 | } elsif ($after eq $actual) { 24 | print "Patch $index already applied.\n"; 25 | } else { 26 | die("Patch $index failed, unexpected bytes detected."); 27 | } 28 | } 29 | 30 | seek(DEV, 0xa483, 0); 31 | patch(1, "SecureBoot", "XecureBoot"); 32 | seek(DEV, 0xa48e, 0); 33 | patch(2, "SetupMode", "XetupMode"); 34 | close(DEV); 35 | 36 | print "GRUB patched for Secure Boot successfully.\n"; 37 | -------------------------------------------------------------------------------- /data/run-chntpw.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ "$1" == "chroot" ]; then 6 | mkdir -p /tmp/chntpw/{mnt,initrd} 7 | mount chntpw.iso /tmp/chntpw/mnt -o ro,loop 8 | pushd /tmp/chntpw/initrd 9 | zcat ../mnt/initrd.cgz | cpio -i 10 | umount /tmp/chntpw/mnt 11 | mkdir tmp disk 12 | mount -t proc none proc 13 | mount -t sysfs none sys 14 | chroot . /bin/busybox --install -s 15 | chroot . /sbin/mdev -s 16 | cat scripts/banner1 17 | chroot . /bin/sh /scripts/main.sh 18 | umount sys 19 | umount proc 20 | popd 21 | rm -R /tmp/chntpw 22 | elif [ "$1" == "nochroot" ]; then 23 | mkdir -p /tmp/chntpw/{mnt,initrd,bin} 24 | mount chntpw.iso /tmp/chntpw/mnt -o ro,loop 25 | pushd /tmp/chntpw/initrd 26 | zcat ../mnt/initrd.cgz | cpio -i 27 | umount /tmp/chntpw/mnt 28 | mkdir /disk 29 | ln -s /bin/cp /tmp/chntpw/bin/cpnt 30 | ln -s /tmp/chntpw/initrd/scripts /scripts 31 | export PATH=$PATH:/tmp/chntpw/bin 32 | cat scripts/banner1 33 | bash scripts/main.sh 34 | popd 35 | rm /scripts 36 | rmdir /disk 37 | rm -R /tmp/chntpw 38 | else 39 | echo "Usage: ./run-chntp.sh [no]chroot." 40 | fi 41 | -------------------------------------------------------------------------------- /data/run-chntpw14.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ "$1" == "chroot" ]; then 6 | mkdir -p /tmp/chntpw/{mnt,initrd} 7 | mount chntpw14.iso /tmp/chntpw/mnt -o ro,loop 8 | pushd /tmp/chntpw/initrd 9 | zcat ../mnt/initrd.cgz | cpio -i 10 | umount /tmp/chntpw/mnt 11 | mkdir tmp disk 12 | mount -t proc none proc 13 | mount -t sysfs none sys 14 | chroot . /bin/busybox --install -s 15 | chroot . /sbin/mdev -s 16 | cat scripts/banner1 17 | chroot . /bin/sh /scripts/main.sh 18 | umount sys 19 | umount proc 20 | popd 21 | rm -R /tmp/chntpw 22 | elif [ "$1" == "nochroot" ]; then 23 | mkdir -p /tmp/chntpw/{mnt,initrd,bin} 24 | mount chntpw14.iso /tmp/chntpw/mnt -o ro,loop 25 | pushd /tmp/chntpw/initrd 26 | zcat ../mnt/initrd.cgz | cpio -i 27 | umount /tmp/chntpw/mnt 28 | mkdir /disk 29 | ln -s /bin/cp /tmp/chntpw/bin/cpnt 30 | ln -s /tmp/chntpw/initrd/scripts /scripts 31 | export PATH=$PATH:/tmp/chntpw/bin 32 | cat scripts/banner1 33 | bash scripts/main.sh 34 | popd 35 | rm /scripts 36 | rmdir /disk 37 | rm -R /tmp/chntpw 38 | else 39 | echo "Usage: ./run-chntp14.sh [no]chroot." 40 | fi 41 | -------------------------------------------------------------------------------- /data/run-debian-installer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ ! -f "$1" ]; then 6 | echo "Usage: ./run-debian-installer debian-isofile.iso" >&2 7 | exit 1 8 | fi 9 | 10 | mkdir -p /tmp/debinst/cdrom 11 | mount "$1" /tmp/debinst/cdrom -o ro,loop 12 | pushd /tmp/debinst 13 | if [ -f cdrom/initrd.gz ]; then 14 | # mini iso, does not need cdrom 15 | zcat cdrom/initrd.gz | cpio -i 16 | umount cdrom 17 | rmdir cdrom 18 | else 19 | zcat cdrom/install.*/initrd.gz | cpio -i 20 | fi 21 | chroot . /bin/sh -c "export LIVE_INSTALLER_MODE=1; /init; /sbin/debian-installer-startup; /sbin/debian-installer" 22 | umount cdrom || true 23 | popd 24 | rm -R --one-file-system /tmp/debinst 25 | 26 | -------------------------------------------------------------------------------- /data/trinity-rescue-kit.cfg: -------------------------------------------------------------------------------- 1 | menuentry "Run Trinity Rescue Kit 3.4 (default mode, with text menu)" { 2 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose pci=conf1 trkmenu 3 | initrd ${TRK_INITRD} 4 | } 5 | 6 | menuentry "1 : TRK 3.4 in failsafe mode (No menu, VGA, noacpi, noapic)" { 7 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose acpi=off noapic pci=conf1 vga=1 8 | initrd ${TRK_INITRD} 9 | } 10 | 11 | menuentry "2 : TRK 3.4 running from RAM (best >= 512mb, 256mb min)" { 12 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose pci=conf1 trkinmem trkmenu 13 | initrd ${TRK_INITRD} 14 | } 15 | 16 | menuentry "3 : TRK 3.4 - Run 'mclone' in client mode (!)" { 17 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose pci=conf1 mclone 18 | initrd ${TRK_INITRD} 19 | } 20 | 21 | menuentry "4 : TRK 3.4 in simple VGA mode (debugging of kernel output)" { 22 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=1 pci=conf1 splash=off trkmenu 23 | initrd ${TRK_INITRD} 24 | } 25 | 26 | menuentry "5 : TRK 3.4 with Belgian keyboard (use menu for other)" { 27 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose pci=conf1 keyb_be trkmenu 28 | initrd ${TRK_INITRD} 29 | } 30 | 31 | menuentry "6 : TRK 3.4 - Virusscan all drives (Clamav, non interactive)" { 32 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose pci=conf1 virusscan 33 | initrd ${TRK_INITRD} 34 | } 35 | 36 | menuentry "7 : TRK 3.4 - Try more pcmcia and usb nics (when not detected)" { 37 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose pci=conf1 pcmcia trkmenu 38 | initrd ${TRK_INITRD} 39 | } 40 | 41 | menuentry "8 : TRK 3.4 - Try more SCSI drivers (when disks not detected)" { 42 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose pci=conf1 scsidrv trkmenu 43 | initrd ${TRK_INITRD} 44 | } 45 | 46 | menuentry "9 : TRK 3.4 with a secure shell server enabled" { 47 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose pci=conf1 sshd 48 | initrd ${TRK_INITRD} 49 | } 50 | 51 | menuentry "10: TRK 3.4 - Execute local scripts on harddrive of PC" { 52 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose pci=conf1 locscr 53 | initrd ${TRK_INITRD} 54 | } 55 | 56 | menuentry "11: TRK 3.4 as bootserver to boot other TRK clients" { 57 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose pci=conf1 trkbootnet trkmenu 58 | initrd ${TRK_INITRD} 59 | } 60 | 61 | menuentry "12: TRK 3.4 - Fileshare all drives as guest, no security" { 62 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose pci=conf1 smbguest trkmenu 63 | initrd ${TRK_INITRD} 64 | } 65 | 66 | menuentry "13: TRK 3.4 - Single user mode (no menu)" { 67 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose pci=conf1 runlevel 1 68 | initrd ${TRK_INITRD} 69 | } 70 | 71 | menuentry "14: TRK 3.4 - Acpi=off, noapic PCI=bios (Alternate boot 1)" { 72 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose acpi=off noapic pci=bios trkmenu 73 | initrd ${TRK_INITRD} 74 | } 75 | 76 | menuentry "15: TRK 3.4 - Acpi=off, noapic PCI=any (Alternate boot 2)" { 77 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose acpi=off noapic trkmenu 78 | initrd ${TRK_INITRD} 79 | } 80 | 81 | menuentry "16: TRK 3.4 - PCI=conf2 (Alternate boot 3)" { 82 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose pci=conf2 trkmenu 83 | initrd ${TRK_INITRD} 84 | } 85 | 86 | menuentry "17: TRK 3.4 - Verbose startup for debugging (no menu)" { 87 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose pci=conf1 debugging 88 | initrd ${TRK_INITRD} 89 | } 90 | 91 | menuentry "18: TRK 3.4 - SSH, boot- and guest fileserver, run from RAM" { 92 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose pci=conf1 sshd trkinmem smbguest trkbootnet trkmenu 93 | initrd ${TRK_INITRD} 94 | } 95 | 96 | menuentry "19: TRK 3.4 - Run from RAM, run mclone as client" { 97 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose pci=conf1 trkinmem mclone 98 | initrd ${TRK_INITRD} 99 | } 100 | 101 | menuentry "20: TRK 3.4 with proxyserver support enabled" { 102 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose pci=conf1 proxy trkmenu 103 | initrd ${TRK_INITRD} 104 | } 105 | 106 | menuentry "21: TRK 3.4 - All devices set to read-only" { 107 | linux /kernel.trk findiso=${iso_path} ramdisk_size=65536 root=/dev/ram0 vga=788 splash=verbose pci=conf1 allro 108 | initrd ${TRK_INITRD} 109 | } 110 | 111 | menuentry "22: Memory tester: Memtest86+ v1.65" { 112 | linux16 /memtest.x86 113 | } 114 | 115 | -------------------------------------------------------------------------------- /data/trk-mountcd.patch: -------------------------------------------------------------------------------- 1 | --- etc/mountcd.sh 2014-03-15 13:16:58.000000000 +0000 2 | +++ etc/mountcd.sh 2014-03-15 13:33:21.000000000 +0000 3 | @@ -7,6 +7,21 @@ 4 | TRKMOUNTDIR=`cat /etc/trkmountdir` 5 | 6 | function SearchCd { 7 | +# Check for findiso first 8 | +FINDISO=`cat /proc/cmdline | tr " " "\n" | grep -i findiso | cut -d "=" -f 2` 9 | +if [ -n $FINDISO ]; then 10 | + mkdir /trkmedium 11 | + for DEV in `blkid -t TYPE=vfat -o device`; do 12 | + mount -r -t vfat $DEV /trkmedium 13 | + if [ -f "/trkmedium/$FINDISO" ]; then 14 | + LOOPDEV=`losetup -f` 15 | + losetup $LOOPDEV "/trkmedium/$FINDISO" 16 | + echo ${LOOPDEV#/dev/} > /etc/trkcd 17 | + break 18 | + fi 19 | + umount /trkmedium 20 | + done 21 | +else 22 | # All other things we can check if we 're not running from PXE 23 | # Check cd-rom drives in /proc/sys/dev/cdrom/info 24 | TRKLABEL=`cat /proc/cmdline | tr " " "\n" | grep -i vollabel | cut -d "=" -f 2` 25 | @@ -17,6 +32,7 @@ 26 | cddrives=`grep name /proc/sys/dev/cdrom/info| sed -e s'/drive name://'` 27 | for j in $cddrives; do if [ "$TRKLABEL" == "`dd if=/dev/$j bs=1 skip=32808 count=16 2>/dev/null| tr -d " "`" ]; then echo $j > /etc/trkcd; fi; 28 | done; 29 | +fi 30 | # Check if TRK was found on CD, otherwise look on writable storage 31 | if [ -s /etc/trkcd ]; then 32 | c=`cat /etc/trkcd` 33 | -------------------------------------------------------------------------------- /data/usb-loader.cfg: -------------------------------------------------------------------------------- 1 | menuentry "Plop Boot Manager" { 2 | linux16 /boot/plpbt.bin 3 | } 4 | 5 | menuentry "Chainload grml-plus via GRUB USB driver" { 6 | insmod fat 7 | insmod part_msdos 8 | insmod search 9 | insmod multiboot 10 | insmod usbms 11 | insmod usb_keyboard 12 | insmod pci 13 | insmod cs5536 14 | nativedisk uhci ohci ehci 15 | search -s -f /grml-plus/grub/usb-loader-core.img 16 | multiboot /grml-plus/grub/usb-loader-core.img 17 | } 18 | 19 | menuentry "Exit (boot from next boot device)" { 20 | exit 21 | } 22 | 23 | menuentry "Reboot" { 24 | reboot 25 | } 26 | 27 | menuentry "Halt" { 28 | halt 29 | } 30 | 31 | menuentry "Kon-Boot" { 32 | loopback kon /boot/kon-boot.img.gz 33 | linux16 /boot/memdisk 34 | initrd16 (kon)+2880 35 | } 36 | 37 | menuentry "Memtest86" { 38 | linux16 /boot/memtest86.bin 39 | } 40 | 41 | menuentry "Memtest86+" { 42 | linux16 /boot/memtest86plus.bin 43 | } 44 | 45 | menuentry "Boot from LAN (iPXE)" { 46 | linux16 /boot/ipxe.lkrn 47 | } 48 | 49 | submenu "GRUB templates (edit manually to boot from hard disk)" { 50 | menuentry "Boot from Master Boot Record of a disk" { 51 | set root=(hdX) 52 | chainloader +1 53 | } 54 | 55 | menuentry "Activate and boot a partition" { 56 | set root=(hdX,msdosY) 57 | parttool $root boot+ 58 | chainloader +1 59 | } 60 | 61 | menuentry "Activate a partition (but do not boot it)" { 62 | parttool (hdX,msdosY) boot+ 63 | } 64 | 65 | menuentry "Swap two hard disks" { 66 | drivemap -s (hdX) (hdY) 67 | } 68 | 69 | menuentry "Load legacy configfile from partition /" { 70 | legacy_configfile (hdX,msdosY)/boot/grub/menu.lst 71 | } 72 | 73 | menuentry "Load legacy configfile from partition /boot" { 74 | legacy_configfile (hdX,msdosY)/grub/menu.lst 75 | } 76 | 77 | menuentry "Load configfile from partition /" { 78 | legacy_configfile (hdX,msdosY)/boot/grub/grub.cfg 79 | } 80 | 81 | menuentry "Load configfile from partition /boot" { 82 | configfile (hdX,msdosY)/grub/grub.cfg 83 | } 84 | 85 | menuentry "Boot GNU/Linux" { 86 | set root=(hdX,msdosY) 87 | linux /vmlinuz root=/dev/hdX ro 88 | initrd /initrd.img 89 | } 90 | 91 | # the following entries are untested; they are just copied and 92 | # adapted from All-In-One Boot Floppy (which copied them from 93 | # an old version of Super Grub Disk. 94 | 95 | menuentry "Boot DOS from Windows NT partition" { 96 | set root=(hdX,msdosY) 97 | parttool $root boot+ 98 | chainloader /bootsect.dos 99 | } 100 | 101 | menuentry "Boot GNU (also known as GNU/Hurd)" { 102 | set root=(hdX,msdosY) 103 | multiboot /boot/gnumach.gz root=device:hdXsY 104 | module /hurd/ext2fs.static \ 105 | '--multiboot-command-line=${kernel-command-line}' \ 106 | '--host-priv-port=${host-port}' \ 107 | '--device-master-port=${device-port}' \ 108 | '--exec-server-task=${exec-task}' \ 109 | -T typed '${root}' '$(task-create)' '$(task-resume)' 110 | module /lib/ld.so.1 /hurd/exec '$(exec-task=task-create)' 111 | } 112 | 113 | menuentry "Boot GNU/kFreeBSD" { 114 | set root=(hdX,msdosY,bsdZ) 115 | kfreebsd /boot/loader.gz 116 | } 117 | 118 | menuentry "Boot GNU/kNetBSD" { 119 | set root=(hdX,netbsdY) 120 | knetbsd /boot/knetbsd.gz 121 | } 122 | 123 | menuentry "Boot Utah Mach4 multiboot (kernel from floppy)" { 124 | set root=(hdX,Y) 125 | echo Insert the diskette now!! 126 | read tmp 127 | unset tmp 128 | multiboot (fd0)/boot/kernel root=hd0s3 129 | module (fd0)/boot/bootstrap 130 | } 131 | 132 | menuentry "Boot FreeBSD" { 133 | set root=(hd0,2,bsd1) 134 | kfreebsd /boot/loader 135 | } 136 | 137 | menuentry "Boot NetBSD" { 138 | set root=(hd0,netbsd2) 139 | knetbsd /netbsd 140 | } 141 | 142 | menuentry "Boot OpenBSD" { 143 | set root=(hd0,netbsd2) 144 | knetbsd /bsd 145 | } 146 | 147 | menuentry "Boot OS/2" { 148 | set root=(hd0,msdos1) 149 | parttool $root boot+ 150 | chainloader /boot/chain.os2 151 | } 152 | 153 | menuentry "Boot Windows XP via NTLDR" { 154 | set root=(hdX,msdosY) 155 | ntldr /ntldr 156 | } 157 | 158 | menuentry "Boot Windows 7 via NTLDR" { 159 | set root=(hdX,msdosY) 160 | ntldr /bootmgr 161 | } 162 | 163 | menuentry "Hide a partition" { 164 | parttool (hdX,msdosY) hidden+ 165 | } 166 | 167 | menuentry "Unhide a partition" { 168 | parttool (hdX,msdosY) hidden- 169 | } 170 | } 171 | 172 | # END OF FLOPPY PART # 173 | 174 | menuentry "All-In-One Boot Floppy" { 175 | linux16 /boot/memdisk 176 | initrd16 /boot/allinone.img 177 | } 178 | 179 | menuentry "USB-Loader floppy version" { 180 | linux16 /boot/memdisk 181 | initrd16 /boot/usb-loader-floppy.img 182 | } 183 | 184 | menuentry "USB-Loader multiboot version" { 185 | multiboot /boot/usb-loader-multiboot.img 186 | } 187 | -------------------------------------------------------------------------------- /data/win10efi.cfg: -------------------------------------------------------------------------------- 1 | if [ -n "$EFI" ]; then 2 | menuentry "Windows 10 Recovery" { 3 | chainloader /efi/microsoft/bootx64.efi 4 | } 5 | fi 6 | -------------------------------------------------------------------------------- /data/win10recovery.cfg: -------------------------------------------------------------------------------- 1 | if [ -z "$EFI" ]; then 2 | menuentry "Windows 10 Recovery" { 3 | ntldr /boot/bootmgr 4 | } 5 | fi 6 | -------------------------------------------------------------------------------- /make-grml-plus: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "grml-plus installation script" 4 | echo "(c) 2013-2017 Michael Schierl" 5 | echo "Licensed under GPLv2 or later" 6 | echo "=============================" 7 | 8 | set -e 9 | 10 | if [ -z "$1" ]; then 11 | echo "Usage: ./make-grml-plus [device]" >&2 12 | exit 1 13 | fi 14 | 15 | DEVICE=$1 16 | MBR=`echo $1 | sed 's/[0-9]//g'` 17 | 18 | if [ ! -b $DEVICE -o ! -b $MBR ]; then 19 | echo "Error: Either $DEVICE or $MBR is not a valid block device." >&2 20 | exit 1 21 | fi 22 | 23 | if [ ! "`grub-probe -d $DEVICE -t fs`" == "fat" ]; then 24 | echo "Error: $DEVICE is not formatted with the fat filesystem." >&2 25 | exit 1 26 | fi 27 | 28 | if [ ! "`grub-probe -d $DEVICE -t partmap`" == "msdos" ]; then 29 | echo "Error: $MBR does not contain a MBR style partition table." >&2 30 | exit 1 31 | fi 32 | 33 | echo "Mounting $DEVICE to /tmp/grml-plus/mnt." 34 | mkdir -p /tmp/grml-plus/mnt 35 | umount /tmp/grml-plus/mnt 2>/dev/null || true 36 | mount $DEVICE /tmp/grml-plus/mnt 37 | echo "DEVICE=$DEVICE" >/tmp/grml-plus/devicename 38 | 39 | cd `dirname $0`/data 40 | DATADIR=`pwd` 41 | cd /tmp/grml-plus/mnt 42 | 43 | mkdir -p grml-plus/grub/i386-pc 44 | 45 | if [ -f grml-plus/grub/i386-pc/loopback.mod ]; then 46 | echo "loopback.mod found; assuming that Grub2 is already installed." 47 | echo "Remove that file to re-install Grub2 in MBR." 48 | else 49 | echo "Installing Grub2 in MBR." 50 | grub-mkdevicemap -m ../origdevice.map 51 | grep "^`grub-probe -t drive -m ../origdevice.map -d $MBR` " \ 52 | ../origdevice.map | sed 's/^([^()]*) /(hd0) /' \ 53 | >../device.map 54 | echo "Device map used for GRUB2:" 55 | cat ../device.map 56 | GRUBDEV=`grub-probe -t drive -m ../device.map -d $DEVICE` 57 | echo "GRUB device used: $GRUBDEV" 58 | grub-mkimage -d /usr/lib/grub/i386-pc -O i386-pc -o ../core.img \ 59 | -p ${GRUBDEV}/grml-plus/grub biosdisk fat part_msdos 60 | grub-bios-setup -d . -m ../device.map -c ../core.img \ 61 | -b ../../../usr/lib/grub/i386-pc/boot.img $MBR 62 | echo "Patching GRUB2 MBR for enhanced compatibility." 63 | perl $DATADIR/patch-grub-mbr.pl $MBR 64 | echo "GRUB2 installation to MBR finished." 65 | cp /usr/lib/grub/i386-pc/{bitmap,bitmap_scale,boot,bufio,crypto,extcmd,font,fshelp,gfxterm,gzio,iso9660,loopback,normal,terminal,video,test,gettext}.mod grml-plus/grub/i386-pc 66 | fi 67 | 68 | if [ ! -f grml-plus/kon-boot.img.gz ]; then 69 | echo "Adding Kon-Boot (if you have a commercial version, feel free to replace the free version)." 70 | wget -P .. -nc 'https://www.dropbox.com/s/f5i4g9vlmwoxrtp/kon-boot1.1-free.zip?dl=1' 71 | mkdir ../konboot 72 | unzip -P kon-boot '../kon-boot1.1-free.zip?dl=1' -d ../konboot 73 | unzip ../konboot/kon-boot1.1-free/FD0-konboot-v1.1-2in1.zip \ 74 | -d ../konboot 75 | gzip -c ../konboot/FD0-konboot-v1.1-2in1/FD0-konboot-v1.1-2in1.img \ 76 | >grml-plus/kon-boot.img.gz 77 | rm -R ../konboot 78 | fi 79 | 80 | if [ ! -f grml-plus/allinone.img ]; then 81 | echo "Adding patched All-In-One Boot Floppy image." 82 | cp /lib/live/mount/medium/boot/addons/allinone.img ../allinone.img 83 | mkdir -p ../allinone 84 | mount ../allinone.img ../allinone -t msdos -o loop 85 | rm ../allinone/tools/lucifer.exe 86 | mkdir -p ../patchbase 87 | cp ../allinone/boot/grub/{intro.tct,taiobf.lst} ../patchbase 88 | patch -d ../patchbase -p3 <$DATADIR/allinone.patch 89 | 90 | cp ../patchbase/{intro.tct,taiobf.lst} ../allinone/boot/grub 91 | cp /lib/live/mount/medium/boot/addons/memdisk ../allinone/boot/memdisk 92 | cp grml-plus/kon-boot.img.gz ../allinone/boot/kon-boot.imz 93 | wget -P .. -nc http://download.plop.at/files/bootmngr/plpbt-5.0.14.zip 94 | unzip ../plpbt-5.0.14.zip -d ../plpbt 95 | cp ../plpbt/plpbt-5.0.14/plpbt.bin ../allinone/boot/plpbt.bin 96 | rm -R ../plpbt 97 | mkdir -p ../allinone/boot/grub2/kbd 98 | mkdir -p ../kbds 99 | tar xCJf ../kbds $DATADIR/kbds.tar.xz 100 | cp ../kbds/kbds/*.gkb ../allinone/boot/grub2/kbd 101 | umount ../allinone 102 | cp ../allinone.img grml-plus/allinone.img 103 | fi 104 | 105 | if [ ! -f grml-plus/rawwritewin.exe ]; then 106 | echo "Adding RawWriteWin.exe." 107 | wget -P .. -nc http://www.chrysocome.net/downloads/rawwritewin-0.7.zip 108 | unzip ../rawwritewin-0.7.zip -d ../rawwrite 109 | cp ../rawwrite/rawwritewin.exe grml-plus/rawwritewin.exe 110 | rm -R ../rawwrite 111 | fi 112 | 113 | if [ "`dpkg --print-architecture`" = "amd64" -a ! -f grml-plus/hdt.img ]; then 114 | echo "WARNING: Unable to compile hdt.img" 115 | touch grml-plus/hdt.img 116 | fi 117 | if [ ! -f grml-plus/hdt.img ]; then 118 | echo "Adding HDT." 119 | wget -P .. -nc https://www.kernel.org/pub/linux/utils/boot/syslinux/6.xx/syslinux-6.03.zip 120 | unzip ../syslinux-6.03.zip -d ../syslinux 121 | cd ../syslinux/com32/hdt 122 | cp ../../bios/com32/hdt/hdt.c32 . 123 | cp ../../bios/mtools/syslinux ../../mtools 124 | cp ../../bios/com32/menu/menu.c32 ../menu 125 | cp ../../bios/com32/chain/chain.c32 ../chain 126 | sed -i 's/hdt.elf.*//;s/.*LDFLAGS.*//' Makefile 127 | cp /lib/live/mount/medium/boot/addons/pci.ids floppy 128 | gzip --best floppy/pci.ids 129 | topdir=../.. MAKEDIR=../../mk make hdt.img 130 | for i in ../../bios/com32/*/lib*.c32 ../../bios/com32/*/*/lib*.c32; do 131 | MTOOLSRC=floppy/mtools.conf mcopy $i a: 132 | done 133 | cd ../../../mnt 134 | cp ../syslinux/com32/hdt/hdt.img grml-plus/hdt.img 135 | fi 136 | 137 | if [ ! -f grml-plus/grub/memtest86.bin ]; then 138 | echo "Adding Memtest86." 139 | wget -P .. -nc http://memtest86.com/downloads/memtest86-4.3.7-iso.zip 140 | mkdir -p ../memtest86/mnt 141 | unzip ../memtest86-4.3.7-iso.zip -d ../memtest86 142 | mount ../memtest86/Memtest86-4.3.7.iso ../memtest86/mnt -o ro,loop 143 | cp ../memtest86/mnt/isolinux/memtest grml-plus/grub/memtest86.bin 144 | umount ../memtest86/mnt 145 | rm -R ../memtest86 146 | fi 147 | 148 | if [ ! -f grml-plus/grub/memtest86plus.bin ]; then 149 | echo "Adding Memtest86+." 150 | wget -P .. -nc 'http://memtest.org/download/5.01/memtest86+-5.01.zip' 151 | mkdir ../memtest86plus 152 | unzip ../memtest86+-*.zip -d ../memtest86plus 153 | cp ../memtest86plus/*.bin grml-plus/grub/memtest86plus.bin 154 | rm -R ../memtest86plus 155 | fi 156 | 157 | echo "Updating .cfg files." 158 | GRML_ISO= 159 | for i in grml-plus/grml*.iso; do test -f $i && GRML_ISO=`basename $i`; done 160 | if [ -z "$GRML_ISO" ]; then 161 | echo 162 | echo "***********************************************************" 163 | echo "*** WARNING: grml-plus/grml*.iso not found. Your device ***" 164 | echo "*** will probably not be bootable! ***" 165 | echo "***********************************************************" 166 | echo 167 | else 168 | sed "s/%GRML_ISO%/${GRML_ISO}/g" <$DATADIR/grub.cfg \ 169 | >grml-plus/grub/grub.cfg 170 | fi 171 | cp $DATADIR/extras.cfg grml-plus/grub 172 | cp $DATADIR/grml-*.sh grml-plus 173 | 174 | echo "Cleaning up." 175 | cd $DATADIR/.. 176 | umount /tmp/grml-plus/mnt 177 | echo "Done. Enjoy your new grml-plus USB drive or add some extras!" 178 | -------------------------------------------------------------------------------- /sign-uefi-for-secure-boot: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | . data/extra.sh 4 | 5 | mkdir -p efi/boot 6 | 7 | if [ ! -f efi/boot/bootx64.efi -a ! -f efi/boot/protector.efi ]; then 8 | echo "Error: Please run ./add-uefi-support first!" >&2 9 | extra_cleanup 10 | exit 1 11 | fi 12 | 13 | if [ ! -f efi/boot/protector.efi ]; then 14 | mv efi/boot/bootx64.efi efi/boot/protector.efi 15 | fi 16 | 17 | perl $DATADIR/patch-grub-secure-boot.pl efi/boot/grub.efi 18 | 19 | if [ "$1" == "shim" ]; then 20 | 21 | if [ "`dpkg --print-architecture`" != "amd64" ]; then 22 | echo "Error: sbsigntools are only available for grml64!" >&2 23 | extra_cleanup 24 | exit 1 25 | fi 26 | 27 | if [ -f efi/boot/grml-plus-ca.crt -a ! -f efi/boot/grubx64.efi \ 28 | -a ! -f ../certs/GrmlPlus.key ]; then 29 | # oops, we have a certificate, but no signed grub, and no signing key; 30 | # let's delete and re-generate the certificate 31 | rm efi/boot/grml-plus-ca.crt 32 | fi 33 | 34 | if [ ! -f efi/boot/grml-plus-ca.crt ]; then 35 | wget -P .. -nc https://raw.github.com/vathpela/pesign/master/src/certs/make-certs 36 | mkdir -p ../certs 37 | pushd ../certs 38 | bash ../make-certs GrmlPlus grml-plus \ 39 | all codesign 1.3.6.1.4.1.311.10.3.1 40 | popd 41 | cp ../certs/ca.crt efi/boot/grml-plus-ca.crt 42 | openssl x509 -in efi/boot/grml-plus-ca.crt \ 43 | -out efi/boot/grml-plus-ca.der -outform DER 44 | fi 45 | 46 | if [ ! -f efi/boot/grubx64.efi ]; then 47 | wget -P .. -nc http://download.opensuse.org/repositories/home:/jejb1:/UEFI/Debian_7.0/amd64/sbsigntools_0.6-2_amd64.deb 48 | dpkg -i ../sbsigntools_0.6-2_amd64.deb 49 | wget -P .. -nc 'http://github.com/schierlm/grml-plus-uefi-tools/releases/download/v0.2/skipsign.efi' 50 | sbsign --key ../certs/GrmlPlus.key --cert ../certs/GrmlPlus.crt \ 51 | --output efi/boot/grubx64.efi ../skipsign.efi 52 | fi 53 | 54 | if [ ! -f efi/boot/MokManager.efi ]; then 55 | wget -P .. -nc http://www.codon.org.uk/~mjg59/shim-signed/shim-signed-0.2.tgz 56 | tar Cxfvz .. ../shim-signed-0.2.tgz 57 | cp ../shim-signed/MokManager.efi efi/boot 58 | cp ../shim-signed/shim.efi efi/boot/bootx64.efi 59 | rm -R ../shim-signed 60 | fi 61 | 62 | else 63 | if [ ! -f efi/boot/loader.efi ]; then 64 | wget -P .. -nc 'http://github.com/schierlm/grml-plus-uefi-tools/releases/download/v0.2/skipsign.efi' 65 | cp ../skipsign.efi efi/boot/loader.efi 66 | fi 67 | 68 | if [ ! -f efi/boot/hashtool.efi ]; then 69 | wget -P .. -nc http://blog.hansenpartnership.com/wp-uploads/2013/PreLoader.efi 70 | wget -P .. -nc http://blog.hansenpartnership.com/wp-uploads/2013/HashTool.efi 71 | cp ../HashTool.efi efi/boot/hashtool.efi 72 | cp ../PreLoader.efi efi/boot/bootx64.efi 73 | fi 74 | fi 75 | 76 | extra_cleanup 77 | --------------------------------------------------------------------------------