Table of Contents |
---|
Inspiration from hiroom2.com. Kudos!
...
Download a ready made rootfs from the Open Build Service.
We will use openSUSE Tumbleweed on our RPi 3B+:
the latestopenSUSE-Tumbleweed-ARM-JeOS.aarch64-rootfs
tar.xz fileExtract the downloaded rootfs
$ cd /tmp $ mkdir openSUSE_Tumbleweed $ xz -d /tmp/openSUSE-Tumbleweed-ARM-JeOS.aarch64-rootfs.aarch64-2020.05.10-Snapshot20200512Snapshot20200526.tar.xz
$ cd openSUSE_Tumbleweed $ tar xvf /tmp/openSUSE-Tumbleweed-ARM-JeOS.aarch64-rootfs.aarch64-2020.05.10-Snapshot20200512Snapshot20200526.tar.xz
Create a virtual loop back device that will hold the rootfs:
$ cd /tmp $ dd if=/dev/zero of=07f32691-opensuse-rootfs.img bs=400M count=10 $ sudo mkfs.ext4 07f32691-opensuse-rootfs.img $ sudo losetup -fP 07f32691-opensuse-rootfs.img
Check which loopback devices are allocated by the kernel:
$ losetup -a /dev/loop0: []: (/tmp/07f32691-opensuse-rootfs.img)
Mount the virtual block device
$ mkdir 07f32691-rootfs-mount $ sudo mount -o loop /dev/loop0 07f32691-rootfs-mount
Copy the content of an existing rootfs image to the mounted block device
$ cp -R /tmp/downloaded_rootfs/* 07f32691-rootfs-mount/
Unmount the file and move it to the place where it will be served.
$ sudo umount 07f32691-rootfs-mount $ sudo losetup -D $ sudo mkdir /srv/iscsi $ sudo mv 07f32691-opensuse-rootfs.img /srv/iscsi
Prepare the iscsi target and publish it
$ sudo tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.org.micromec:rpi3-1-opensuse-rootfs $ sudo tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /srv/iscsi/07f32691-opensuse-rootfs.img $ sudo tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
Note
If your iscsi server has other targets then you will need to pick a different tid.
At this point the rootfs is available on the local network.
Save the configuration on the netboot server to remain persistent
$ sudo tgt-admin --dump | sudo tee /etc/tgt/conf.d/micromec-cluster.conf
...