]> git.sesse.net Git - pistorm/blob - boot_scripts/README.md
Add Meson build files.
[pistorm] / boot_scripts / README.md
1 # PiStorm on Pi Boot
2
3 ## Bootup script
4
5 For your convience a startup script for systemd in Linux is located in this directory. This script will start PiStorm *before* the network connections have started.
6
7 ### Installation
8
9 To start PiStorm on automatically on boot, copy `pistorm.service` into /etc/systemd/system/ in your Pi's filesystem. Then run:
10
11 ```bash
12 sudo systemctl enable pistorm
13 ```
14 ### Customisation
15
16 There are some things you may want to change in the systemd script. These instructions will help with that.
17
18 #### Custom config
19
20 If you wish to boot using a custom configuration file change `ExecStart` to:
21
22 ```ini
23 ExecStart=/home/pi/pistorm/emulator --config-file myconfig.cfg
24 ```
25
26 Where `myconfig.cfg` is your config file in the `pistorm` directory. If your config file is somewhere else you will need to put the full path for it there.
27
28 **NOTE:** do not put an '=' between `--config-file` and the file name, this will not work.
29
30 #### Different location
31
32 You may want to run your PiStorm from a different location than `/home/pi/pistorm` this is fine, but it is important that the files that come with the emulator stay together in the same directory structure. For example, if you moved pistorm to `/opt/pistorm` you will need to change the following two lines:
33
34 ```ini
35 ExecStart=/opt/pistorm/emulator
36 WorkingDirectory=/opt/pistorm
37 ```
38
39 It is important both lines are changed otherwise this can cause issues, particularly crashes.
40
41 #### Startup order
42
43 If, for example, your PiStorm configuration depends on something like Samba running for PiScsi you will want to change the startup order so the PiStorm waits for that to run. In the `[Unit]` second add something like the following example:
44
45 ```ini
46 After=network.target samba.service
47 ```
48
49 Please see the systemd documentation for more informatino on this.
50
51 ### Applying changes
52
53 If you have made any changes to the `pistorm.service` file *after* it has been copied over you will need to reload the systemd configuration for the changes to be seen. This can be done with:
54
55 ```bash
56 sudo systemctl daemon-reload
57 ```
58
59 ## Faster boot
60
61 The Pi does several things that aren't needed for PiStorm at bootup, the following steps will accelerate the boot time for you.
62
63 ### config.txt
64
65 Edit `/boot/config.txt` and add the following lines:
66
67 ```ini
68 # Disable the rainbow splash screen
69 disable_splash=1
70
71 # Set the bootloader delay to 0 seconds. The default is 1s if not specified.
72 boot_delay=0
73
74 # Disable Bluetooth
75 dtoverlay=disable-bt
76 ```
77
78 By default there is a 1 second boot delay and initialising bluetooth takes a couple of seconds.
79
80 ### cmdline.txt
81
82 Edit the `/boot/cmdline.txt` and add `quiet` near the end, as an example (do **NOT** copy/paste this line):
83
84 ```
85 console=serial0,115200 console=tty1 root=PARTUUID=5f1219ae-02 rootfstype=ext4 elevator=deadline fsck.repair=yes quiet rootwait
86 ```
87
88 This shaves a little time off spitting out boot logs to the screen.
89
90 ### fstab
91
92 Disable `/boot` remount on boot, this will mean you will need to do `sudo mount /boot` when you want to change files in that partition, but it shaves off half a second from boot. To do this add `noauto` to the options second for the `/boot` line, for example (do **NOT** copy/paste this line):
93
94 ```
95 PARTUUID=5f1219ae-01  /boot           vfat    defaults,noauto          0       2
96 ```
97
98 ### Disable swap
99
100 If we need swap something went wrong. This shaves about another second off the boot time:
101
102 ```bash
103 sudo systemctl disable dphys-swapfile.service
104 ```