I am in the process of porting Mender for the NanoPi Neo2 using openwrt. Yocto is not an option, but do have the go compiler available. I am starting with u-boot, since porting the Mender app seems straightforward.
added CONFIG_BOOTCOUNT_LIMIT=y, CONFIG_BOOTCOUNT_ENV=y, CONFIG_ENV_IS_IN_MMC=y to default uboot config for my board (nanopi_neo2_defconfig)
When compiling uboot, get this error:
“include/config_mender.h:59:5: error: #error CONFIG_ENV_OFFSET is not the same as MENDER_UBOOT_ENV_STORAGE_DEVICE_OFFSET_1. Either set it to the same value (check for example in the defconfig file), or make sure it is not defined at all…”
Looking into this, MENDER_UBOOT_ENV_STORAGE_DEVICE_OFFSET_1 appears to come from the uboot environment and I see no config value for it.
Question: what should I set CONFIG_ENV_OFFSET to, to get past this?, Or, is there something else I should be doing?
If this question is in wrong place, please move it and let me know.
set CONFIG_ENV_OFFSET = 0x400000 (same as MENDER_UBOOT_ENV_STORAGE_DEVICE_OFFSET_1)
U-boot compiled OK, now have this error, which means I have to do my math…
I’m sticking to u-boot 2018-11 (current openwrt trunk) and had to refresh the Mender patches:
[root@localhost trunk]# ls Custom/package/boot/uboot-sunxi/files/*.patch
Custom/package/boot/uboot-sunxi/files/0001-env-Kconfig-remove-defaults-for-SUNXI.patch
Custom/package/boot/uboot-sunxi/files/0002-configs-sunxi-add-Mender-required-options.patch
Custom/package/boot/uboot-sunxi/files/0002-Generic-boot-code-for-Mender.patch
Custom/package/boot/uboot-sunxi/files/0003-Integration-of-Mender-boot-code-into-U-Boot.patch
I got around the u-boot size issue by un-reverting some of the (feature removal) patches in mrsch’s link above.
now, I am stuck at many gpio* link failures, for example:
aarch64-openwrt-linux-gnu-ld.bfd: drivers/built-in.o: in function sunxi_mmc_getcd_legacy': /home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/mmc/sunxi_mmc.c:478: undefined reference togpio_get_value’
Had a discussion with my employer. They are willing to place my openwrt changes in public domain. Are you interested in hosting this and maintaining once done?
@rossbcan did you try to build u-boot without mender patches first? It looks like that there are some missing symbols which should be fixable. I’ll check tomorrow and get back to you. Thanks.
Yes, It builds correctly without patches. Currently pursuing whether CONFIG_DM_MMC should be set
Here’s the errors (legacy is what make me suspect DM issues):
aarch64-openwrt-linux-gnu-ld.bfd: drivers/built-in.o: in function sunxi_mmc_getcd_legacy': /home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/mmc/sunxi_mmc.c:478: undefined reference to gpio_get_value’
aarch64-openwrt-linux-gnu-ld.bfd: drivers/built-in.o: in function mmc_resource_init': /home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/mmc/sunxi_mmc.c:87: undefined reference to gpio_request’
aarch64-openwrt-linux-gnu-ld.bfd: /home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/mmc/sunxi_mmc.c:90: undefined reference to gpio_direction_input' aarch64-openwrt-linux-gnu-ld.bfd: drivers/built-in.o: in function ns16550_serial_setbrg’:
/home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/serial/ns16550.c:326: undefined reference to dev_get_priv' aarch64-openwrt-linux-gnu-ld.bfd: drivers/built-in.o: in function ns16550_serial_pending’:
/home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/serial/ns16550.c:306: undefined reference to dev_get_priv' aarch64-openwrt-linux-gnu-ld.bfd: drivers/built-in.o: in function ns16550_serial_putc’:
/home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/serial/ns16550.c:286: undefined reference to dev_get_priv' aarch64-openwrt-linux-gnu-ld.bfd: drivers/built-in.o: in function ns16550_serial_getc’:
/home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/serial/ns16550.c:316: undefined reference to dev_get_priv' aarch64-openwrt-linux-gnu-ld.bfd: drivers/built-in.o: in function ns16550_serial_probe’:
/home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/serial/ns16550.c:339: undefined reference to dev_get_priv' aarch64-openwrt-linux-gnu-ld.bfd: /home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/serial/ns16550.c:347: undefined reference to dev_get_platdata’
aarch64-openwrt-linux-gnu-ld.bfd: drivers/built-in.o: in function sunxi_gpio_set_value': /home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/gpio/sunxi_gpio.c:195: undefined reference to dev_get_platdata’
aarch64-openwrt-linux-gnu-ld.bfd: drivers/built-in.o: in function sunxi_gpio_get_value': /home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/gpio/sunxi_gpio.c:182: undefined reference to dev_get_platdata’
aarch64-openwrt-linux-gnu-ld.bfd: drivers/built-in.o: in function sunxi_gpio_get_function': /home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/gpio/sunxi_gpio.c:204: undefined reference to dev_get_platdata’
aarch64-openwrt-linux-gnu-ld.bfd: drivers/built-in.o: in function sunxi_gpio_direction_output': /home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/gpio/sunxi_gpio.c:171: undefined reference to dev_get_platdata’
aarch64-openwrt-linux-gnu-ld.bfd: drivers/built-in.o:/home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/gpio/sunxi_gpio.c:161: more undefined references to dev_get_platdata' follow aarch64-openwrt-linux-gnu-ld.bfd: drivers/built-in.o: in function gpio_sunxi_probe’:
/home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/gpio/sunxi_gpio.c:264: undefined reference to dev_get_uclass_priv' aarch64-openwrt-linux-gnu-ld.bfd: drivers/built-in.o: in function gpio_sunxi_bind’:
/home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/gpio/sunxi_gpio.c:287: undefined reference to dev_get_driver_data' aarch64-openwrt-linux-gnu-ld.bfd: /home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/gpio/sunxi_gpio.c:296: undefined reference to devfdt_get_addr’
aarch64-openwrt-linux-gnu-ld.bfd: /home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/gpio/sunxi_gpio.c:308: undefined reference to device_bind' aarch64-openwrt-linux-gnu-ld.bfd: drivers/built-in.o: in function sunxi_gpio_xlate’:
/home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/gpio/sunxi_gpio.c:221: undefined reference to device_get_child' aarch64-openwrt-linux-gnu-ld.bfd: drivers/built-in.o: in function sunxi_name_to_gpio’:
/home/rossb/OpenWrt/trunk/build_dir/target-aarch64_cortex-a53_glibc/u-boot-nanopi_neo2/u-boot-2018.11/drivers/gpio/sunxi_gpio.c:154: undefined reference to `gpio_lookup_name’
I’m bit confused now. Without mender patches it builds or not (in previous post it still shows some issues)? Because mender didn’t add anything to sunxi mmc stuff. Do you use nanopi_neo2_defconfig and which toolchain version? Thanks.
Build or not: Without Mender patches, (with and without defconfig changes) builds OK. With Mender patches, two issues. (a) size, stripped some features (extra defconfig, ReadMe.rtf), (b) once past size issue, gpio* related link errors as above.
Caveat: apply patches after regular u-boot patches.
The MENDER_ROOTFS_PART_A/B_NUMBER_HEX should be assigned a number, or is $MENDER_ROOTFS_PART_A_NUMBER_HEX something specific to OpenWRT, meaning that they will resolved to something somehow?
Same applies to the MENDER_UBOOT_PRE/POST_SETUP_COMMANDS commands.