|
| 1 | +## One File Linux |
| 2 | +Live linux distro combined in one EFI file. |
| 3 | + |
| 4 | + |
| 5 | +## Install on Mac |
| 6 | + |
| 7 | +### 1. Mount EFI System Partition |
| 8 | +```mkdir /tmp/efi |
| 9 | +sudo mount -t msdos /tmp/efi /dev/diskN``` |
| 10 | +To find out EFI partition disk number use *diskutil list* |
| 11 | +
|
| 12 | +### 2. Copy OneFileLinux.EFI to EFI Partiotion |
| 13 | +`cp ~/Downloads/OneFileLinux.efi /tmp/efi/` |
| 14 | +
|
| 15 | +
|
| 16 | +### 3. Set NVRAM to boot linux once |
| 17 | +`sudo bless --mount /tmp/efi --setBoot --nextonly --file /tmp/OneFileLinux.efi` |
| 18 | +
|
| 19 | +This command will boot linux only once. Next reboot will return previous boot sequence. |
| 20 | +
|
| 21 | +**!!!** Note that System Integrity Protection (SIP) prohibits to change boot options. |
| 22 | +You can run `bless` from Recover Mode console. Press CMD+R while power on and go to "Utilities —> Terminal" |
| 23 | +
|
| 24 | +## Install on PC |
| 25 | +
|
| 26 | +If your motherboard has UEFI Shell, just choose the path to OneFileLinux.efi on ESP. |
| 27 | +Otherwise add new boot options to NVRAM and choose it from boot menu. |
| 28 | +
|
| 29 | +Example for ThinkPad x220 |
| 30 | +
|
| 31 | +### 1. Copy OneFileLinux.efi to EFI Partition |
| 32 | +
|
| 33 | +### 2. Add NVRAM entry |
| 34 | +`efibootmgr --disk /dev/sda --part 2 --create --label "One File Linux" --loader /OneFileLinux.efi` |
| 35 | +
|
| 36 | +### 3. Choose new entry from boot menu |
| 37 | +Press F12 while power on and choose new boot entry |
| 38 | +
|
| 39 | + |
| 40 | +
|
| 41 | +
|
| 42 | +## Building |
| 43 | +This project is based on vanilla linux kernel `4.16-rc1` |
| 44 | +and Alpine Linux Minimal root filesystem https://alpinelinux.org/downloads/ |
| 45 | +
|
| 46 | +### Download kernel |
| 47 | +
|
| 48 | +`https://git.kernel.org/torvalds/t/linux-4.16-rc1.tar.gz` and extract it to `linux-4.16-rc1` |
| 49 | +This repository contatins `linux-4.16-rc1/.config` file with kernel config. |
| 50 | +
|
| 51 | +### Edit root filesystem |
| 52 | +
|
| 53 | +Chroot into root filesystem |
| 54 | +`chroot ./alpine-minirootfs /bin/as` |
| 55 | +
|
| 56 | +Edit what you need. Install packages with `apk` packet manager. |
| 57 | +
|
| 58 | +### Create cpio file |
| 59 | +
|
| 60 | +`find ./alpine-minirootfs | cpio -H newc -o > ./alpineramfs.cpio` |
| 61 | +
|
| 62 | +### Build kernel |
| 63 | +
|
| 64 | +Edit path to `alpineramfs.cpio` in kernel config |
| 65 | +
|
| 66 | +``` |
| 67 | +$ make menuconfig |
| 68 | + |
| 69 | +General Setup ---> |
| 70 | + Initramfs source file |
| 71 | +``` |
| 72 | +
|
| 73 | +Build kernel |
| 74 | +
|
| 75 | +`make -j4` |
0 commit comments