Run ./deploy.sh
after cloning to automatically deploy buildroot for RPI CM4 with U-Boot.
If you need to install the TFTP server, run ./install_tftp.sh
.
If you need to install the NFS server, run ./install_nfs.sh
.
The following procedure must be run from the Buildroot root directory if nothing different is specified.
The following steps are to install the NFS server on the host :
sudo apt install nfs-kernel-server
sudo mkdir /srv/nfs
sudo chown -R $USER /srv/nfs/
sudo nano /etc/exports
- Add
/srv/nfs 192.168.10.0/24(rw,root_squash,sync,no_subtree_check)
- Add
sudo service nfs-kernel-server reload
showmount -e
The following steps are to install the NFS client on the target (the current Buildroot distro already contains these elements, this is only for indication purpose) :
mkdir -p board/raspberrypicm4io/rootfs_overlay/media/nfs
mkdir -p board/raspberrypicm4io/rootfs_overlay/etc
touch board/raspberrypicm4io/rootfs_overlay/etc/fstab
- On CM4 :
cat /etc/fstab and copy to board/raspberrypicm4io/rootfs_overlay/etc/fstab
- Add
192.168.10.2:/srv/nfs /media/nfs nfs soft,timeo=5,rsize=8192,wsize=8192 0 0
to this file
- On CM4 :
- Auto mount during start may fail because network is not ready, so create script to mount manually from user-space.
mkdir board/raspberrypicm4io/rootfs_overlay/root/
touch board/raspberrypicm4io/rootfs_overlay/root/nfs_mount.sh
echo -p "mount -t nfs 192.168.10.2:/srv/nfs /media/nfs/" > board/raspberrypicm4io/rootfs_overlay/root/nfs_mount.sh
chmod +x board/raspberrypicm4io/rootfs_overlay/root/nfs_mount.sh
make linux-menuconfig
: > File systems > Network File Systems- NFS client support for NFS version 4 : yes
- Provide swap over NFS support : yes
- Enable dropbear : make menuconfig → Target packages → Networking applications → Dropbear
- Add a password to root user if there is no : make menuconfig → System configuration → Enable root login with password [y] → Root password
- It is required to login with the following option because every time the kernel is rebuilt, the SSH footrpint is changed :
ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" root@192.168.10.3
- The default password for
root
user of the current image is1
If you want to permanently add content or override files/folders within the rootfs, you can place the content to board/raspberrypicm4io/rootfs_overlay/
.
Unfortunately, Buildroot does not natively support to remove an installed target package from the target rootfs. When you disable a package in the menuconfig, the binaries are not removed from the final target rootfs.
To clean the target rootfs, you can run ./clean_target_packages.sh
and run make
to regenerate the filesystem.