From 40f8889bcf3b48e37caf41ac50e80f0df4d5c0d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20DONATH-ILIC?= <129596282+leodonathilic@users.noreply.github.com> Date: Mon, 22 May 2023 08:59:48 +0200 Subject: [PATCH 1/8] Update setup_with_proot.md --- doc/setup_with_proot.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/setup_with_proot.md b/doc/setup_with_proot.md index 5337a45..cc58b40 100644 --- a/doc/setup_with_proot.md +++ b/doc/setup_with_proot.md @@ -5,7 +5,7 @@ There is always a prebuilt image available for download and installation as described in the [README](../README.md). If you'd like to build the project yourself, there are several steps involved: -* Downloading a generic Raspbian Lite image +* Downloading a generic RaspiOS Lite image * Resizing the image and partition * Downloading and building the dependencies * Modifying the image configuration @@ -28,13 +28,13 @@ Preparation ``` * Install qemu, qemu-user-static, and proot if not already installed: ``` - apt-get install qemu qemu-user-static qemu-user proot + apt-get install qemu qemu-user-static qemu-user proot xz-utils ``` Download the Raspbian image ============================== -* Get the most recent version of Raspbian Jessie Lite from https://downloads.raspberrypi.org/raspbian_lite/images/: +* Get the most recent version of RaspiOS Lite from [here.](https://downloads.raspberrypi.org/raspios_lite_armhf/images/): ``` wget https://downloads.raspberrypi.org/raspbian_lite_latest From 644df64c303434f74495554567858b09d4c93230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20DONATH-ILIC?= <129596282+leodonathilic@users.noreply.github.com> Date: Mon, 22 May 2023 09:18:44 +0200 Subject: [PATCH 2/8] Update setup_with_proot.md --- doc/setup_with_proot.md | 52 +++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/doc/setup_with_proot.md b/doc/setup_with_proot.md index cc58b40..2035c7b 100644 --- a/doc/setup_with_proot.md +++ b/doc/setup_with_proot.md @@ -34,7 +34,7 @@ Preparation Download the Raspbian image ============================== -* Get the most recent version of RaspiOS Lite from [here.](https://downloads.raspberrypi.org/raspios_lite_armhf/images/): +* Get the most recent version of RaspiOS Lite from [here](https://downloads.raspberrypi.org/raspios_lite_armhf/images/): ``` wget https://downloads.raspberrypi.org/raspbian_lite_latest @@ -45,7 +45,7 @@ Download the Raspbian image ``` * Unpack it: ``` - unzip XXXX-XX-XX-raspbian-buster-lite.zip + unxz XXXX-XX-XX-raspios-bullseye-armhf-lite.img.xz ``` Add space to the image @@ -54,38 +54,40 @@ Add space to the image * Use dd to add 2GB (2048 blocks of 1024k each). Using /dev/zero as the input file yields an unlimited number of "0x00" bytes. ``` - > dd if=/dev/zero bs=1024k count=2048 >> XXXX-XX-XX-raspbian-jessie-lite.img + dd if=/dev/zero bs=1024k count=2048 >> XXXX-XX-XX-raspios-bullseye-armhf-lite.img ``` * Expand the root (second) partition using sfdisk: -``` - > echo ", +" | sfdisk -N 2 XXXX-XX-XX-raspbian-jessie-lite.img - Checking that no-one is using this disk right now ... OK +``` + echo ", +" | sfdisk -N 2 2023-05-03-raspios-bullseye-armhf-lite.img + +Checking that no-one is using this disk right now ... OK + +Disk 2023-05-03-raspios-bullseye-armhf-lite.img: 3.83 GiB, 4114612224 bytes, 8036352 sectors +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +Disklabel type: dos +Disk identifier: 0x4c4e106f - Disk 2017-11-29-raspbian-stretch-lite.img: 3.7 GiB, 4005560320 bytes, 7823360 sectors - Units: sectors of 1 * 512 = 512 bytes - Sector size (logical/physical): 512 bytes / 512 bytes - I/O size (minimum/optimal): 512 bytes / 512 bytes - Disklabel type: dos - Disk identifier: 0x37665771 +Old situation: - Old situation: +Device Boot Start End Sectors Size Id Type +2023-05-03-raspios-bullseye-armhf-lite.img1 8192 532479 524288 256M c W95 FAT32 (LBA) +2023-05-03-raspios-bullseye-armhf-lite.img2 532480 8036351 7503872 3.6G 83 Linux - Device Boot Start End Sectors Size Id Type - 2017-11-29-raspbian-stretch-lite.img1 8192 93236 85045 41.5M c W95 FAT32 (LBA) - 2017-11-29-raspbian-stretch-lite.img2 94208 3629055 3534848 1.7G 83 Linux +2023-05-03-raspios-bullseye-armhf-lite.img2: +New situation: +Disklabel type: dos +Disk identifier: 0x4c4e106f - 2017-11-29-raspbian-stretch-lite.img2: - New situation: - Disklabel type: dos - Disk identifier: 0x37665771 +Device Boot Start End Sectors Size Id Type +2023-05-03-raspios-bullseye-armhf-lite.img1 8192 532479 524288 256M c W95 FAT32 (LBA) +2023-05-03-raspios-bullseye-armhf-lite.img2 532480 8036351 7503872 3.6G 83 Linux - Device Boot Start End Sectors Size Id Type - 2017-11-29-raspbian-stretch-lite.img1 8192 93236 85045 41.5M c W95 FAT32 (LBA) - 2017-11-29-raspbian-stretch-lite.img2 94208 7823359 7729152 3.7G 83 Linux +The partition table has been altered. +Syncing disks. - The partition table has been altered. - Syncing disks. ``` * Edit `shell_utils/basic_mount_image.sh` to use the correct image path ($IMAGE) From bfa2e05f3803f66e1c435f976f3494334128eb44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20DONATH-ILIC?= <129596282+leodonathilic@users.noreply.github.com> Date: Mon, 22 May 2023 09:19:21 +0200 Subject: [PATCH 3/8] Update setup_with_proot.md --- doc/setup_with_proot.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/setup_with_proot.md b/doc/setup_with_proot.md index 2035c7b..c25d188 100644 --- a/doc/setup_with_proot.md +++ b/doc/setup_with_proot.md @@ -59,7 +59,7 @@ file yields an unlimited number of "0x00" bytes. * Expand the root (second) partition using sfdisk: ``` - echo ", +" | sfdisk -N 2 2023-05-03-raspios-bullseye-armhf-lite.img + echo ", +" | sfdisk -N 2 XXXX-XX-XX-raspios-bullseye-armhf-lite.img Checking that no-one is using this disk right now ... OK From 06d261fe513c3ed1c5629da43851433c82e26ee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20DONATH-ILIC?= <129596282+leodonathilic@users.noreply.github.com> Date: Mon, 22 May 2023 09:19:41 +0200 Subject: [PATCH 4/8] Update setup_with_proot.md --- doc/setup_with_proot.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/setup_with_proot.md b/doc/setup_with_proot.md index c25d188..9856748 100644 --- a/doc/setup_with_proot.md +++ b/doc/setup_with_proot.md @@ -74,7 +74,7 @@ Old situation: Device Boot Start End Sectors Size Id Type 2023-05-03-raspios-bullseye-armhf-lite.img1 8192 532479 524288 256M c W95 FAT32 (LBA) -2023-05-03-raspios-bullseye-armhf-lite.img2 532480 8036351 7503872 3.6G 83 Linux +2023-05-03-raspios-bullseye-armhf-lite.img2 532480 8036351 7503872 1.6G 83 Linux 2023-05-03-raspios-bullseye-armhf-lite.img2: New situation: From 8e004f3b23815ce315ef16f23a829a73e44df51f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20DONATH-ILIC?= <129596282+leodonathilic@users.noreply.github.com> Date: Mon, 22 May 2023 17:00:33 +0200 Subject: [PATCH 5/8] Update setup_with_proot.md --- doc/setup_with_proot.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/setup_with_proot.md b/doc/setup_with_proot.md index 9856748..78fa30d 100644 --- a/doc/setup_with_proot.md +++ b/doc/setup_with_proot.md @@ -163,7 +163,7 @@ verify that these dependencies are current by checking in the PyCIRCLean git rep cd /home/pi git clone https://github.com/CIRCL/PyCIRCLean.git cd PyCIRCLean - pip3 install -r requirements.txt + #pip3 install -r requirements.txt ``` * Create a new user named "kitten": ``` From 955c8b57c97a0338932933f66a79ab898d337019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20DONATH-ILIC?= <129596282+leodonathilic@users.noreply.github.com> Date: Wed, 24 May 2023 11:02:55 +0200 Subject: [PATCH 6/8] Add files via upload --- shell_utils/basic_mount_image.sh | 48 +++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/shell_utils/basic_mount_image.sh b/shell_utils/basic_mount_image.sh index 68ab659..ab6ceb0 100755 --- a/shell_utils/basic_mount_image.sh +++ b/shell_utils/basic_mount_image.sh @@ -1,9 +1,14 @@ #!/bin/bash + +# Last update 16/05/2023 (dd/mm/yyyy) by Léo DONATH-ILIC + # This script will mount a given image in loop mode. # Make sure to change the path and offsets for the image you use. You can get # the correct offsets using `file $PATH_TO_IMAGE` or fdisk. + + # To make debugging easier echo "KittenGroomer: in mount_image.sh" 1>&2 @@ -13,29 +18,49 @@ if [ "$(id -u)" != "0" ]; then fi set -e -set -x +#set -x # Double check the path and offsets as noted above! # Path to the image -IMAGE='2019-09-26-raspbian-buster-lite.img' +IMAGE='/home/leo/Downloads/2023-05-03-raspios-bullseye-arm64-lite.img' + + +######################### NEW ######################### # Start sector of boot (first) partition -BOOT_START=`sfdisk -J ${IMAGE} | grep img1 | sed -n 's/.*"start":*\([[:digit:]]*\).*/\1/p'` +BOOT_START=`sfdisk -J ${IMAGE} | grep -m 1 start | sed 's/"start":\|"\|,//g'` # Amount of sectors of boot (first) partition -BOOT_SIZE=`sfdisk -J ${IMAGE} | grep img1 | sed -n 's/.*"size":*\([[:digit:]]*\).*/\1/p'` +BOOT_SIZE=`sfdisk -J ${IMAGE} | grep -m 2 size | tail -n +2 | sed 's/"size":\|"\|,//g'` # Start sector of root (second) partition -ROOT_START=`sfdisk -J ${IMAGE} | grep img2 | sed -n 's/.*"start":*\([[:digit:]]*\).*/\1/p'` +ROOT_START=`sfdisk -J ${IMAGE} | grep -m 2 start | tail -n +2 | sed 's/"start":\|"\|,//g'` # Amount of sectors of root (second) partition -ROOT_SIZE=`sfdisk -J ${IMAGE} | grep img2 | sed -n 's/.*"size":*\([[:digit:]]*\).*/\1/p'` +ROOT_SIZE=`sfdisk -J ${IMAGE} | grep -m 3 size | tail -n +3 | sed 's/"size":\|"\|,//g'` +######################### OLD ######################### +# Start sector of boot (first) partition +#BOOT_START=`sfdisk -J ${IMAGE} | grep img1 | sed -n 's/.*"start":*\([[:digit:]]*\).*/\1/p'` +# Amount of sectors of boot (first) partition +#BOOT_SIZE=`sfdisk -J ${IMAGE} | grep img1 | sed -n 's/.*"size":*\([[:digit:]]*\).*/\1/p'` +# Start sector of root (second) partition +#ROOT_START=`sfdisk -J ${IMAGE} | grep img2 | sed -n 's/.*"start":*\([[:digit:]]*\).*/\1/p'` +# Amount of sectors of root (second) partition +#ROOT_SIZE=`sfdisk -J ${IMAGE} | grep img2 | sed -n 's/.*"size":*\([[:digit:]]*\).*/\1/p'` # Locations you'd like the partitions mounted BOOT_PATH='/mnt/rpi-boot' ROOTFS_PATH='/mnt/rpi-root' # Calculate offsets for each partition -offset_boot=$((${BOOT_START} * 512)) -sizelimit_boot=$((${BOOT_SIZE} * 512)) -offset_rootfs=$((${ROOT_START} * 512)) -sizelimit_rootfs=$((${ROOT_SIZE} * 512)) + +############# OLD ############# +#offset_boot=$((${BOOT_START} * 512)) +#sizelimit_boot=$((${BOOT_SIZE} * 512)) +#offset_rootfs=$((${ROOT_START} * 512)) +#sizelimit_rootfs=$((${ROOT_SIZE} * 512)) +############# NEW ############# +offset_boot=$[BOOT_START * 512] +sizelimit_boot=$[BOOT_SIZE * 512] +offset_rootfs=$[ROOT_START * 512] +sizelimit_rootfs=$[ROOT_SIZE * 512] + # TODO: add logic for creating directories if they aren't already there mkdir -p ${BOOT_PATH} mkdir -p ${ROOTFS_PATH} @@ -43,4 +68,7 @@ mkdir -p ${ROOTFS_PATH} mount -o loop,offset=${offset_boot},sizelimit=${sizelimit_boot} ${IMAGE} ${BOOT_PATH} mount -o loop,offset=${offset_rootfs},sizelimit=${sizelimit_rootfs} ${IMAGE} ${ROOTFS_PATH} + + echo "Image mounted" 1>&2 + From 826f0b2de8edf54a5ab28b8476dfbbdb93a34ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20DONATH-ILIC?= <129596282+leodonathilic@users.noreply.github.com> Date: Wed, 24 May 2023 11:03:58 +0200 Subject: [PATCH 7/8] Update basic_mount_image.sh --- shell_utils/basic_mount_image.sh | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/shell_utils/basic_mount_image.sh b/shell_utils/basic_mount_image.sh index ab6ceb0..4032dd7 100755 --- a/shell_utils/basic_mount_image.sh +++ b/shell_utils/basic_mount_image.sh @@ -1,7 +1,7 @@ #!/bin/bash -# Last update 16/05/2023 (dd/mm/yyyy) by Léo DONATH-ILIC +# Last update 16/05/2023 (dd/mm/yyyy) # This script will mount a given image in loop mode. # Make sure to change the path and offsets for the image you use. You can get @@ -22,10 +22,9 @@ set -e # Double check the path and offsets as noted above! # Path to the image -IMAGE='/home/leo/Downloads/2023-05-03-raspios-bullseye-arm64-lite.img' +IMAGE='' -######################### NEW ######################### # Start sector of boot (first) partition BOOT_START=`sfdisk -J ${IMAGE} | grep -m 1 start | sed 's/"start":\|"\|,//g'` # Amount of sectors of boot (first) partition @@ -34,28 +33,13 @@ BOOT_SIZE=`sfdisk -J ${IMAGE} | grep -m 2 size | tail -n +2 | sed 's/"size":\|"\ ROOT_START=`sfdisk -J ${IMAGE} | grep -m 2 start | tail -n +2 | sed 's/"start":\|"\|,//g'` # Amount of sectors of root (second) partition ROOT_SIZE=`sfdisk -J ${IMAGE} | grep -m 3 size | tail -n +3 | sed 's/"size":\|"\|,//g'` -######################### OLD ######################### -# Start sector of boot (first) partition -#BOOT_START=`sfdisk -J ${IMAGE} | grep img1 | sed -n 's/.*"start":*\([[:digit:]]*\).*/\1/p'` -# Amount of sectors of boot (first) partition -#BOOT_SIZE=`sfdisk -J ${IMAGE} | grep img1 | sed -n 's/.*"size":*\([[:digit:]]*\).*/\1/p'` -# Start sector of root (second) partition -#ROOT_START=`sfdisk -J ${IMAGE} | grep img2 | sed -n 's/.*"start":*\([[:digit:]]*\).*/\1/p'` -# Amount of sectors of root (second) partition -#ROOT_SIZE=`sfdisk -J ${IMAGE} | grep img2 | sed -n 's/.*"size":*\([[:digit:]]*\).*/\1/p'` + # Locations you'd like the partitions mounted BOOT_PATH='/mnt/rpi-boot' ROOTFS_PATH='/mnt/rpi-root' # Calculate offsets for each partition - -############# OLD ############# -#offset_boot=$((${BOOT_START} * 512)) -#sizelimit_boot=$((${BOOT_SIZE} * 512)) -#offset_rootfs=$((${ROOT_START} * 512)) -#sizelimit_rootfs=$((${ROOT_SIZE} * 512)) -############# NEW ############# offset_boot=$[BOOT_START * 512] sizelimit_boot=$[BOOT_SIZE * 512] offset_rootfs=$[ROOT_START * 512] From c7c11fed44c336de3289dcdf3ef14b27ee4a806b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20DONATH-ILIC?= <129596282+leodonathilic@users.noreply.github.com> Date: Wed, 24 May 2023 11:11:21 +0200 Subject: [PATCH 8/8] Update setup_with_proot.md --- doc/setup_with_proot.md | 58 ++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/doc/setup_with_proot.md b/doc/setup_with_proot.md index 78fa30d..5337a45 100644 --- a/doc/setup_with_proot.md +++ b/doc/setup_with_proot.md @@ -5,7 +5,7 @@ There is always a prebuilt image available for download and installation as described in the [README](../README.md). If you'd like to build the project yourself, there are several steps involved: -* Downloading a generic RaspiOS Lite image +* Downloading a generic Raspbian Lite image * Resizing the image and partition * Downloading and building the dependencies * Modifying the image configuration @@ -28,13 +28,13 @@ Preparation ``` * Install qemu, qemu-user-static, and proot if not already installed: ``` - apt-get install qemu qemu-user-static qemu-user proot xz-utils + apt-get install qemu qemu-user-static qemu-user proot ``` Download the Raspbian image ============================== -* Get the most recent version of RaspiOS Lite from [here](https://downloads.raspberrypi.org/raspios_lite_armhf/images/): +* Get the most recent version of Raspbian Jessie Lite from https://downloads.raspberrypi.org/raspbian_lite/images/: ``` wget https://downloads.raspberrypi.org/raspbian_lite_latest @@ -45,7 +45,7 @@ Download the Raspbian image ``` * Unpack it: ``` - unxz XXXX-XX-XX-raspios-bullseye-armhf-lite.img.xz + unzip XXXX-XX-XX-raspbian-buster-lite.zip ``` Add space to the image @@ -54,40 +54,38 @@ Add space to the image * Use dd to add 2GB (2048 blocks of 1024k each). Using /dev/zero as the input file yields an unlimited number of "0x00" bytes. ``` - dd if=/dev/zero bs=1024k count=2048 >> XXXX-XX-XX-raspios-bullseye-armhf-lite.img + > dd if=/dev/zero bs=1024k count=2048 >> XXXX-XX-XX-raspbian-jessie-lite.img ``` * Expand the root (second) partition using sfdisk: -``` - echo ", +" | sfdisk -N 2 XXXX-XX-XX-raspios-bullseye-armhf-lite.img - -Checking that no-one is using this disk right now ... OK - -Disk 2023-05-03-raspios-bullseye-armhf-lite.img: 3.83 GiB, 4114612224 bytes, 8036352 sectors -Units: sectors of 1 * 512 = 512 bytes -Sector size (logical/physical): 512 bytes / 512 bytes -I/O size (minimum/optimal): 512 bytes / 512 bytes -Disklabel type: dos -Disk identifier: 0x4c4e106f +``` + > echo ", +" | sfdisk -N 2 XXXX-XX-XX-raspbian-jessie-lite.img + Checking that no-one is using this disk right now ... OK -Old situation: + Disk 2017-11-29-raspbian-stretch-lite.img: 3.7 GiB, 4005560320 bytes, 7823360 sectors + Units: sectors of 1 * 512 = 512 bytes + Sector size (logical/physical): 512 bytes / 512 bytes + I/O size (minimum/optimal): 512 bytes / 512 bytes + Disklabel type: dos + Disk identifier: 0x37665771 -Device Boot Start End Sectors Size Id Type -2023-05-03-raspios-bullseye-armhf-lite.img1 8192 532479 524288 256M c W95 FAT32 (LBA) -2023-05-03-raspios-bullseye-armhf-lite.img2 532480 8036351 7503872 1.6G 83 Linux + Old situation: -2023-05-03-raspios-bullseye-armhf-lite.img2: -New situation: -Disklabel type: dos -Disk identifier: 0x4c4e106f + Device Boot Start End Sectors Size Id Type + 2017-11-29-raspbian-stretch-lite.img1 8192 93236 85045 41.5M c W95 FAT32 (LBA) + 2017-11-29-raspbian-stretch-lite.img2 94208 3629055 3534848 1.7G 83 Linux -Device Boot Start End Sectors Size Id Type -2023-05-03-raspios-bullseye-armhf-lite.img1 8192 532479 524288 256M c W95 FAT32 (LBA) -2023-05-03-raspios-bullseye-armhf-lite.img2 532480 8036351 7503872 3.6G 83 Linux + 2017-11-29-raspbian-stretch-lite.img2: + New situation: + Disklabel type: dos + Disk identifier: 0x37665771 -The partition table has been altered. -Syncing disks. + Device Boot Start End Sectors Size Id Type + 2017-11-29-raspbian-stretch-lite.img1 8192 93236 85045 41.5M c W95 FAT32 (LBA) + 2017-11-29-raspbian-stretch-lite.img2 94208 7823359 7729152 3.7G 83 Linux + The partition table has been altered. + Syncing disks. ``` * Edit `shell_utils/basic_mount_image.sh` to use the correct image path ($IMAGE) @@ -163,7 +161,7 @@ verify that these dependencies are current by checking in the PyCIRCLean git rep cd /home/pi git clone https://github.com/CIRCL/PyCIRCLean.git cd PyCIRCLean - #pip3 install -r requirements.txt + pip3 install -r requirements.txt ``` * Create a new user named "kitten": ```