RK3399 Ubuntu系統(tǒng)在PC虛擬機(jī)中使用apt-get修改文件系統(tǒng)

原創(chuàng) 2022-08-08 15:28:00 RK3399 RK3399ubuntu rk3399開發(fā)板

本文主要講解RK3399Ubuntu系統(tǒng)在PC虛擬機(jī)中使用apt-get修改文件系統(tǒng)(使用qemu在PC模擬開發(fā)板環(huán)境),采用硬件平臺為飛凌嵌入式OK3399-C開發(fā)板,本文使用的思路和方法僅供參考使用,其它arm開發(fā)板雖然芯片不同,但思路和方法有很多的共性,希望對您在板卡的使用中能夠有所幫助,更多ARM開發(fā)板相關(guān)資訊,關(guān)注飛凌嵌入式。

OK3399開發(fā)板功能接口圖

首先在VM虛擬機(jī)中安裝qemu相關(guān)環(huán)境

forlinx@ubuntu:$ sudo apt-get install qemu-user-static

將Forlinx Desktop源碼目錄下OK3399-desktop-release/rootfs/ubuntu.img文件擴(kuò)容后掛載()

forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ sudo fsck.ext3 -f IMAGE 

forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ sudo resize2fs IMAGE SIZE

(IMAGE為要修改的鏡像名稱,SIZE為塊的數(shù)量、一個塊的大小為4K(即當(dāng)SIZE為783770時,783770*4=3135080,大概為3.2G,1250000時為5G))按需求擴(kuò)容對應(yīng)的容量大小,ubuntu.img鏡像大小與開發(fā)板rootfs分區(qū)有關(guān),擴(kuò)容為5G沒有問題,再往上擴(kuò)容需要查看開發(fā)板rootfs分區(qū)大小,ubuntu.img ≤ rootfs分區(qū)大小,rootfs分區(qū)修改方法可參考我司知識庫描述:http://www.szrcclub.com/article_view_925.html

擴(kuò)容后將ubuntu.img文件掛載到target目錄下

forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ sudo mount ubuntu.img target/

forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ cd target

修改配置

forlinx@ubuntu:~/OK3399-desktop-release/rootfs/target$ sudo cp /usr/bin/qemu-arm-static usr/bin/

拷貝PC主機(jī)端的dns配置,因為待會安裝程序時要用網(wǎng)絡(luò):

forlinx@ubuntu:~/OK3399-desktop-release/rootfs/target$ sudo cp -b /etc/resolv.conf  etc/resolv.conf

forlinx@ubuntu:~/OK3399-desktop-release/rootfs/target$ sudo vim etc/apt/source.list

添加

deb http://ports.ubuntu.com/ubuntu-ports/ xenial main universe

deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main universe

 

創(chuàng)建qemu掛載腳本

forlinx@ubuntu:~/OK3399-desktop-release/rootfs/target$ cd ..

forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ touch mount.sh

forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ vi mount.sh

添加以下內(nèi)容:

#!/bin/bash

 

function mnt() {

    echo "MOUNTING"

    sudo mount -t proc /proc ${2}proc

    sudo mount -t sysfs /sys ${2}sys

    sudo mount -o bind /dev ${2}dev

 

    sudo chroot ${2}

}

 

function umnt() {

    echo "UNMOUNTING"

    sudo umount ${2}proc

    sudo umount ${2}sys

    sudo umount ${2}dev

 

}

 

 

if [ "$1" == "-m" ] && [ -n "$2" ] ;

then

    mnt $1 $2

elif [ "$1" == "-u" ] && [ -n "$2" ];

then

    umnt $1 $2

else

    echo ""

    echo "Either 1'st, 2'nd or both parameters were missing"

    echo ""

    echo "1'st parameter can be one of these: -m(mount) OR -u(umount)"

    echo "2'nd parameter is the full path of rootfs directory(with trailing '/')"

    echo ""

    echo "For example: ch-mount -m /media/sdcard/"

    echo ""

    echo 1st parameter : ${1}

    echo 2nd parameter : ${2}

fi

保存退出

forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ chmod +x mount.sh

forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ sudo ./mount.sh -m target/

到此,成功將ubuntu.img掛載到qemu上,虛擬機(jī)操作用戶應(yīng)該變?yōu)閞oot@ubuntu:/# ,此時執(zhí)行apt等操作會保留在ubuntu.img文件中

做對應(yīng)的修改即可

退出 exit

取消掛載

forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ sudo ./mount.sh -u target/

forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ sudo umount target/

 

然后運(yùn)行編譯腳本生成update.img即可。


相關(guān)產(chǎn)品 >

  • FET3399-C核心板

    飛凌RK3399安卓高性能核心板采用 采用六核Rockchip RK3399芯片,雙Cortex-A72大核+四Cortex-A53小核結(jié)構(gòu),對整數(shù)、浮點、內(nèi)存等作了大幅優(yōu)化,在整體性能、功耗及核心面積三個方面提升。以下將對瑞芯微芯片RK3399參數(shù),RK3399核心板方案及其性能做具體介紹。如您對飛凌RK3399系列核心板有興趣,歡迎咨詢了解。

    了解詳情
    FET3399-C核心板
  • OK3399-C開發(fā)板

    飛凌嵌入式RK3399安卓開發(fā)板主芯片采用高性能六核CPU Rockchip RK3399,GPU采用Mail-T860四核 GPU,RK3399作為目RK產(chǎn)品線中低功耗、高性能的代表,可滿足人臉識別設(shè)備、機(jī)器人、無人機(jī)、IoT物聯(lián)網(wǎng)領(lǐng)域應(yīng)用。飛凌RK3399開發(fā)板在整體性能、功耗及核心面積做了大幅度優(yōu)化,更加滿足工業(yè)設(shè)計需求。飛凌RK3399開發(fā)板為進(jìn)一步減少用戶二次開發(fā)難度,開放了底板原理圖,并提供了RK3399用戶手冊、芯片手冊,加上優(yōu)質(zhì)的技術(shù)服務(wù),讓您的方案從構(gòu)思到上市時間縮短。

    了解詳情
    OK3399-C開發(fā)板

推薦閱讀 換一批 換一批