本教程將帶領(lǐng)大家移植 Debian 文件系統(tǒng)到 i.MX6ULL 終結(jié)者開發(fā)板上。 1 安裝 Qemu 和 Debootstrap 由于我們是在 Ubuntu 上構(gòu)建的 debian 的文件系統(tǒng),所以安裝這倆個(gè)工具我們直接使用 apt-get 命令即可。命令如下: apt-get install binfmt-support qemu qemu-user-static debootstrap如下圖所示: ![]() 2 抽取 Debain 文件系統(tǒng) 抽取文件系統(tǒng)我們使用的是 debootstrap 命令,我們執(zhí)行以下命令即可從 debian 下載源中獲取到文件系統(tǒng): debootstrap --arch=armhf --foreign buster root h t t p s : / / m i r r o r s . t u n a . t s i n g h u a . e d u . c n / d e b i a n / 命令參數(shù)解析: arch 指定了 CPU 架構(gòu) buster 是 debian 版本號(hào)。目前最新為 10 foreign:在與主機(jī)架構(gòu)不相同時(shí)需要指定此參數(shù),僅做初始化的解包 root:要存放文件系統(tǒng)的文件夾 h t t p s : / / m i r r o r s . t u n a . t s i n g h u a . e d u . c n / d e b i a n / 是下載源 如下圖所示: ![]() 抽取時(shí)間比較長(zhǎng),大概 10 分鐘左右,大家耐心等待,抽取成功可以看到 linux 的目錄樹,如下圖所示,如果大家抽取失敗,可以多抽取幾次,或者換個(gè)網(wǎng)絡(luò): ![]() .3 完善文件系統(tǒng) 完善文件系統(tǒng)這里我們要使用到 qemu,為什么要用 qemu 呢,因?yàn)槲覀儸F(xiàn)在是在 X86 虛擬機(jī)上操作,不能完善 arm 的文件系統(tǒng),所以我們要用 qemu 來模擬 arm 的環(huán)境。 (1) 復(fù)制 qemu-arm-static 到剛構(gòu)建的基本系統(tǒng)中,使用命令 cp /usr/bin/qemu-arm-static root/usr/bin 如下圖所示: ![]() (2) 初始化文件系統(tǒng) 執(zhí)行命令: DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C chroot root debootstrap/debootstrap --second-stage 這個(gè)命令會(huì)初始化文件系統(tǒng),如下圖所示: ![]() 大概需要 20 分鐘左右,大家耐心等待即可。 初始化成功如下圖所示: ![]() (3) 使用命令 chroot root,進(jìn)到我們初始化好的文件系統(tǒng),如下圖所示: ![]() (4) 使用命令創(chuàng)建以下內(nèi)容, echo "proc /proc proc defaults 0 0" >> etc/fstab mkdir -p usr/share/man/man1/ mknod dev/console c 5 1 如下圖所示: ![]() (5) 更新下載源,使用命令 vi /etc/apt/sources.list 打開 source.list 文件,然后把里面的內(nèi)容替換成以下內(nèi)容, deb http://mirrors.ustc.edu.cn/debian stable main contrib non-free # deb-src http://mirrors.ustc.edu.cn/debian stable main contrib non-free deb http://mirrors.ustc.edu.cn/debian stable-updates main contrib non-free # deb-src http://mirrors.ustc.edu.cn/debian stable-updates main contrib non-free # deb http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free # deb-src http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free 然后保存退出,使用命令 apt-get update 更下源,如下圖所示: ![]() (6) 使用命令 apt-get install vim 安裝 vim 軟件,如下圖所示: ![]() (7) 創(chuàng)建一個(gè)新的用戶,使用命令 adduser user,然是輸入密碼,密碼為 topeet,如下圖所示: ![]() (8) 設(shè)置 root 密碼,使用命令 passwd root,密碼為 topeet,如下圖所示: ![]() (9) 設(shè)置以太網(wǎng),輸入以下命令: echo "auto eth0" > /etc/network/interfaces.d/eth0 echo "iface eth0 inet dhcp" >> /etc/network/interfaces.d/eth0 如下圖所示: ![]() (10) 因?yàn)?ull 的性能比較弱,所以我們就不安裝桌面了,直接使用 exit 退出 qemu 環(huán)境即可,如下圖所示: ![]() 4 打包文件系統(tǒng) 進(jìn)到 debian 文件系統(tǒng)目錄。直接使用命令 tar -cjf rootfs.tar.bz2 ./* 即可,如下圖所示: ![]() 5 燒寫驗(yàn)證 把我們打包好的這個(gè)文件系統(tǒng)放到燒寫器里面,其他的鏡像使用原來的即可,只需要替換文件系統(tǒng),然后燒寫測(cè)試,啟動(dòng)成功如下圖(沒有界面)所示: ![]() ![]() |