ubuntu编译rk3588异常

张开发
2026/4/21 14:54:54 15 分钟阅读

分享文章

ubuntu编译rk3588异常
目录问题现象解决方法分析根文件系统定制默认桌面管理x86上运行安装qemu-user-static镜像扩容挂载img并进入shell修改用户名修改默认桌面背景安装需要的软件退出imgshell并卸载问题现象在ubuntu上编译 rk3588 的kernel时报如下错误LZ4C arch/arm64/boot/Image.lz4 Incorrect parameters Usage : lz4 [arg] [input] [output] input : a filename with no FILE, or when FILE is - or stdin, read standard input Arguments : -1 : Fast compression (default) -9 : High compression -d : decompression (default for .lz4 extension) -z : force compression -f : overwrite output without prompting -h/-H : display help/long help and exit arch/arm64/boot/Makefile:31: recipe for target arch/arm64/boot/Image.lz4 failed make[2]: *** [arch/arm64/boot/Image.lz4] Error 1 make[2]: *** Deleting file arch/arm64/boot/Image.lz4 arch/arm64/Makefile:170: recipe for target Image.lz4 failed make[1]: *** [Image.lz4] Error 2 make[1]: *** Waiting for unfinished jobs....解决方法根据相关资料说明安装lz工具。下载地址 https://github.com/lz4/lz4/releases进入解压后的目录makemake install但是编译内核依然报同样的错误分析查看系统中ll /usr/bin 目录下lz*文件信息看日期并没有2023年的说明实际并没有安装到这个目录。分析lz源码make发现它的二进制文件和库文件安装到了/usr/local/bin /usr/local/lib下面知道这个后我们设置PATH环境变量将/usr/local/bin放到PATH的最前面export PATH/usr/local/bin:$PATH此时我们再进行编译则正常。根文件系统定制已有ubuntu 系统修改其内容定制化。默认桌面管理桌面管理systemctl restart slimcat /etc/systemd/system/display-manager.service [Unit] DescriptionSLiM Simple Login Manager Aftersystemd-user-sessions.service plymouth-quit.service [Service] ExecStartPre/bin/sh -c [ $(cat /etc/X11/default-display-manager 2/dev/null) /usr/bin/slim ] #ExecStartPre/bin/bash /etc/init.d/rockchip.sh ExecStart/usr/bin/slim -nodaemon Restartalways 默认桌面系统XFCEx86上运行安装qemu-user-static根文件系统修改,在x86上运行安装qemu-user-static sudo apt update sudo apt install qemu-user-static binfmt-support sudo update-binfmts --enable # 或重启服务 sudo systemctl restart systemd-binfmt镜像扩容1. 首先将原始img增加 1e2fsck -f ubuntu.img e2fsck 1.44.1 (24-Mar-2018) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information ubuntu-rootfs_zh.img: 76908/194304 files (0.1% non-contiguous), 772096/776192 blocks 2rootubuntu:/mnt/hgfs/ubuntu# resize2fs ubuntu.img 6G resize2fs 1.44.1 (24-Mar-2018) Resizing the filesystem on ubuntu-rootfs_zh.img to 1048576 (4k) blocks. The filesystem on ubuntu-rootfs_zh.img is now 1048576 (4k) blocks long.挂载img并进入shell主要利用chrootsudo mount -o loop ubuntu.img ./ubuntu_img # 2. 挂载必要的虚拟文件系统 sudo mount --bind /dev ./ubuntu_img/dev sudo mount --bind /proc ./ubuntu_img/proc sudo mount --bind /sys ./ubuntu_img/sys # 3. 关键步骤复制 QEMU ARM64 模拟器到镜像中 sudo cp /usr/bin/qemu-aarch64-static ./ubuntu_img/usr/bin/ # 现在可以进入 chroot 了指定使用 ARM64 的 bash sudo chroot ./ubuntu_img /usr/bin/qemu-aarch64-static /bin/bash修改用户名根据客户要求修改原先默认用户为zhtest客户期望zh用户# 1. 修改用户名和家目录 usermod -l zh -d /home/zh -m zhtest # 2. 修改用户组名如果有 groupmod -n zh zhtest # 3. 重置密码 passwd zh 配置文件 /etc/slim.conf 默认用户配置 # default user, leave blank or remove this line # for avoid pre-loading the username. default_user zhtest修改默认桌面背景cd /usr/share/backgrounds/xfce# mv xfce-shapes.svg xfce-shapes_bak.svg cp ../greybird.svg xfce-shapes.svg安装需要的软件安装软件 sudo apt update sudo apt install -y aptitude aptitude install -y gcc apt install -y g apt install -y libgles2-mesa-dev libegl1-mesa-dev sudo apt install -y qt5-qmake sudo apt install -y terminator apt install libasound2t641.2.11-1ubuntu0.2 libasound2-data1.2.11-1ubuntu0.2 sudo apt-get install -y libsdl-dev退出imgshell并卸载 # 5. 退出 chroot exit sudo umount ./ubuntu_img/dev sudo umount ./ubuntu_img/proc sudo umount ./ubuntu_img/sys sudo umount ./ubuntu_img

更多文章