-
Notifications
You must be signed in to change notification settings - Fork 0
Home
This repository contains everything you need in order to network mount a linux OS for a raspberry pi.
This repository already contains the OS, hence usually nothing to be done here.
However, in case you want to make this from scratch, download the image of the OS you want to use (e.g., latest Raspbian OS).
Assuming the image is called netboot-os.img
First, as OS images contain disk setups, we need to find out the corresponding loop devices:
sudo losetup -Pf netboot-os.img --show
This returns something like: /dev/loop<i>
, e.g., let's use /dev/loop9
here
The first partition of that device is the boot partition, the second is the OS itself. With this information, we can mount it:
mkdir ~/os
mkdir -p ~/boot/firmware
sudo mount /dev/loop9p2 os
sudo mount /dev/loop9p1 boot/firmware
In order to replace the OS stored in this repository, first we need to delete the old OS, e.g., by deleting all directories.
Assuming you cloned this repository to ~/gripper-pi-img
, a useful find command for that is (no copy-and-paste ready command to delete all directories will be provided here, if you perform these kind of operations, you should know what to do):
find . -maxdepth 1 -not -path '*/.*' -type d
Afterwards, copy the mounted os over:
sudo cp -r ~/os/* ~/gripper-pi-img/
sudo cp -r ~/boot ~/gripper-pi-img/
In order to use network booting, the content of the ~/gripper-pi-img/boot/firmware/cmdline.txt
should be something like this (where of course the nfsroot needs to point to the address of the netboot provider:
selinux=0 dwc_otg.lpm_enable=0 console=tty1 rootwait rw nfsroot=192.168.0.12:/rpi ip=dhcp root=/dev/nfs systemd.log_level=info systemd.log_target=console systemd.debug-shell=1
The content of ~/gripper-pi-img/etc/fstab
likewise needs to point to the nfs provider
proc /proc proc defaults 0 0
192.168.0.12:/rpi / nfs defaults,noatime 0 1
Run the get-permissions.sh script as your regular user (NOT AS ROOT):
./get-permissions.sh
Try to add the OS to the git worktree and check if it complains, if yes -> run the permission fixer script (NOT AS ROOT):
./fix-permissions.sh
Then you are ready to commit and push your changes.
Clone this repository on the host that should provide the OS for network booting the raspberry and then run the apply-permissions.sh
script (NOT AS ROOT):
./apply-permissions.sh