orangepi-xunlong / u-boot-orangepi

80 stars 92 forks source link

OpenWRT pylibfdt does not seem to be available with python3 #17

Open pkopylov opened 1 month ago

pkopylov commented 1 month ago

I tried to build OpenWRT with package/boot/sunxi-h618. Here is package Makefile header. Please pay attention it links to this repository commits:

╰─$ head -n 15 Makefile 
#
# Copyright (C) 2013-2016 OpenWrt.org
# Copyright (C) 2017 Yousong Zhou
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/orangepi-xunlong/u-boot-orangepi
PKG_SOURCE_DATE:=2024-01
PKG_SOURCE_VERSION:=a4d4b0e24e185e84dd02f06f53999a8effde86db

So during the build process I encountered an error shown below:

if test "/mnt/data/pavel/work/001_OpenWRT/18_sunxi/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-sunxi_cortexa53/linux-6.1.74/scripts/dtc/dtc" = "./scripts/dtc/dtc"; then \
    make -f ./scripts/Makefile.build obj=scripts/dtc; \
else \
    if ! /mnt/data/pavel/work/001_OpenWRT/18_sunxi/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-sunxi_cortexa53/linux-6.1.74/scripts/dtc/dtc -v >/dev/null; then \
        echo '*** Failed to check dtc version: /mnt/data/pavel/work/001_OpenWRT/18_sunxi/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-sunxi_cortexa53/linux-6.1.74/scripts/dtc/dtc'; \
        false; \
    else \
        if test "010601" -lt 010406; then \
            echo '*** Your dtc is too old, please upgrade to dtc 010406 or newer'; \
            false; \
        else \
            if [ -n "y" ]; then \
                if ! echo "import libfdt" | python3 2>/dev/null; then \
                    echo '*** pylibfdt does not seem to be available with python3'; \
                    false; \
                fi; \
            fi; \
        fi; \
    fi; \
fi
*** pylibfdt does not seem to be available with python3
make[4]: *** [Makefile:2014: scripts_dtc] Error 1
make[4]: Leaving directory '/mnt/data/pavel/work/001_OpenWRT/18_sunxi/openwrt/build_dir/target-aarch64_cortex-a53_musl/u-boot-orangepi_zero3/u-boot-2024-01-a4d4b0e2'
make[3]: *** [Makefile:68: /mnt/data/pavel/work/001_OpenWRT/18_sunxi/openwrt/build_dir/target-aarch64_cortex-a53_musl/u-boot-orangepi_zero3/u-boot-2024-01-a4d4b0e2/.built] Error 2
make[3]: Leaving directory '/mnt/data/pavel/work/001_OpenWRT/18_sunxi/openwrt/package/boot/uboot-sunxi-h618'

The platform I use to build is Ubuntu22.04.

pkopylov commented 1 month ago

It looks like Ubuntu 22.04 issue, which has an old libfdt. To fix the problem, the modern (1.7.0) libfdt should be installed. The farther commands were used to do so:

sudo apt-get install swig python3-dev
sudo apt remove libfdt1
git clone git://git.kernel.org/pub/scm/utils/dtc/dtc.git
cd dtc
make
sudo make install PREFIX=/usr