美文网首页
编译armbian

编译armbian

作者: 叶迎宪 | 来源:发表于2023-03-19 20:35 被阅读0次

步骤参考
https://github.com/armbian/build

系统ubuntu 20.04

因为主线编译脚本,似乎变成了纯docker,配置文件不知道怎么用了,因此用了分支的脚本
git clone --depth=1 --branch=v23.02 https://github.com/armbian/build

编译中需要用到的软件包,需要手动安装。可能是因为armbian的编译脚本没有适配ubuntu 20.04?
apt install jq aria2 pv ccache binfmt-support pixz u-boot-tools debootstrap zstd qemu-user-static build-essential apt-cacher-ng

手动执行一次./compile.sh,使得产生 userpatches/config-default.conf。加入部分个性化设置,避免每次编译都要弹选择框

KERNEL_CONFIGURE="no"

# additions to compile for the 
BOARD="khadas-vim3l"
BRANCH="current"
RELEASE="bullseye"
BUILD_DESKTOP="no"
BUILD_MINIMAL="yes" 
MAINLINE_MIRROR="tuna"   # 内核源码使用清华的国内镜像
UBOOT_MIRROR="gitee"

1、报错一

[ o.k. ] Checking git sources [ linux-mainline d60c95efffe84428e3611431bf688f50bfc13f4e ]
[ .... ] Fetching updates
error: Server does not allow request for unadvertised object d60c95efffe84428e3611431bf688f50bfc13f4e

似乎是因为linux source的git服务器不允许直接根据commit id来pull。如果使用国内镜像是不会遇到这个问题的
https://stackoverflow.com/questions/51001919/how-to-solve-git-error-server-does-not-allow-request-for-unadvertised-object-3a

vi config/sources/families/include/meson64_common.inc
注释掉 KERNELBRANCH='commit:d60c95efffe84428e3611431bf688f50bfc13f4e'

2、同步网卡驱动

需要github代理,否则同步代码失败率太高了
git config --global url."https://ghproxy.com/github.com/".insteadOf https://github.com/

PS:也试过
git config --global url."https://gitclone.com/".insteadOf https://
不过gitclone对于网卡驱动这部分,分支同步失败的概率很高,因此弃用了

此外,修改一下 lib/functions/general/git.sh,否则在使用代理的情况下,每次都要重新同步代码

        if [[ "$(git rev-parse --git-dir 2> /dev/null)" == ".git" &&
-        "$url" != *"$(git remote get-url origin | sed 's/^.*@//' | sed 's/^.*\/\///' 2> /dev/null)" ]]; then
+        "$url" != *"$(git config remote.origin.url | sed 's/^.*@//' | sed 's/^.*\/\///' 2> /dev/null)" ]]; then
                display_alert "Remote URL does not match, removing existing local copy"
                rm -rf .git ./*
        fi

3、报错二

  CALL    scripts/checksyscalls.sh
arch/arm64/boot/dts/rockchip/overlay/rockchip-spi-spidev.dts:22.11-27.6: Warning (spi_bus_reg): /fragment@1/__overlay__/spidev: SPI bus unit address format error, expected "0"
arch/arm64/boot/dts/rockchip/overlay/rockchip-spi-spidev.dts:36.11-41.6: Warning (spi_bus_reg): /fragment@2/__overlay__/spidev: SPI bus unit address format error, expected "0"
arch/arm64/boot/dts/rockchip/overlay/rockchip-spi-spidev.dts:50.11-55.6: Warning (spi_bus_reg): /fragment@3/__overlay__/spidev: SPI bus unit address format error, expected "0"
arch/arm64/boot/dts/rockchip/overlay/rockchip-spi-spidev.dts:64.11-69.6: Warning (spi_bus_reg): /fragment@4/__overlay__/spidev: SPI bus unit address format error, expected "0"
make[3]: *** [scripts/Makefile.lib:397: arch/arm64/boot/dts/rockchip/overlay/rockchip-fixup.scr] Error 127
make[2]: *** [scripts/Makefile.build:552: arch/arm64/boot/dts/rockchip/overlay] Error 2
make[1]: *** [scripts/Makefile.build:552: arch/arm64/boot/dts/rockchip] Error 2
make: *** [Makefile:1450: dtbs] Error 2

报错信息中没看出问题,只是缺了 mkimage 命令。apt install u-boot-tools

4、报错三

[ o.k. ] Checking for rootfs cache [ current rockpi-4b bullseye yes ]
[ o.k. ] Checking cache [ arm64-bullseye-minimal-d325f9cb-0122.tar.zst ]
[ .... ] Downloading from servers

-> [DownloadCommand.cc:309] errorCode=5 Too slow Downloading speed: 7247 <= 512000(B/s), host:objects.githubusercontent.com

因为从github的下载速度太慢了。用ghproxy下吧
cd cache/rootfs
aria2c https://ghproxy.com/github.com/armbian/cache/releases/download/0122/arm64-bullseye-minimal-d325f9cb-0122.tar.zst

5、报错四

[ o.k. ] Checking cache [ arm64-bullseye-minimal-d325f9cb-0122.tar.zst ]
[ o.k. ] Extracting arm64-bullseye-minimal-d325f9cb-0122.tar.zst [ 0 days old ]
[ .... ] arm64-bullseye-minimal-d325f9cb-0122.tar.zst: 127MiB [40.5MiB/s]
[ o.k. ] Adding Armbian repository and authentication key [ /etc/apt/sources.lis t.d/armbian.list ]
chroot: failed to run command ‘/bin/bash’: Exec format error
chroot: failed to run command ‘/bin/bash’: Exec format error
[ o.k. ] Applying distribution specific tweaks for [ bullseye ]
chroot: failed to run command ‘/bin/bash’: Exec format error
chroot: failed to run command ‘/bin/bash’: Exec format error

这个是从host主机上模拟target主机执行失败导致的。认真的看了一下整个编译日志,发现之前有个警告
update-binfmts: warning: qemu-arm not in database of installed binary formats.
update-binfmts: exiting due to previous errors
update-binfmts: warning: qemu-aarch64 not in database of installed binary format s.
update-binfmts: exiting due to previous errors

是少装了qemu。apt install qemu-user-static

6、报错五,output/debs/ 目录下没有linux-image-current-meson64_23.02.2_arm64.deb

从编译的输出中没看出啥问题,但是到 output/debug 目录看compilation.log可以看到
dpkg-checkbuilddeps: error: Unmet build dependencies: build-essential:native
apt install build-essential

7、报错六

[ error ] ERROR in function install_deb_chroot [ functions/cli/cli-entrypoint.sh:109 -> functions/main/build-tasks.sh:302 -> functions/main/build-tasks.sh:225 -> functions/main/rootfs-image.sh:77 -> functions/rootfs/distro-agnostic.sh:328 -> functions/rootfs/apt-install.sh:22 -> functions/logging/traps.sh:0 ]

直接看不出什么问题,到 output/debug/install.log 看到
[ .... ] Installing [ armbian-bsp-cli-khadas-vim3l_23.02.2_arm64.deb ]
E: Failed to fetch http://deb.debian.org/debian/pool/main/p/python3.9/libpython3.9-minimal_3.9.2-1_arm64.deb Could not connect to localhost:3142 (::1). - connect (111: Connection refused) Could not connect to localhost:3142 (127.0.0.1). - connect (111: Connection refused)
E: Failed to fetch http://deb.debian.org/debian/pool/main/p/python3.9/python3.9-minimal_3.9.2-1_arm64.deb Unable to connect to localhost:3142:

google搜索到,3142是apt-cacher-ng的端口
apt install apt-cacher-ng

相关文章

网友评论

      本文标题:编译armbian

      本文链接:https://www.haomeiwen.com/subject/assdrdtx.html