摘要
本文概要介紹於Ubuntu 24.04作業系統跨平台編譯基於OpenWrt專案之BeagleBone Black單板電腦的Linux作業系統核心、並將映像檔寫入SD卡的步驟。
本文
OpenWrt是適用於嵌入式系統的一個Linux發行版,其特點為高度模組化、並且擁有強大的網路零組件。
隨後將依循這裡的說明來跨平台編譯OpenWrt的快照(snapshot)版本;搭配docker的建構步驟分述如下。
docker pull ubuntu:noble
docker run --name noble-inst -it --cpuset-cpus="6,7,8,9,10,11,12,13,14,15" --memory="24g" -v ~/Downloads:/experiment ubuntu:noble bash
apt-get update
apt-get install sudo
USER=`id -nu 1000`
PASSWORD="password"
usermod -a -G sudo $USER
echo "$USER:$PASSWORD" | chpasswd
echo "root:$PASSWORD" | chpasswd
sudo -i -u $USER
sudo apt install build-essential clang flex bison g++ gawk gcc-multilib g++-multilib gettext git libncurses5-dev libssl-dev python3-setuptools rsync swig unzip zlib1g-dev file wget
cd /experiment/
git clone https://git.openwrt.org/openwrt/openwrt.git
cd openwrt
git checkout v23.05.3
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
make -j$(nproc) defconfig download clean world
docker rm -f ubuntu-inst
docker rmi ubuntu:noble
其中,menuconfig步驟中將會依據這裡透過選單來挑選BeagleBone Black單板電腦所使用的處理器作為目標,選取後的截圖如下所示。
編譯完畢將會在指定目錄./bin/targets/產生對應之目標的目錄與檔案。
ubuntu@60219fd0e726:/experiment/openwrt$ ls bin/targets/omap/generic -alt
total 18596
-rw-r--r-- 1 ubuntu ubuntu 826 Jul 24 10:22 sha256sums
drwxr-xr-x 4 ubuntu ubuntu 4096 Jul 24 10:22 .
-rw-r--r-- 1 ubuntu ubuntu 1336 Jul 24 10:22 profiles.json
drwxr-xr-x 2 ubuntu ubuntu 4096 Jul 24 10:22 packages
-rw-r--r-- 1 ubuntu ubuntu 2500 Jul 24 10:22 openwrt-omap-generic-ti_am335x-bone-black.manifest
-rw-r--r-- 1 ubuntu ubuntu 8280793 Jul 24 10:22 openwrt-omap-generic-ti_am335x-bone-black-ext4-sdcard.img.gz
-rw-r--r-- 1 ubuntu ubuntu 7407362 Jul 24 10:22 openwrt-omap-generic-ti_am335x-bone-black-squashfs-sdcard.img.gz
-rw-r--r-- 1 ubuntu ubuntu 3305647 Jul 24 10:22 openwrt-omap-generic-ti_am335x-bone-black-rootfs.tar.gz
drwxr-xr-x 2 ubuntu ubuntu 4096 Jul 24 10:21 u-boot-am335x_evm
-rw-r--r-- 1 ubuntu ubuntu 268 Jul 24 10:21 feeds.buildinfo
-rw-r--r-- 1 ubuntu ubuntu 18 Jul 24 10:21 version.buildinfo
-rw-r--r-- 1 ubuntu ubuntu 107 Jul 24 10:21 config.buildinfo
drwxr-xr-x 3 ubuntu ubuntu 4096 Jul 24 10:13 ..
ubuntu@60219fd0e726:/experiment/openwrt$
接著參考這裡,把成品之一openwrt-omap-generic-ti_am335x-bone-black-ext4-sdcard.img.gz以zcat和dd指令燒錄到SD卡(映對至/dev/sdb)、並插進BeagleBone Black單板電腦的插槽。開機完成BeagleBone Black的serial console執行畫面如下所示。
cd ~/Downloads/openwrt/bin/targets/omap/generic
zcat openwrt-omap-generic-ti_am335x-bone-black-ext4-sdcard.img.gz | sudo dd of=/dev/sdb bs=4096 conv=fsync
參考文獻
https://engineer-leo.blogspot.com/2024/06/vmware17-ub2404-openwrt-amd64.html
http://m.blog.chinaunix.net/uid-21977330-id-5818887.html
沒有留言:
不接受新意見。