Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Rockpi4/dev/rootfs

< Rockpi4‎ | dev

build deban11 armhf image with a existed image

1. build armhf debian11 rootfs

# to install tool
sudo apt install -y debootstrap
# create folder rootfs
mkdir rootfs && cd rootfs
# building rootfs
sudo debootstrap --arch armhf bullseye rootfs http://mirrors.tuna.tsinghua.edu.cn/debian
sudo chroot rootfs bash
# to install the packages you need
apt update
apt install usbutils network-manager sudo fdisk vim nano openssh-server iputils-ping wget curl iproute2 dialog locales kmod zip unzip u-boot-tools initramfs-tools
# add user
adduser radxa
gpasswd -a radxa sudo

2. Flash a debian11 arm64 image to a sd card or a emmc module

3. Insert the SD card or emmc that has been burned into the image to the local computer and mount it

radxa@radxa:~$ sudo blkid /dev/sdb2
/dev/sdb2: LABEL="rootfs" UUID="8bf96d05-7c97-42fc-863c-95e3e7603ef4" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="rootfs" PARTUUID="474d4c1f-53da-447c-bab4-334abe0d5753"
radxa@radxa:~$ sudo blkid /dev/sdb1
/dev/sdb1: LABEL_FATBOOT="config" LABEL="config" UUID="4AD5-9369" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="config" PARTUUID="8d24a074-ea49-4d24-a17c-82dd88776fa2"
radxa@radxa:~$ lsblk
... ...
sdb      8:16   1  29.3G  0 disk 
├─sdb1   8:17   1    16M  0 part 
└─sdb2   8:18   1   5.1G  0 part
 radxa@radxa:~$ sudo mount /dev/sdb2 /data2
 radxa@radxa:~$ cd /data2

4. Go to the root file system, back up the boot directory, delete and replace the root file system, and restore the boot directory to the root file system

radxa@radxa:/data2$ sudo cp -r ./boot ~/
radxa@radxa:/data2$ sudo rm -rf *
radxa@radxa:/data2$ sudo cp -av /path/to/rootfs/* ./
radxa@radxa:/data2$ sudo cp -av ~/boot/* ./boot/
radxa@radxa:/data2$ sudo cat ./etc/fstab
# UNCONFIGURED FSTAB FOR BASE SYSTEM
//Replace the uuid in the preceding section
radxa@radxa:/data2$ sudo cat ./etc/fstab
# UNCONFIGURED FSTAB FOR BASE SYSTEM
UUID=8bf96d05-7c97-42fc-863c-95e3e7603ef4       /       ext4    defaults        0       1
UUID=4AD5-9369  /config vfat    defaults,x-systemd.automount    0       2

5. Umount the sd card or the emmc, then boot up

radxa@radxa:/data2$ cd
radxa@radxa:~$ sudo umount /data2 

6. After the system start, Check whether rootfs is armhf (32-bit)

radxa@rock-4c-plus:~$ sudo apt-get install file -y 
radxa@rock-4c-plus:~$ file /bin/ls
/bin/ls: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, Buildd
radxa@rock-4c-plus:~$ 

7. Check whether the tools are 32-bit. If not, uninstall the tool and reinstall it