赞
踩
1.由于某些原因,瑞芯微RK3588 SDK不在支持ubuntu版本, 默认只支持debian版本.
现在要更改为ubuntu-20, 支持ROS1版本.
需要熟悉的指令
dd: 还原/备份分区, 制作空文件
dd if=/dev/zero of=ubuntu.img bs=1G count=8
mkfs: 格式化分区文件
mkfs.ext4 ubuntu.img
mount: 挂载rootfs根文件系统
mkdir rootfs; sudo mount -o loop ubuntu.img rootfs
chroot: 切换根文件启动,并启动shell.
实例1: 切换到ubuntu20.04 x86_64版本
wget http://cdimage.ubuntu.com/ubuntu-base/releases/20.04/release/ubuntu-base-20.04.1-base-amd64.tar.gz
mkdir rootfs
sudo tar -pzxf ubuntu-base-20.04.1-base-amd64.tar.gz -C rootfs
sudo chroot rootfs
e2fsck: 修复ext2/3/4文件错误
e2fsck -p -f ubuntu.img
为什么一定要执行e2fsck?
ext2/3/4是日志文件系统, 我们在制作根文件系统时, 退出chroot, mount时,就会导致一些错误.
resize2fs: 扩展/缩小文件系统
resize2fs -m ubuntu.img 缩小文件分区到最小
resize2fs /dev/sda1 扩展文件分区到最大
参考:
https://blog.csdn.net/qq_42257666/article/details/126609600
https://blog.csdn.net/weixin_41070133/article/details/128757151
arm64版本
http://cdimage.ubuntu.com/ubuntu-base/releases/20.04/release/ubuntu-base-20.04.5-base-arm64.tar.gz
1.下载arm64版本的ubuntu-base
wget http://cdimage.ubuntu.com/ubuntu-base/releases/20.04/release/ubuntu-base-20.04.5-base-arm64.tar.gz
2.RK3588_SDK从debian替换为ubuntu
3.修改 rk3588_sdk/device/rockchip/common/scripts/mk-rootfs.sh
# VERSION=debug ARCH=$ARCH ./mk-rootfs-bullseye.sh
VERSION=debug ARCH=$ARCH RC_RELEASE=ubuntu ./mk-rootfs-ubuntu-20.sh
./mk-image.sh
cp mk-rootfs-bullseye.sh mk-rootfs-ubuntu-20.sh
1.解压ubuntu-base.tar.gz 替换到debian-xxx.tar.gz
# ubuntu定制
#sudo tar -xpf linaro-bullseye-alip-*.tar.gz #去除debian
rootfsFile=ubuntu-base-20.04.5-base-arm64.tar.gz
sudo rm -rf binary/*
mkdir -p binary
sudo tar -xpf $rootfsFile -C binary
sudo cp -rf ubuntu_pre_file/* $TARGET_ROOTFS_DIR
ubuntu_pre_file是项目的定制文件,直接cp覆盖到binary
2.打包kernel模块.ko
# 内核模块
modPath=$PWD/$TARGET_ROOTFS_DIR
sudo make -C ../kernel ARCH=arm64 modules_install INSTALL_MOD_PATH="$modPath"
sudo rm $TARGET_ROOTFS_DIR/lib/modules/*/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmdhd.ko
3.拷贝wifi模块
# bt/wifi firmware
sudo mkdir -p $TARGET_ROOTFS_DIR/system/lib/modules/
sudo mkdir -p $TARGET_ROOTFS_DIR/vendor/etc
sudo find ../kernel/drivers/net/wireless/rockchip_wlan/* -name "*.ko" | \
xargs -n1 -i sudo cp {} $TARGET_ROOTFS_DIR/system/lib/modules/
sudo find ../external/rkwifibt -name "*.ko" | \
xargs -n1 -i sudo cp {} $TARGET_ROOTFS_DIR/system/lib/modules/
4.去除在ubuntu中dpkg安装报错的deb文件
\${APT_INSTALL} /packages/gst-plugins-base1.0/*.deb
\${APT_INSTALL} /packages/gst-plugins-bad1.0/*.deb
\${APT_INSTALL} /packages/gst-plugins-good1.0/*.deb
\${APT_INSTALL} /packages/gst-plugins-ugly1.0/*.deb
\${APT_INSTALL} /packages/gst-libav1.0/*.deb
#---------------Clean-------------- # if [ -e "/usr/lib/arm-linux-gnueabihf/dri" ]; # then # # Only preload libdrm-cursor for X # sed -i "1aexport LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libdrm-cursor.so.1" /usr/bin/X # cd /usr/lib/arm-linux-gnueabihf/dri/ # cp kms_swrast_dri.so swrast_dri.so rockchip_dri.so / # rm /usr/lib/arm-linux-gnueabihf/dri/*.so # mv /*.so /usr/lib/arm-linux-gnueabihf/dri/ # elif [ -e "/usr/lib/aarch64-linux-gnu/dri" ]; # then # # Only preload libdrm-cursor for X # sed -i "1aexport LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libdrm-cursor.so.1" /usr/bin/X # cd /usr/lib/aarch64-linux-gnu/dri/ # cp kms_swrast_dri.so swrast_dri.so rockchip_dri.so / # rm /usr/lib/aarch64-linux-gnu/dri/*.so # mv /*.so /usr/lib/aarch64-linux-gnu/dri/ # rm /etc/profile.d/qt.sh # fi
5.根文件定制, 安装项目需要的工具, 库
# 项目定制
sh /etc/xxx_setup_ubuntu.sh
ubuntu_pre_file/etc/xxx_setup_ubuntu.sh
apt install -y apt-utils dialog apt install -y vim sudo bash-completion apt install -y net-tools iputils-ping ifupdown ethtool apt install -y wireless-tools network-manager apt install -y ssh rsync udev # 可装可不装 apt install -y openssh-server git-core ffmpeg # 调试 # sudo cp -rf root/etc/apt/sources.list /etc/apt # sudo apt update apt install -y gdb gdbserver valgrind lsof apt install -y gcc g++ scons make libncurses5-dev libssl-dev build-essential openssl bison flex libelf-dev # 监控 apt install -y htop nload # 工具 apt install -y curl zstd tree i2c-tools udev indent apt install -y tmux \ ccache \ wget \ iproute2 \ psmisc \ picocom \ usbutils \ strace apt install -y wireless-tools iw iperf3 git-core \ dnsmasq
其它:
由于项目原因, 不能把完整的流程展示, 写了几个核心修改点, 定制脚本.
可以私信我, 或加微信, 提供有偿协助.
一个喜欢机器人的嵌入式-系统-软件-网络开发-工程师
微信: liuj1637664504
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。