OpenIPC / firmware

Alternative IP Camera firmware from an open community
https://openipc.org
MIT License
1.28k stars 247 forks source link

Build fail for AK3918EV300 #1541

Open Thugmek opened 2 months ago

Thugmek commented 2 months ago

I have got device with Anyka AN3918EN080V300S SoC and I have tried to build OpenIPC firmware for it. I have got following error:

>>> toolchain-external-custom  Downloading
wget --show-progress --passive-ftp -nd -t5 -T10 -O '/home/thugmek/Documents/OpenIPC/firmware/output/build/.arm926t-gcc-musl-3_4.tgz.ahUzoW/output' 'https://github.com/openipc/firmware/releases/download/latest/arm926t-gcc-musl-3_4.tgz' 
--2024-08-28 16:32:02--  https://github.com/openipc/firmware/releases/download/latest/arm926t-gcc-musl-3_4.tgz
Resolving github.com (github.com)... 140.82.121.3
Connecting to github.com (github.com)|140.82.121.3|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2024-08-28 16:32:03 ERROR 404: Not Found.

wget --show-progress --passive-ftp -nd -t5 -T10 -O '/home/thugmek/Documents/OpenIPC/firmware/output/build/.arm926t-gcc-musl-3_4.tgz.f4ZNZT/output' 'https://sources.buildroot.net/toolchain-external-custom/arm926t-gcc-musl-3_4.tgz' 
--2024-08-28 16:32:03--  https://sources.buildroot.net/toolchain-external-custom/arm926t-gcc-musl-3_4.tgz
Resolving sources.buildroot.net (sources.buildroot.net)... 104.26.1.37, 104.26.0.37, 172.67.72.56, ...
Connecting to sources.buildroot.net (sources.buildroot.net)|104.26.1.37|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2024-08-28 16:32:03 ERROR 404: Not Found.

wget --show-progress --passive-ftp -nd -t5 -T10 -O '/home/thugmek/Documents/OpenIPC/firmware/output/build/.arm926t-gcc-musl-3_4.tgz.JirKl3/output' 'https://sources.buildroot.net/arm926t-gcc-musl-3_4.tgz' 
--2024-08-28 16:32:03--  https://sources.buildroot.net/arm926t-gcc-musl-3_4.tgz
Resolving sources.buildroot.net (sources.buildroot.net)... 104.26.0.37, 172.67.72.56, 104.26.1.37, ...
Connecting to sources.buildroot.net (sources.buildroot.net)|104.26.0.37|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2024-08-28 16:32:03 ERROR 404: Not Found.

make[1]: *** [package/pkg-generic.mk:179: /home/thugmek/Documents/OpenIPC/firmware/output/build/toolchain-external-custom/.stamp_downloaded] Error 1
make[1]: Leaving directory '/home/thugmek/Documents/OpenIPC/firmware/output/buildroot-2024.02.1'
make: *** [Makefile:25: build] Error 2

By further investigation, I have found, there is no longer arm926t-gcc-musl-3_4.tgz in https://github.com/OpenIPC/firmware/releases/tag/latest, but versions for different kernel version are available. I have bumped kernel version to 4.9.129 by changing

BR2_DEFAULT_KERNEL_VERSION="3.4.35"
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_3_4=y

to

BR2_DEFAULT_KERNEL_VERSION="4.9.129"
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9=y

and

BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_4=y

to

BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_9=y

in br-ext-chip-anyka/configs/ak3918ev300_lite_defconfig

Then, I have got bunch of errors while compiling wireguard, complaing abot wireguard requires kernel version >= 3.10. I'm pretty sure kernel 4.9 >= 3.10, I have also tried kernel 3.18, but it didn't helped. I don't need wireguard, so I have removed

BR2_PACKAGE_WIREGUARD_LINUX_COMPAT=y
BR2_PACKAGE_WIREGUARD_TOOLS=y

from br-ext-chip-anyka/configs/ak3918ev300_lite_defconfig, which helped and build was successfull


This is, where my success currently ends. On SD card, I have made FAT partition p1 and copied uImage to it as file. Then I have made empty partition p2 and copied generated squashfs to it with dd. I'm trying to boot from the SD card with

run read_dtb
fatload mmc 0:1 ${loadaddr} uImage
env set bootargs console=ttySAK0,115200n8 root=/dev/mmcblk0p2 rootfstype=squashfs init=/sbin/init ${mtdparts} ${mem} ${memsize}
bootm ${loadaddr} - ${fdtcontroladdr}

but I'm getting Kernel panic - not syncing: cpu pll clk: 708(Mhz) is unusable. I think, this is some misconfigured sanity check, because on original firmware, the clocks are configured also for 708Mhz, as reported during kernel startup:

ak39ev330_clk: CPU(JCLK): 708(Mhz)
ak39ev330_clk: MEMDDR2(DPHY): 354(Mhz)
ak39ev330_clk: VCLK: 320(Mhz)

I will continue in my work and will report progress. If you have any hints, I will appreciate them. If you want some additional information, feel free to ask.

Thugmek commented 2 months ago

So I was completely wrong about bumping kernel to other version. There is custom patched kernel repo, where is version 3.4 only. I have never worked with buildroot before, so it's little confusing for me, sorry. I have tried to build it with bootlin and buildroot toolchains, which didn't produce any error, but also didn't produce any output image. It did something for quite long time, but something is clearly missing.