Testes on RPi Model B
20181205
setup
cd /home/pi
sudo bash
echo Installing all dependencies
apt-get install git rsync gawk busybox bindfs
echo Disabling swap
dphys-swapfile swapoff
dphys-swapfile uninstall
update-rc.d dphys-swapfile disable
systemctl disable dphys-swapfile
echo Cloning repository
git clone https://github.com/josepsanzcamp/root-ro.git
echo Doing the setup
rsync -va root-ro/etc/initramfs-tools/* /etc/initramfs-tools/
mkinitramfs -o /boot/initrd.gz
echo initramfs initrd.gz >> /boot/config.txt
echo Restarting RPI
reboot
これでreadonlyになる
to readonly
sudo sed -i -e "s/^#initramfs initrd.gz$/initramfs initrd.gz/g" /boot/config.txt
reboot
to readwrite
sudo mount -o rw,remount /mnt/boot-ro
sudo sed -i -e "s/^initramfs initrd.gz$/#initramfs initrd.gz/g" /mnt/boot-ro/config.txt
reboot