Skip to content

Commit e749fb7

Browse files
committed
Merge branch 'master' of github.com:zhovner/OneFileLinux
2 parents 6b56e21 + b88300e commit e749fb7

File tree

1 file changed

+105
-46
lines changed

1 file changed

+105
-46
lines changed

README.md

+105-46
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,136 @@
11
## One File Linux
2-
<img width=700 alt="One File Linux" src="https://habrastorage.org/webt/yo/oo/1e/yooo1e0i2u4frjrlhnmtqifmpsy.png" />
2+
Live linux distro combined in one ~20MB file. Runs on any UEFI computer (PC or Mac) without installation. Just copy one file to EFI system partition and boot.
33

4-
Live linux distro combined in one EFI file.
4+
<img width=600 alt="One File Linux" src="https://hub.zhovner.com/img/one-file-linux.png" />
55

6-
Download here https://github.com/zhovner/OneFileLinux/releases
6+
**Download:** https://github.com/zhovner/OneFileLinux/releases
77

8-
More information in russian https://habrahabr.ru/post/349758/
8+
About in russian: https://habrahabr.ru/post/349758/
9+
### Main advantages
910

10-
## Install on Mac
11+
* **No installation required** — no need to create additional paritions. Just copy one file to EFI system partition and add new boot entry to NVRAM.
12+
13+
* **No USB flash needed** — once copied to EFI partition, OneFileLinux can boot any time from system disk.
14+
15+
* **No Boot Manager required (GRUB, rEFInd)** — boots directly by UEFI firmware, no additional software needed.
16+
17+
* **Doesn't change the boot sequence** — can boot only once, next reboot will return default settings.
18+
19+
* **Compatible with disk encryption** — works with macOS FileVault and dm-crypt. Because EFI system parition is not encrypted.
1120

12-
### 1. Mount EFI System Partition
13-
```
14-
diskutil mount disk_NUMBER
15-
```
16-
To find out EFI partition disk number use `diskutil list`
17-
<img src="https://habrastorage.org/webt/_y/h2/j5/_yh2j5hz9dqthcegf5sebnmxmui.png" width="500">
21+
### Why?
1822

19-
The command is as follows in my case:
20-
```
21-
diskutil mount disk0s1
22-
```
23+
This can be useful when you need Linux on bare metal and can't use USB flash. In comparison with Live USB flash, one file Linux setups permanently in EFI partition and can boot any time later.
24+
My personal goal is to use laptop's internal PCIe WiFi card for cracking WiFi with <b>aircrack-ng</b> and <b>reaver</b> software, since PCIe devices can't be forwarded into virtual machine.
2325

24-
### 2. Copy OneFileLinux.EFI to EFI Partiotion
25-
`cp ~/Downloads/OneFileLinux.efi /Volumes/EFI`
26+
27+
## Run on Macbook
2628

29+
#### 1. Download OneFileLinux.efi from link above.
30+
31+
2732

28-
### 3. Set NVRAM to boot linux once
29-
`sudo bless --mount /Volumes/EFI --setBoot --nextonly --file /Volumes/EFI/OneFileLinux.efi`
33+
#### 2. Mount EFI System Partition
3034

31-
This command will boot linux only once. Next reboot will return previous boot sequence.
35+
`diskutil mount diskN`
3236

33-
**!!!** Note that System Integrity Protection (SIP) prohibits to change boot options.
34-
You can run `bless` from Recover Mode console. Press CMD+R while power on and go to "Utilities —> Terminal"
37+
where diskN is your EFI disk number.
38+
To find your EFI disk number use `diskutil list` command.
39+
40+
<img width="500" alt="macOS diskutil list EFI partition" src="https://hub.zhovner.com/img/diskutil-list-efi.png" />
3541

36-
## Install on PC
42+
For me it will be: `diskutil mount disk0s1`
3743

38-
If your motherboard has UEFI Shell, just choose the path to OneFileLinux.efi on ESP.
39-
Otherwise add new boot options to NVRAM and choose it from boot menu.
44+
45+
46+
47+
#### 3. Copy OneFileLinux.efi to EFI partition
48+
49+
`cp ~/Downloads/OneFileLinux.efi /Volumes/EFI/`
4050

41-
Example for ThinkPad x220
51+
52+
53+
#### 4. Set boot option in NVRAM
4254

43-
### 1. Copy OneFileLinux.efi to EFI Partition
55+
On macOS since El Capitan enabled by default SIP (System Integrity Protection) prohibits to change boot options.
56+
To check SIP state run `csrutil status`. In normal situation it should be enabled.
57+
58+
If SIP is enabled you can run `bless` only from Recovery console, otherwise it returns error.
59+
To boot in Recovery mode press <b>CMD+R</b> while boot and go to **_Utilities —> Terminal_** from top menu.
60+
In recovery console follow steps 2 and 4 every time you need to boot OneFileLinux.
4461

45-
### 2. Add NVRAM entry
62+
`bless --mount /Volumes/EFI --setBoot --nextonly --file /Volumes/EFI/OneFileLinux.efi`
63+
64+
65+
This command sets NVRAM option to boot OneFileLinux.efi only once. Next reboot will return default boot order.
66+
67+
68+
69+
### 5. Reboot
70+
71+
Reboot to run OneFileLinux. Once you've done, type `reboot` in Linux console and go back to macOS.
72+
Every time when you need it again, follow steps 2 and 4 from recovery console.
73+
74+
75+
76+
## Run on PC
77+
There are few ways how to run OneFileLinux on PC motherboard. Some motherboards have builtin UEFI Shell that can run any efi binary from console.
78+
I will describe setup process for my old ThinkPad X220 that doesn't have UEFI shell.
79+
80+
#### 1. Copy OneFileLinux.efi to EFI partition
81+
82+
If you use Windows 10 installed in EFI mode, you have EFI system partition 100 MB in size.
83+
You need to find out how to mount by itself. You can do this with OneFileLinux.efi run from USB flash or any other linux distro.
84+
85+
86+
#### 2. Add NVRAM boot option
87+
88+
I can't find out how to do this in Windows, so you probably need Linux for this.
89+
Replace `/dev/sda` to you disk path and `--part 2` to your EFI partition number.
90+
4691
`efibootmgr --disk /dev/sda --part 2 --create --label "One File Linux" --loader /OneFileLinux.efi`
4792

48-
### 3. Choose new entry from boot menu
49-
Press F12 while power on and choose new boot entry
93+
#### 3. Choose One File Linux from boot menu
94+
95+
On my ThinkPad X220 I press F12 while power on to open boot menu. Hotkey depends on your motherboard.
96+
97+
<img alt="ThinkPad X220 boot menu" width="600" src="https://hub.zhovner.com/img/thinkpad-x220-boot-menu.png" />
98+
99+
100+
101+
## Run from USB flash
102+
The only benefit from running OneFileLinux from USB flash, is that no additional software is required to create bootable flash drive.
103+
Just format flash drive as FAT32 in GPT scheme and copy OneFileLinux.efi to default path:
104+
105+
`\EFI\BOOT\BOOTx64.EFI`
50106

51-
![Thinkpad x220 boot menu](https://habrastorage.org/webt/wv/6f/tm/wv6ftmykf6wncgtkzx7chiiz-cm.png)
52107

108+
#### Format in GPT scheme in Windows
53109

54-
## Building
55-
This project is based on vanilla linux kernel `4.16-rc1`
56-
and Alpine Linux Minimal root filesystem https://alpinelinux.org/downloads/
110+
Windows does not allow to format flash drive in GPT scheme from GUI, so you need to use command line tool.
111+
1. Open `cmd.exe` as administrtor
112+
2. Type`diskpart`
113+
3. `list disk` to see all disks
114+
4. `select disk <disknumber>`
115+
5. `clean` do delete parition table
116+
6. `convert gpt` to convert disk in GPT scheme
117+
7. `exit`
57118

58-
### Download kernel
119+
Then format drive from `diskmgmt.msc` in FAT32.
59120

60-
`https://git.kernel.org/torvalds/t/linux-4.16-rc1.tar.gz` and extract it to `linux-4.16-rc1`
61-
This repository contatins `linux-4.16-rc1/.config` file with kernel config.
62121

63-
### Edit root filesystem
64122

65-
Chroot into root filesystem
66-
`chroot ./alpine-minirootfs /bin/ash`
123+
## Build your own
67124

68-
Edit what you need. Install packages with `apk` packet manager.
125+
You can build your own version of One File Linux.
126+
It based on Alpine Linux and vanilla kernel.
69127

128+
1. Clone repositry
129+
`git clone https://github.com/zhovner/OneFileLinux`
70130

71-
### Build
131+
2. Make changes in root filesystem and kernel
132+
`chroot alpine-minirootfs /bin/ash`
72133

73-
Run bulding script
74-
```
75-
./build.sh
76-
```
134+
3. Build
135+
`./build.sh`
77136

0 commit comments

Comments
 (0)