How to Generate Custom Rootfs in LBA3403V100 Linux SDK

This article describes how to install nano and generate a new image ubuntu-base-jammy.img using chroot in the LBA3403V100 SDK.

Step 1: Check Image Timestamp Before Modification


hi3403_linux4.19_251_sync/ubuntu$ ls -l ubuntu-base-jammy.img

Result shows:


-rw-r--r-- 1 xuzhenhua xuzhenhua 8589934592 May 20 18:04 ubuntu-base-jammy.img

Current timestamp of ubuntu-base-jammy.img is May 20 18:04.

Step 2: Enter chroot Environment of rootfs


sudo chroot binary

Note: binary is the root filesystem directory after image extraction.

Step 3: Check if nano is Already Installed


nano --version

Returns bash: nano: command not found indicating nano is not installed in the system.

Step 4: Update Sources and Install nano


apt update

apt install nano

Step 5: Verify nano Installation Again


nano --version

Returns GNU nano, version 6.2 indicating successful installation of nano.

Step 6: Exit chroot


exit

Step 7: Repackage to Generate New Image


./mk-image.sh jammy

This script will reformat, mount and generate a new ubuntu-base-jammy.img file.

Step 8: Confirm Image Timestamp Change


hi3403_linux4.19_251_sync/ubuntu$ ls -l ubuntu-base-jammy.img

Result shows:


-rw-r--r-- 1 xuzhenhua xuzhenhua 8589934592 May 20 18:10 ubuntu-base-jammy.img

Image timestamp updated to May 20 18:10, indicating the new rootfs (with nano) has been successfully packaged and saved. Other tools such as firefox can also be installed following these steps.

The complete history record can be found in the attachment
lba3403v100_chroot_history.log (4.8 KB)