一、Ubuntu-base20.04.3
Ubuntu官方已經(jīng)制作好了各架構(gòu)、各版本的base版根文件系統(tǒng),只需下載下來做少許改動即可。
下載Ubuntu Base 20.04.3 LTS (Focal Fossa)
ubuntu-base-20.04.3-base-armhf.tar.gz 2021-08-19 10:56 22M
解壓
mkdir rootfs
sudo chmod 777 rootfs
tar -zxvf ubuntu-base-20.04.3-base-armhf.tar.gz -C rootfs
#避免后面更新軟件報錯
sudo chmod 777 ./rootfs/tmp/
安裝工具
sudo apt-get install qemu-user-static
sudo cp /usr/bin/qemu-arm-static ./rootfs/usr/bin/
拷貝主機DNS
sudo cp /etc/resolv.conf ./rootfs/etc/resolv.conf
更換下載源
cp ./rootfs/etc/apt/source.list ./rootfs/etc/apt/source.list.bak
vim ./rootfs/etc/apt/source.list
`Esc` + `:`
%s/ports.ubuntu.com/mirror.tuna.tsinghua.edu.cn/g
`Enter`
創(chuàng)建掛載腳本vim mount.sh
內(nèi)容如下:
#!/bin/bash
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 mount -o bind /dev/pts ${2}dev/pts
sudo chroot ${2}
}
umnt() {
echo 'UNMOUNTING'
sudo umount ${2}proc
sudo umount ${2}sys
sudo umount ${2}dev/pts
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
更改權(quán)限:
sudo chmod +x mount.sh
掛載
source mount.sh -m ./rootfs/
更新軟件
apt update
apt install sudo vim kmod net-tools ethtool ifupdown rsyslog htop iputils-ping language-pack-en-base ssh
注意:ssh必須安裝,不然后面鏈接串口服務(wù)會出錯
設(shè)置用戶名和密碼
root@zsd-virtual-machine:/# passwd root
New password:
Retype new password:
passwd: password updated successfully
root@zsd-virtual-machine:/# adduser zsd
New password:
Retype new password:
`Enter`
`Enter`
......
`Enter`
`Enter`
設(shè)置IP和名稱
root@zsd-virtual-machine:/# echo 'zzssdd2-imx6ull' > /etc/hostname
root@zsd-virtual-machine:/# echo '127.0.0.1 localhost' >> /etc/hosts
root@zsd-virtual-machine:/# echo '127.0.0.1 zzssdd2-imx6ull' >> /etc/hosts
設(shè)置串口終端
ln -s /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@ttymxc0.service
注意:
如果提示報錯提示如下:
root@zsd-virtual-machine:/# ln -s /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@ttymxc0.service
/usr/bin/ln: failed to create symbolic link '/etc/systemd/system/getty.target.wants/getty@ttymxc0.service': No such file or directory
說明/etc/systemd/system/目錄下沒有g(shù)etty.target.wants目錄。
解決方法:安裝ssh會創(chuàng)建該目錄,然后重新執(zhí)行一遍設(shè)置串口終端命令即可。
退出
#退出qemu模擬器
exit
#取消掛載
source mount.sh -u ./rootfs/
#打包
sudo tar -czvf ubuntu-base-20.04.3-rootfs.tar.gz rootfs/*
二、Debian 11
直接使用三方制作好的Debian根文件系統(tǒng),比如Linaro
使用Multistrap或Debootstrap工具構(gòu)建自己的Debian根文件系統(tǒng)
下面我使用debootstrap工具構(gòu)建Debian11根文件系統(tǒng)(別問為什么不用multistrap,問就是不會︶︹︺)
安裝工具
sudo apt install binfmt-support qemu qemu-user-static debootstrap
抽取Debain文件系統(tǒng)
sudo debootstrap --arch=armhf --foreign bullseye rootfs https://mirrors.tuna.tsinghua.edu.cn/debian/
參數(shù)說明:
arch:CPU架構(gòu)
bullseye:debian版本名,這是版本11的名稱
foreign:在與主機架構(gòu)不相同時需要指定此參數(shù),僅做初始化的解包
rootfs:要存放文件系統(tǒng)的文件夾
https://mirrors.tuna.tsinghua.edu.cn/debian/:下載源,這里使用國內(nèi)的清華源
抽取成功后如下:
$ ls ./rootfs/
bin debootstrap etc lib root sbin tmp var
boot dev home proc run sys usr
復(fù)制qemu-arm-static到剛構(gòu)建的基本系統(tǒng)中
sudo cp /usr/bin/qemu-arm-static ./rootfs/usr/bin
完成文件系統(tǒng)引導(dǎo)
sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true chroot rootfs debootstrap/debootstrap --second-stage
參數(shù)說明:
chroot rootfs
更改根目錄為rootfs:就是變更當(dāng)前進(jìn)程及其子進(jìn)程的可見根路徑。變更后,程序無法訪問可見根目錄外文件和命令。
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
避免debconf向用戶詢問任何問題(非交互式),相當(dāng)于是靜默配置安裝。
了解更多debconf - Debian Wiki
debootstrap
man debootstrap
或
debootstrap --help
了解更多Debootstrap - Debian Wiki
完成后提示如下:
I: Base system installed successfully.
更換下載源
#備份
sudo cp ./rootfs/etc/apt/sources.list ./rootfs/etc/apt/sources.list.bak
#編輯
sudo vim ./rootfs/etc/apt/sources.list
#換成如下內(nèi)容:
# 默認(rèn)注釋了源碼鏡像以提高 apt update 速度,如有需要可自行取消注釋
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
創(chuàng)建掛載腳本vim mount.sh
內(nèi)容如下:
#!/bin/bash
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 mount -o bind /dev/pts ${2}dev/pts
sudo chroot ${2}
}
umnt() {
echo 'UNMOUNTING'
sudo umount ${2}proc
sudo umount ${2}sys
sudo umount ${2}dev/pts
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
更改權(quán)限:
sudo chmod +x mount.sh
掛載
source mount.sh -m ./rootfs/
執(zhí)行以下命令
# echo 'proc /proc proc defaults 0 0' >> etc/fstab 設(shè)置Linux中的locale環(huán)境參數(shù) export LC_ALL=C 如果不設(shè)置在后面安裝軟件時會有如下提示: perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = 'zh_CN:en_US:en', LC_ALL = (unset), LC_PAPER = 'zh_CN.UTF-8', LC_NUMERIC = 'zh_CN.UTF-8', LC_IDENTIFICATION = 'zh_CN.UTF-8', LC_MEASUREMENT = 'zh_CN.UTF-8', LC_NAME = 'zh_CN.UTF-8', LC_TELEPHONE = 'zh_CN.UTF-8', LC_ADDRESS = 'zh_CN.UTF-8', LC_MONETARY = 'zh_CN.UTF-8', LC_TIME = 'zh_CN.UTF-8', LANG = 'zh_CN.UTF-8' are supported and installed on your system. perl: warning: Falling back to the standard locale ('C'). /usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory /usr/bin/locale: Cannot set LC_MESSAGES to default locale: No such file or directory /usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory 安裝軟件 apt update apt install sudo apt install net-tools apt install ethtool apt install htop apt install ssh ...... 設(shè)置用戶 #設(shè)置root用戶密碼 passwd root #添加新用戶 adduser zzssdd2 設(shè)置以太網(wǎng) echo 'auto eth0' > /etc/network/interfaces.d/eth0 echo 'iface eth0 inet dhcp' >> /etc/network/interfaces.d/eth0 設(shè)置IP和名稱 echo 'zzssdd2-imx6ull' > /etc/hostname echo '127.0.0.1 localhost' >> /etc/hosts echo '127.0.0.1 zzssdd2-imx6ull' >> /etc/hosts 退出 #退出qemu環(huán)境 exit # 取消掛載 source mount.sh -u ./rootfs/ #打包 sudo tar -zcvf debian_bullseye-rootfs.tar.gz ./rootfs/* 三、Buildroot Buildroot是一個簡單、高效且易于使用的工具,可以通過交叉編譯生成嵌入式Linux系統(tǒng)。更詳細(xì)的了解參考官方手冊The Buildroot user manual 下面使用buildroot-2021.08.1版本對IMX6ULL平臺進(jìn)行配置。 下載:https://buildroot.org/download.html 解壓 :tar -jxvf buildroot-2021.08.1.tar.bz2 進(jìn)入圖形配置界面:make menuconfig 注:下面貼出來的都是經(jīng)過手動配置更改的選項,沒有貼出來的則表示使用默認(rèn)設(shè)置 配置Target options Target options ---> Target Architecture (ARM (little endian)) Target Binary Format (ELF) Target Architecture Variant (cortex-A7) Target ABI (EABIhf) Floating point strategy (NEON/VFPv4) ARM instruction set (ARM) 配置Toolchain Toolchain ---> Toolchain type (External toolchain) Toolchain (Custom toolchain) Toolchain origin (Pre-installed toolchain) (/usr/local/arm/gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf) Toolchain path ($(ARCH)-none-linux-gnueabihf) Toolchain prefix External toolchain gcc version (10.x) External toolchain kernel headers series (4.20.x) External toolchain C library (glibc/eglibc) [ ] Toolchain has RPC support? [*] Toolchain has C++ support? 配置System configuration System configuration ---> (zzssdd2) System hostname (Hello zzssdd2) System banner /dev management (Dynamic using devtmpfs + mdev) (root) Root password (eth0) Network interface to configure through DHCP 配置Target packages 這一步根據(jù)自己的需求選擇安裝需要的包即可(這里為了下一步編譯快一些我保持默認(rèn)選擇)。 按需配置完成后:Save --> Exit --> 執(zhí)行make命令等待編譯完成后在Buildroot根目錄下的output/images目錄下可以看到編譯好的根文件系統(tǒng)。 注意: 如果編譯之前執(zhí)行過make則需要先執(zhí)行make clean清理一下再執(zhí)行make命令,否則可能報錯。 如果遇到某些包下載巨慢、下不動、下載失敗的情況,可以根據(jù)編譯信息提示的地址復(fù)制到瀏覽器手動下載。下載下來后將其復(fù)制到Buildroot根目錄下的dl目錄下,然后CTRL+C終止編譯 --> make clean清除上次編譯 --> make重新編譯。 四、驗證 參考開發(fā)板直連電腦搭建NFS&TFTP環(huán)境第四節(jié)
上一篇:IMX6ULL - 移植linux-imx_5.4.70_2.3.0
下一篇:【IMX6ULL學(xué)習(xí)筆記】十九、Pinctrl、GPIO驅(qū)動驅(qū)動框架
推薦閱讀最新更新時間:2025-07-04 13:57




設(shè)計資源 培訓(xùn) 開發(fā)板 精華推薦
- Microchip 升級數(shù)字信號控制器(DSC)產(chǎn)品線 推出PWM 分辨率和 ADC 速度業(yè)界領(lǐng)先的新器件
- 意法半導(dǎo)體STM32MP23x:突破成本限制的工業(yè)AI應(yīng)用核心
- 意法半導(dǎo)體推出用于匹配遠(yuǎn)距離無線微控制器STM32WL33的集成的匹配濾波芯片
- ESP32開發(fā)板連接TFT顯示屏ST7789跳坑記
- 如何讓ESP32支持analogWrite函數(shù)
- LGVL配合FreeType為可變字體設(shè)置字重-ESP32篇
- 使用樹莓派進(jìn)行 ESP32 Jtag 調(diào)試
- ESP32怎么在SPIFFS里面存儲html,css,js文件,以及網(wǎng)頁和arduino的通訊
- ESP32 freeRTOS使用測試
- 適用于汽車應(yīng)用的 LT3973HMSE-3.3 3.3V 降壓轉(zhuǎn)換器的典型應(yīng)用
- R_08_V30基于IPS2電機換向傳感器的設(shè)計
- 使用 Microchip Technology 的 PIC16C782 的參考設(shè)計
- 使用 LT1054CSW 基本型電壓逆變器 / 穩(wěn)壓器的典型應(yīng)用
- 使用 LTC3637EDHC 4V 至 76V 輸入至 1.8V 超級電容器充電器的典型應(yīng)用
- 儀表用 ADC 驅(qū)動器
- EN6310QA 1A PowerSoC 電壓模式同步 PWM 降壓與集成電感器的典型應(yīng)用
- STEVAL-ISV012V1,使用 L6924D 高達(dá) 5 W 太陽能電池充電器的演示板,用于單節(jié)鋰離子和鋰聚合物電池
- 適用于汽車應(yīng)用的 A5974D 正降壓-升壓穩(wěn)壓器的典型應(yīng)用電路
- 使用 NXP Semiconductors 的 TDA2582Q 的參考設(shè)計
- 方案分享 | ARXML 規(guī)則下 ECU 總線通訊與 ADTF 測試方案
- 車載SerDes產(chǎn)業(yè)起飛!國產(chǎn)新品密集炸場
- 出貨量激增1.34倍! 5G車規(guī)模組成標(biāo)配,三大廠商新品同臺競技
- 6月新能源市場:零跑創(chuàng)新高;比亞迪海外突破;理想滑坡
- 基于中科芯車規(guī)MCU的LED矩陣大燈應(yīng)用方案
- 蘋果被判侵犯3G專利,需向西班牙公司TOT賠償1.1億美元
- 從設(shè)計概念到 FPGA 原型僅需數(shù)分鐘,印度 InCore 完成 SoC Generator 平臺硅驗證
- 消息稱因難尋客戶,三星推遲美國芯片工廠的完工時間
- BOE(京東方)聯(lián)合榮耀打造榮耀Magic V5 以領(lǐng)先LTPO技術(shù)打造行業(yè)新標(biāo)桿
- 華為ADS 4發(fā)布:多傳感器融合,提升自動駕駛安全性
- 蘋果神秘13英寸MacBook Pro曝光:型號A2159,或配32GB內(nèi)存
- 傳三星要在印度裁員上千名
- 安集科技7月10日申購
- 澄天偉業(yè)擬投6.76億建半導(dǎo)體芯片承載基帶和半導(dǎo)體芯片項目
- 日本制裁韓國后,中國會是贏家嗎?
- 高精度授時如何改變5G基礎(chǔ)設(shè)施游戲規(guī)則
- STM32 IAP(對flash進(jìn)行讀寫)
- LPC1768 SPI 外設(shè)控制DA(PCM1796)調(diào)試記錄
- LPC1768里的SPI驅(qū)動示例——基于SST25VF016B
- 【8.16-8.22】本周機器人行業(yè)大事件TOP5
- write a os for myself
- 200米線長信號經(jīng)運放輸出存在不規(guī)則跳動
- 求助一個問題【關(guān)于AIR調(diào)試的問題】
- 【GD32F307E-START】+完成驅(qū)動LCD19264顯示屏
- 15年15個網(wǎng)站改變世界
- 請問ROM/bin文件的格式是如何執(zhí)行處理的?
- 求助電路中與非門的作用
- 【玩轉(zhuǎn)ADuCM360】 LCD換個顯示方式-----芯片由VOCO_2000網(wǎng)友提供
- EEWORLD大學(xué)堂----Atmel_ 如何防御您的知識產(chǎn)權(quán)免受盜用
- Verilog多個模塊怎么整合到一塊,然后通過下載線下載到FPGA里邊呢,謝謝