Skip to content

Commit

Permalink
Pi installer tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
10yard committed Jul 27, 2022
1 parent 4cc6bea commit 97dd65a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 40 deletions.
1 change: 0 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ sudo cp roms/---* dist/roms
sudo mkdir dist/dkwolf
sudo cp dkwolf/dkwolfrpi dist/dkwolf
sudo cp -r dkwolf/*.txt dist/dkwolf
sudo cp -r dkwolf/*.md dist/dkwolf
sudo cp -r dkwolf/plugins dist/dkwolf
sudo cp -r dkwolf/changes dist/dkwolf

Expand Down
44 changes: 12 additions & 32 deletions rpi4/dkafe_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,29 +103,9 @@ def main():
with open(AUTOSTART_FILE, "a") as f:
f.write("@/home/pi/dkafe_bin/dkafe_start.sh\n")

if os.path.exists(CMDLINE_FILE) and not os.path.exists(CMDLINE_FILE_BU):
os.system(f"sudo cp {CMDLINE_FILE} {CMDLINE_FILE_BU}")
if os.path.exists(CMDLINE_FILE_BU):
# 3) Hide startup messages
answer = yesno("Hide system startup messages")
if answer:
# update /boot/cmdline.txt
with open(CMDLINE_FILE, "w") as f_out:
with open(CMDLINE_FILE_BU, "r") as f_in:
cmd = f_in.readline()
cmd = cmd.replace("loglevel=3", "loglevel=0")
cmd = cmd.replace("console=tty1", "console=tty3")
if " logo.nologo" not in cmd:
cmd = "logo.nologo " + cmd
if " quiet" not in cmd:
cmd = "quiet " + cmd
if " vt.global_cursor_default=0" not in cmd:
cmd = "vt.global_cursor_default=0 " + cmd
f_out.write(cmd)
# ----
os.system(f"sudo cp {AUTOSTART_FILE} {AUTOSTART_FILE_BU2}")
if os.path.exists(AUTOSTART_FILE_BU2):
# 4) Hide the Raspberry Pi taskbar
# 3) Hide the Raspberry Pi taskbar
answer = yesno("Hide the Pi taskbar")
if answer:
changes_made = True
Expand All @@ -138,7 +118,7 @@ def main():
else:
f_out.write(line)

# 5) Hide the Raspberry Pi Desktop (Icon, background and welcome image)
# 4) Hide the Raspberry Pi Desktop (Icon, background and welcome image)
if os.path.exists(PCMAN_CONFIG_FILE) and not os.path.exists(PCMAN_CONFIG_FILE_BU):
os.system(f"sudo cp {PCMAN_CONFIG_FILE} {PCMAN_CONFIG_FILE_BU}")
if os.path.exists(PCMAN_CONFIG_FILE_BU):
Expand All @@ -162,7 +142,7 @@ def main():
else:
f_out.write(line)

# 6) Hide the Raspberry Pi mouse cursor
# 5) Hide the Raspberry Pi mouse cursor
if os.path.exists(DESKTOP_CONFIG_FILE) and not os.path.exists(DESKTOP_CONFIG_FILE_BU):
os.system(f"sudo cp {DESKTOP_CONFIG_FILE} {DESKTOP_CONFIG_FILE_BU}")
if os.path.exists(DESKTOP_CONFIG_FILE_BU):
Expand All @@ -173,7 +153,7 @@ def main():
with open(DESKTOP_CONFIG_FILE, "a") as f:
f.write("xserver-command=X -nocursor\n")

# 7) Use headphone jack for audio
# 6) Use headphone jack for audio
answer = yesno("Use headphone jack for audio")
if answer:
changes_made = True
Expand All @@ -182,8 +162,8 @@ def main():
if os.path.exists(CONFIG_FILE) and not os.path.exists(CONFIG_FILE_BU):
os.system(f"sudo cp {CONFIG_FILE} {CONFIG_FILE_BU}")
if os.path.exists(CONFIG_FILE_BU):
# 8) Optimise framebuffer size (recommended for HDMI output)
answer = yesno("Optimise framebuffer (recommended for HDMI output)")
# 7) Optimise framebuffer (recommended for HDMI output)
answer = yesno("Optimise framebuffer (recommend for HDMI and VGA displays)")
if answer:
changes_made = True
with open(CONFIG_FILE, "w") as f_out:
Expand All @@ -195,7 +175,7 @@ def main():
f_out.write("framebuffer_height=512\n")
else:
f_out.write(line)
# 9) Force 640x480 mode on boot
# 8) Force 640x480 mode on boot
answer = yesno("Force 640x480 mode on boot (for scan line generators)")
if answer:
changes_made = True
Expand All @@ -210,18 +190,18 @@ def main():
f_out.write("hdmi_mode=4\n")
else:
f_out.write(line)
# 10) Map GPIO to keyboard input controls
answer = yesno("Map GPIO to keyboard input controls ?")
# 9) Map GPIO to keyboard input controls
answer = yesno("Map GPIO to keyboard input (for arcade controls)")
if answer:
changes_made = True
# update /boot/config.txt
with open(CONFIG_FILE, "a") as f_out:
f_out.write(GPIO_MAPPING)


# 11) Disable non-essential services
# 10) Disable non-essential services
# and
# 12) Disable networking services
# 11) Disable networking services
answer = yesno("Disable non-essential services")
if answer:
changes_made = True
Expand All @@ -244,7 +224,7 @@ def main():
os.system("sudo systemctl disable ssh.service --quiet")
os.system("sudo systemctl disable wpa_supplicant.service --quiet")

# 13) Reboot system
# 12) Reboot system
answer = yesno("Reboot now")
if answer:
os.system("reboot")
Expand Down
15 changes: 8 additions & 7 deletions rpi4/preparing_release.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ Pi4 build and release notes
---------------------------

Insert master SD card (can be created from latest image) and boot to Pi OS Desktop
Press CTRL-ALT-T to start terminal

Abort out of the automated install - if it starts
Press CTRL-ALT-T to start terminal, or use SSH to remotely connect to user: "pi", password "dkafe".

$ ls
There may be an existing installed "dkafe_bin" folder.
This will be removed automatically by the build script.
There may be existing "dkafe_bin" folders at /boot/dkafe_bin and /home/pi/dkafe_bin
These will be automatically removed by the build script.

$ git clone https://github.com/10yard/dkafe.git
Should create a "dkafe" folder containing the sources
Expand All @@ -28,19 +28,20 @@ If all OK we can now remove the sources
$ sudo rm -r /home/pi/dkafe

Now we're ready to make an SD card image.
Insert USB stick - this will be target for the SD card image. Recommend minimum 8GB USB stick.
Insert an empty USB stick - this will be target for the SD card image. Recommend minimum 8GB USB stick.

$ lsblk
We can see the USB drive size and mountpoint. The mounpoint is used in command below i.e. /media/pi/USB
We can see the USB drive size and mountpoint. Assuming the drive is named "USB"
The mountpoint used in commands below is /media/pi/USB

$ sudo dd if=/dev/mmcblk0 of=/media/pi/USB/dkafe_sdcard.img bs=1M
This will make image of the SD Card (mmcblk0) and save to USB stick. It will take a while.
This will make an image of the SD Card (mmcblk0) and save to USB stick. It will take a while.

$ cd /media/pi/USB
$ sudo pishrink.sh -z dkafe_sdcard.img
This will shrink the image and package into .gz file. It will take a while.

$ ls -l /media/pi/USB
$ ls -l
Job done.

Remove USB stick and transfer over to another computer.

0 comments on commit 97dd65a

Please sign in to comment.