Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ass:labs-2025:04:tasks:02 [2025/08/07 14:50]
florin.stancu
ass:labs-2025:04:tasks:02 [2025/08/07 20:54] (current)
florin.stancu
Line 36: Line 36:
  
 <note warning> <note warning>
-Keep the partition labels as commented!+Make the partition ​have the labels ​documented above (as they are used throughout the RAUC scripts and/or in u-boot)!
 </​note>​ </​note>​
  
Line 47: Line 47:
   - Mount the partitions created previously (already in script);   - Mount the partitions created previously (already in script);
   - Extract the previously-obtained Debian ''​debrootfs.tar.gz''​ on each rootfs A/B partition (a simple ''​tar xf''​ will suffice);   - Extract the previously-obtained Debian ''​debrootfs.tar.gz''​ on each rootfs A/B partition (a simple ''​tar xf''​ will suffice);
 +
 +Note: you will lack ''​flash_emmc.bin''​ required by this script. So let's proceed without testing, for now.
 +
 +=== Entering the rootfs ===
 +
 +If you wish to enter your newly bootstrapped Debian rootfs, you can use the following script:
 +
 +<file bash enter-rootfs.sh>​
 +#!/bin/bash
 +set -e
 +
 +ROOTFS=$1
 +
 +if [[ -z "​$ROOTFS"​ ]] || [[ ! -d "​$ROOTFS/​usr/​bin"​ ]]; then
 +    echo "[!] Invalid rootfs argument: '​$ROOTFS'"​
 +    exit 1
 +fi
 +
 +cleanup() {
 +    echo "[*] Cleaning up..."
 +    for sub in dev/pts dev proc sys run; do
 +        if mountpoint -q "​$ROOTFS/​$sub";​ then
 +            echo " ​   Unmounting $ROOTFS/​$sub"​
 +            sudo umount "​$ROOTFS/​$sub"​ || true
 +        fi
 +    done
 +}
 +trap cleanup EXIT
 +
 +echo "[+] Binding chroot filesystems..."​
 +for fs in dev dev/pts proc sys run; do
 +  sudo mount --bind "/​$fs"​ "​$ROOTFS/​$fs"​
 +done
 +
 +echo "[+] Ensuring /​etc/​resolv.conf for DNS inside chroot"​
 +sudo cp /​etc/​resolv.conf "​$ROOTFS/​etc/​resolv.conf"​
 +
 +echo "[+] Entering your chroot shell..."​
 +echo "Type exit to leave"
 +sudo chroot "​$ROOTFS"​ /​usr/​bin/​qemu-aarch64-static /bin/bash
 +</​file>​
 +
 +You can even run ''​apt install''​ in there ;) 
  
  
ass/labs-2025/04/tasks/02.1754567446.txt.gz ยท Last modified: 2025/08/07 14:50 by florin.stancu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0