OpenWrt 的世界︰樹莓派 3B 【路由器】移星轉斗《五》編譯 二

幸而經過一夜折騰,總算大功告成︰

pi@raspberrypi:~/openwrt make  make[1] world  make[2] toolchain/compile  make[3] -C toolchain/gdb compile  make[3] -C toolchain/binutils compile  make[3] -C toolchain/gcc/initial compile  make[3] -C toolchain/kernel-headers compile  make[3] -C toolchain/musl compile  make[3] -C toolchain/gcc/final compile  make[3] -C toolchain/fortify-headers compile  make[2] target/compile  make[3] -C target/linux compile  make[2] diffconfig  make[2] package/cleanup  make[2] package/compile  make[3] -C package/libs/libjson-c host-compile  make[3] -C package/libs/libubox host-compile  make[3] -C package/system/opkg host-compile  make[3] -C package/libs/toolchain compile  make[3] -C package/libs/libnl-tiny compile  make[3] -C package/libs/libjson-c compile  make[3] -C package/utils/lua compile  make[3] -C package/libs/libubox compile  make[3] -C package/system/ubus compile  make[3] -C package/system/uci compile  make[3] -C package/network/config/netifd compile  make[3] -C package/firmware/linux-firmware compile  make[3] -C package/firmware/prism54-firmware compile  make[3] -C package/kernel/linux compile  make[3] -C package/system/ubox compile  make[3] -C package/libs/ncurses host-compile  make[3] -C package/libs/zlib compile  make[3] -C package/libs/ncurses compile  make[3] -C package/utils/util-linux compile  make[3] -C package/system/fstools compile  make[3] -C package/system/fwtool host-compile  make[3] -C package/system/fwtool compile  make[3] -C package/system/procd compile  make[3] -C package/system/usign host-compile  make[3] -C package/system/ucert host-compile  make[3] -C package/utils/jsonfilter compile  make[3] -C package/system/openwrt-keyring compile  make[3] -C package/system/usign compile  make[3] -C package/base-files compile  make[3] -C package/firmware/brcmfmac-board-rpi compile  make[3] -C package/firmware/wireless-regdb compile  make[3] -C package/kernel/brcm2708-gpu-fw compile  make[3] -C package/firmware/b43legacy-firmware compile  make[3] -C package/libs/openssl compile  make[3] -C package/libs/gettext compile  make[3] -C package/libs/libiconv compile  make[3] -C package/libs/libtool compile  make[3] -C package/libs/wolfssl compile  make[3] -C package/network/services/hostapd compile  make[3] -C package/network/utils/iw compile  make[3] -C package/kernel/mac80211 compile  make[3] -C package/libs/mbedtls compile  make[3] -C package/libs/ustream-ssl compile  make[3] -C package/libs/uclient compile  make[3] -C package/network/utils/iptables compile  make[3] -C package/network/config/firewall compile  make[3] -C package/network/ipv6/odhcp6c compile  make[3] -C package/network/services/dnsmasq compile  make[3] -C package/network/services/dropbear compile  make[3] -C package/network/services/odhcpd compile  make[3] -C package/libs/libpcap compile  make[3] -C package/network/utils/linux-atm compile  make[3] -C package/network/utils/resolveip compile  make[3] -C package/network/services/ppp compile  make[3] -C package/network/utils/iwinfo compile  make[3] -C package/system/mtd compile  make[3] -C package/system/opkg compile  make[3] -C package/utils/busybox compile  make[3] -C package/utils/e2fsprogs host-compile  make[3] -C package/utils/e2fsprogs compile  make[3] -C package/utils/f2fs-tools compile  make[2] package/install  make[2] target/install  make[3] -C target/linux install  make[2] package/index  make[2] checksum pi@raspberrypi:~/openwrt 

 

不過,一則掛慮所剩空間無幾︰

pi@raspberrypi:~/openwrt df -h 檔案系統        容量  已用  可用 已用% 掛載點 /dev/root        15G   14G  737M   95% / devtmpfs        460M     0  460M    0% /dev tmpfs           464M     0  464M    0% /dev/shm tmpfs           464M   13M  452M    3% /run tmpfs           5.0M  4.0K  5.0M    1% /run/lock tmpfs           464M     0  464M    0% /sys/fs/cgroup /dev/mmcblk0p1   44M   23M   22M   51% /boot tmpfs            93M  4.0K   93M    1% /run/user/1000 </pre>    <span style="color: #666699;">再則擔心昨天所遇『莫名事件』︰</span> <pre class="lang:default decode:true "> make[3] -C toolchain/gcc/initial compile make -r world: build failed. Please re-run make with -j1 V=s or V=sc for a higher verbosity level to see what's going on /home/pi/openwrt/include/toplevel.mk:216: recipe for target 'world' failed make: *** [world] Error 1 pi@raspberrypi:~/openwrt make
 make[1] world
 make[2] toolchain/compile
 make[3] -C toolchain/gdb compile
 make[3] -C toolchain/binutils compile
 make[3] -C toolchain/gcc/initial compile

【demsg】

[ 7002.114849] Workqueue: events_freezable mmc_rescan
[ 7002.114867] [<8079ef70>] (__schedule) from [<8079f5d8>] (schedule+0x50/0xa8)
[ 7002.114875] [<8079f5d8>] (schedule) from [<8061a2d0>] (__mmc_claim_host+0xb8/0x1cc)
[ 7002.114884] [<8061a2d0>] (__mmc_claim_host) from [<8061a414>] (mmc_get_card+0x30/0x34)
[ 7002.114891] [<8061a414>] (mmc_get_card) from [<80623010>] (mmc_sd_detect+0x20/0x74)
[ 7002.114898] [<80623010>] (mmc_sd_detect) from [<8061ccdc>] (mmc_rescan+0x1c8/0x394)
[ 7002.114907] [<8061ccdc>] (mmc_rescan) from [<801379b4>] (process_one_work+0x158/0x454)
[ 7002.114914] [<801379b4>] (process_one_work) from [<80137d14>] (worker_thread+0x64/0x5b8)
[ 7002.114921] [<80137d14>] (worker_thread) from [<8013dd98>] (kthread+0x13c/0x16c)
[ 7002.114930] [<8013dd98>] (kthread) from [<801080ac>] (ret_from_fork+0x14/0x28)

 

況且依據

Workqueue: kmmcd mmc_rescan crash with Raspbian kernel 4.4.38-v7 #1885

kkpdk commented Oct 10, 2018

I had the idea to test this on various models, to see if multicore or wifi was the trigger: No, it is Pi3/Pi3B+.

Pi 0W (4pcs): 48 hours runtime, no failures
I tested 4 cards (Sandisk A1, SanDisk industrial, NetList SLC, Panasonic Industrial), one in each 0W, with wifi enabled and talking, for a total of 192 card-hours.

Pi 2 original (1pc): 48 hours runtime, no failures
If this is a locking bug, maybe it would fail on the Pi2. This is the first Pi2, not using the Pi3 SoC.

Pi 3 original (1pc): 8 hours runtime, 6 failures, throttled=0x0
This is powered from a really nice and clean 5V 5A supply, with short fat wires, and a large heatsink.

Pi 3B+ (3pcs): Highly variable. The best has 6 days of runtime and only a single failure, the worst fails once per hour on average.

Various things tried:
330uF extra on 3.3V. 5V supplied to header. Disabling wifi. Iperf3 on wifi while copying. No difference.

 

所言,實有隱憂☻

故耳決定測之以 USD HDD 『開機系統』呦。

pi@raspberrypi:~ df -h 檔案系統        容量  已用  可用 已用% 掛載點 /dev/root        57G   14G   42G   25% / devtmpfs        460M     0  460M    0% /dev tmpfs           464M     0  464M    0% /dev/shm tmpfs           464M   13M  452M    3% /run tmpfs           5.0M  4.0K  5.0M    1% /run/lock tmpfs           464M     0  464M    0% /sys/fs/cgroup /dev/sda1        44M   23M   22M   51% /boot tmpfs            93M  4.0K   93M    1% /run/user/1000 </pre>    <span style="color: #666699;">還好目前沒見著什麼問題哩☺</span> <pre class="lang:default decode:true ">pi@raspberrypi:~/openwrt make -j 4
 make[1] world
 make[2] package/cleanup
 make[2] target/compile
 make[3] -C target/linux compile
 make[2] diffconfig
 make[2] package/compile
 make[3] -C package/libs/libjson-c host-compile
 make[3] -C package/libs/ncurses host-compile
 make[3] -C package/libs/toolchain compile
 make[3] -C package/system/fwtool host-compile
 make[3] -C package/system/usign host-compile
 make[3] -C package/utils/e2fsprogs host-compile
 make[3] -C package/libs/libubox host-compile
 make[3] -C package/libs/libnl-tiny compile
 make[3] -C package/libs/libjson-c compile
 make[3] -C package/utils/lua compile
 make[3] -C package/firmware/linux-firmware compile
 make[3] -C package/firmware/prism54-firmware compile
 make[3] -C package/libs/zlib compile
 make[3] -C package/system/fwtool compile
 make[3] -C package/system/ucert host-compile
 make[3] -C package/system/openwrt-keyring compile
 make[3] -C package/firmware/brcmfmac-board-rpi compile
 make[3] -C package/firmware/wireless-regdb compile
 make[3] -C package/kernel/brcm2708-gpu-fw compile
 make[3] -C package/firmware/b43legacy-firmware compile
 make[3] -C package/libs/openssl compile
 make[3] -C package/libs/gettext compile
 make[3] -C package/libs/libiconv compile
 make[3] -C package/libs/libtool compile
 make[3] -C package/network/utils/iw compile
 make[3] -C package/libs/mbedtls compile
 make[3] -C package/network/services/dropbear compile
 make[3] -C package/libs/libpcap compile
 make[3] -C package/network/utils/linux-atm compile
 make[3] -C package/network/utils/resolveip compile
 make[3] -C package/utils/busybox compile
 make[3] -C package/system/opkg host-compile
 make[3] -C package/libs/libubox compile
 make[3] -C package/libs/ncurses compile
 make[3] -C package/libs/wolfssl compile
 make[3] -C package/utils/util-linux compile
 make[3] -C package/utils/f2fs-tools compile
 make[3] -C package/utils/e2fsprogs compile
 make[3] -C package/system/ubus compile
 make[3] -C package/system/uci compile
 make[3] -C package/utils/jsonfilter compile
 make[3] -C package/system/usign compile
 make[3] -C package/network/services/hostapd compile
 make[3] -C package/libs/ustream-ssl compile
 make[3] -C package/network/ipv6/odhcp6c compile
 make[3] -C package/network/services/dnsmasq compile
 make[3] -C package/network/services/odhcpd compile
 make[3] -C package/network/utils/iwinfo compile
 make[3] -C package/system/mtd compile
 make[3] -C package/network/config/netifd compile
 make[3] -C package/kernel/linux compile
 make[3] -C package/system/ubox compile
 make[3] -C package/libs/uclient compile
 make[3] -C package/system/procd compile
 make[3] -C package/system/opkg compile
 make[3] -C package/system/fstools compile
 make[3] -C package/kernel/mac80211 compile
 make[3] -C package/network/services/ppp compile
 make[3] -C package/network/utils/iptables compile
 make[3] -C package/base-files compile
 make[3] -C package/network/config/firewall compile
 make[2] package/install
 make[2] target/install
 make[3] -C target/linux install
 make[2] package/index
 make[2] checksum
pi@raspberrypi:~/openwrt </pre>    <span style="color: #666699;">將可仔細瀏覽一下現今 openwrt 目錄結構︰</span> <pre class="lang:default decode:true ">pi@raspberrypi:~/openwrt ls
bin          dl                  key-build.pub           package      target
BSDmakefile  feeds               key-build.ucert         README       tmp
build_dir    feeds.conf.default  key-build.ucert.revoke  rules.mk     toolchain
config       include             LICENSE                 scripts      tools
Config.in    key-build           Makefile                staging_dir

 

回想其與昔日的

Build system – Features

  • Makes it easy to port software
  • Uses kconfig (Linux Kernel menuconfig) for configuration of features
  • Provides integrated cross-compiler toolchain (gcc, ld, …)
  • Provides abstraction for autotools (automake, autoconf), cmake, scons
  • Handles standard download, patch, configure, compile and packaging workflow
  • Provides a number of common fixups for badly behaving packages

Build system – Make Targets

  • Offers a number of high level make targets for standard package workflows
  • Targets always in the format “component/name/action”, e.g. “toolchain/gdb/compile” or “package/mtd/install”
  • Prepare a package source tree: package/foo/prepare
  • Compile a package: package/foo/compile
  • Clean a package: package/foo/clean

Build system – Build sequence

  1. tools – automake, autoconf, sed, cmake
  2. toolchain/binutils – as, ld, …
  3. toolchain/gcc – gcc, g++, cpp, …
  4. target/linux – kernel modules
  5. package – core and feed packages
  6. target/linux – kernel image
  7. target/linux/image – firmware image file generation

Patch management

  • Many packages will not work as-is and need patches to work on the target or to even compile
  • the build system integrates quilt for easy patch management
  • Turn package patches into quilt series: make package/foo/prepare QUILT=1
  • Update patches from modified series: make package/foo/update
  • Automatically rebase patches after an update: make package/foo/refresh

Packaging considerations

  • Main objective is small memory and size footprint
  • Features that make no sense on embedded systems are disabled through configure or patched out
  • Packages must be compilable regardless of the host system, they should be self contained
  • Shipped “configure” scripts are often faulty or unusable in a cross-compile setting, autoreconf or patching is often needed
  • Build variants and kconfig includes allow for configurable compile-time settings
  • There is no standard way for porting software, in many cases it “just works” but often the package build process needs tweaks

Documentation

History

 

是否有所差異也◎