Skip to content

7. Install CD berry services

Frank1119 edited this page Apr 29, 2019 · 5 revisions

Getting and copying the sources

Preparation

You must be logged on to your Raspberry Pi.

Getting all sources

Execute the next command:

wget https://github.com/frank1119/CD-berry/archive/master.zip
unzip master.zip

Install the services and other files

Execute the next commands:

sudo cp CD-berry-master/sources/Manual\ CD-berry.pdf /usr/local/bin
sudo cp CD-berry-master/sources/cdromsvc.py /usr/local/bin
sudo cp CD-berry-master/sources/cdromsvc.service /lib/systemd/system/
sudo cp CD-berry-master/sources/config.txt /boot
sudo cp CD-berry-master/sources/service_lib.sh /usr/local/bin
dtc -I dts -O dtb -o bootconfig.dtbo CD-berry-master/sources/bootconfig-overlay.dts
sudo cp bootconfig.dtbo /boot/overlays
sudo chmod +x /usr/local/bin/cdromsvc.py
sudo chmod +x /usr/local/bin/service_lib.sh
sudo systemctl daemon-reload
sudo systemctl enable cdromsvc.service

Some extra tweaks:

sudo echo "tmpfs /var/log tmpfs size=4M,mode=0755 0 0" >> /etc/fstab
sudo "blacklist dwc2" >> /etc/modprobe.d/raspi-blacklist.conf

Sealing your Raspberry Pi

When you perform this next command, then after rebooting, the network will not be started. Instead a USB storage device will occur (with the lable 'CD-berry').

sudo sed -i "s/modules-load=dwc2,g_ether/fastboot noswap ro/" /boot/cmdline.txt

Setting up an escape

If you want to get the network up again perform the following steps:

  1. Shutdown your CD-berry (see the manual)
  2. Remove the SD card and insert it in your computer. Three drives will occur. The first one is usually the boot partition
  3. Open config.txt from the boot partition with a suitable editor (e.g. Notepad++)
  4. At the top of the file you will find the following lines:
    [gpio5=0]
    #dtoverlay=bootconfig,bootvalue=ethernet;192.168.137.22;255.255.255.0
    dtoverlay=bootconfig,bootvalue=emergency
    gpio=19=op,dh
    
  5. Remove the hash (#) from the first dtoverlay=bootconfig...
  6. Place a hash in front of the second dtoverlay=bootconfig... After that it looks like this:
    [gpio5=0]
    dtoverlay=bootconfig,bootvalue=ethernet;192.168.137.22;255.255.255.0
    #dtoverlay=bootconfig,bootvalue=emergency
    gpio=19=op,dh
    
  7. Save the file
  8. Eject the SD card from your computer (safely!). Then remove it from your computer. Insert the SD card into your Raspberry Pi
  9. When rebooting hold the button for about 5 seconds. The emergency led will be lit
  10. When the emergency led has switched off, you should be able to connect to the Raspberry Pi with Putty. Its address should be 192.168.137.22

Of course you can also edit /boot/config.txt before rebooting your Raspberry Pi and loosing connection to it

Revert to 'normal operation'

To do this, just revert the changes you made in the file /boot/config.txt (as outlined in the section above).