Closed lone0 closed 7 months ago
Actually I have no idea with this issue. The support of X2000 is mainly done by @XBurst at this moment.
Could you try starting from the CU2000 board config at this moment? It should compile at least.
Hi Reimu,
Thanks for your response.
Could you try starting from the CU2000 board config at this moment? It should compile at least.
If you mean:
System type (Ingenic SoC based machines) --->
Machine type (YSH & ATIL CU2000 Module with Neo backplane) --->
It does go further, but not much. When I typed make all, it gave:
make -f ./scripts/Makefile.vmlinux_o
make -f ./scripts/Makefile.modpost
make -f ./scripts/Makefile.vmlinux
make -f ./scripts/Makefile.build obj=arch/mips/boot/compressed \
VMLINUX_LOAD_ADDRESS=0xffffffff80100000 LINKER_LOAD_ADDRESS=0x80100000 VMLINUX_ENTRY_ADDRESS=0xffffffff806e22a8 PLATFORM="ingenic/ generic/" ITS_INPUTS="vmlinux.its.S" ADDR_BITS=32 32bit-bfd=elf32-tradlittlemips arch/mips/boot/vmlinuz
make -f ./scripts/Makefile.build obj=arch/mips/boot VMLINUX=vmlinux \
VMLINUX_LOAD_ADDRESS=0xffffffff80100000 LINKER_LOAD_ADDRESS=0x80100000 VMLINUX_ENTRY_ADDRESS=0xffffffff806e22a8 PLATFORM="ingenic/ generic/" ITS_INPUTS="vmlinux.its.S" ADDR_BITS=32 arch/mips/boot/vmlinux.gz.itb
make[1]: *** No rule to make target 'generic//vmlinux.its.S', needed by 'arch/mips/boot/vmlinux.its.S'. Stop.
arch/mips/Makefile:382: recipe for target 'vmlinux.gz.itb' failed
make: *** [vmlinux.gz.itb] Error 2
Before this error, both vmlinux/vmlinuz and cu2000-neo.dtb are out. Really wondering what this stage is doing.
The error:
make -f ./scripts/Makefile.build obj=arch/mips/boot VMLINUX=vmlinux \
VMLINUX_LOAD_ADDRESS=0xffffffff80100000 LINKER_LOAD_ADDRESS=0x80100000 VMLINUX_ENTRY_ADDRESS=0xffffffff806e22a8 PLATFORM="ingenic/ generic/" ITS_INPUTS="vmlinux.its.S" ADDR_BITS=32 arch/mips/boot/vmlinux.gz.itb
arch/mips/boot/vmlinux.its.S: ./arch/mips/ingenic/ generic//vmlinux.its.S FORCE
make[1]: *** No rule to make target 'generic//vmlinux.its.S', needed by 'arch/mips/boot/vmlinux.its.S'. Stop.
arch/mips/Makefile:382: recipe for target 'vmlinux.gz.itb' failed
make: *** [vmlinux.gz.itb] Error 2
occurs in arch/mips/boot/Makefile, line 120:
$(obj)/vmlinux.its.S: $(addprefix $(srctree)/arch/mips/$(PLATFORM)/,$(ITS_INPUTS)) FORCE
When PLATFORM="ingenic/ generic/"
, the macro addprefix turns out to be ./arch/mips/ingenic/ generic//vmlinux.its.S
, and is interpreted as two filenames: ./arch/mips/ingenic/, and generic//vmlinux.its.S. Apparently the latter one doesn't exist.
The two platform names come from arch/mips/Kconfig:
config MACH_INGENIC_SOC
bool "Ingenic SoC based machines"
select MIPS_GENERIC
select MACH_INGENIC
And takes effect in arch/mips/Kbuild.platforms, line 14
platform-$(CONFIG_MACH_INGENIC) += ingenic/
platform-$(CONFIG_MIPS_GENERIC) += generic/
Any suggestions are welcome, thank in advance.
After I hardcoded the $(PLATFORM), I went a step further and then hit another brick wall:
make -f ./scripts/Makefile.build obj=arch/mips/boot/compressed \
VMLINUX_LOAD_ADDRESS=0xffffffff80100000 LINKER_LOAD_ADDRESS=0x80100000 VMLINUX_ENTRY_ADDRESS=0xffffffff806e22a8 PLATFORM="ingenic/ generic/" ITS_INPUTS="vmlinux.its.S" ADDR_BITS=32 32bit-bfd=elf32-tradlittlemips arch/mips/boot/vmlinuz
make -f ./scripts/Makefile.build obj=arch/mips/boot VMLINUX=vmlinux \
VMLINUX_LOAD_ADDRESS=0xffffffff80100000 LINKER_LOAD_ADDRESS=0x80100000 VMLINUX_ENTRY_ADDRESS=0xffffffff806e22a8 PLATFORM="ingenic/ generic/" ITS_INPUTS="vmlinux.its.S" ADDR_BITS=32 arch/mips/boot/vmlinux.gz.itb
cat arch/mips/generic/vmlinux.its.S >arch/mips/boot/vmlinux.its.S
/home/zhenxi/buildroot-mips/br-mips32/output/host/bin/mipsel-linux-objcopy -O binary --remove-section=.reginfo --remove-section=.mdebug --remove-section=.comment --remove-section=.note --remove-section=.pdr --remove-section=.options --remove-section=.MIPS.options vmlinux arch/mips/boot/vmlinux.bin
/home/zhenxi/buildroot-mips/br-mips32/output/host/bin/mipsel-linux-gcc -E -P -C -o arch/mips/boot/vmlinux.gz.its arch/mips/boot/vmlinux.its.S -DKERNEL_NAME="\"Linux 6.1.28\"" -DVMLINUX_BINARY="\"vmlinux.bin.gz\"" -DVMLINUX_COMPRESSION="\"gzip\"" -DVMLINUX_LOAD_ADDRESS=0xffffffff80100000 -DVMLINUX_ENTRY_ADDRESS=0xffffffff806e22a8 -DADDR_BITS=32 -DADDR_CELLS=1
cat arch/mips/boot/vmlinux.bin | gzip -n -f -9 > arch/mips/boot/vmlinux.bin.gz
env PATH="./scripts/dtc:/home/zhenxi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/zhenxi/buildroot-mips/br-mips32/output/host/bin/" /bin/sh ./scripts/mkuboot.sh -D "-I dts -O dtb -p 500 --include ./arch/mips --warning no-unit_address_vs_reg" -f arch/mips/boot/vmlinux.gz.its arch/mips/boot/vmlinux.gz.itb
/home/zhenxi/buildroot-mips/br-mips32/output/host/bin/mkimage: unsupported type Flat Device Tree
arch/mips/boot/Makefile:173: recipe for target 'arch/mips/boot/vmlinux.gz.itb' failed
make[1]: *** [arch/mips/boot/vmlinux.gz.itb] Error 1
arch/mips/Makefile:382: recipe for target 'vmlinux.gz.itb' failed
make: *** [vmlinux.gz.itb] Error 2
Turned out that it is an issue in mkimage, a tool from buildroot, not the kernel.
Now the uImage is out, and it boots on Halley5...and dies ^_^
Starting kernel ...
[kernelv6.1.log](https://github.com/Ingenic-community/linux/files/13750370/kernelv6.1.log)
[ 0.000000] Linux version 6.1.28 (zhenxi/.ccache/linux-v6.1.y@builder2) (mipsel-buildroot-linux-gnu-gcc.br_real (Buildroot 2023.11-2-gad6bc91a0a) 12.3.0, GNU ld (GNU Binutils) 2.40) #1 SMP PREEMPT Fri Dec 22 04:00:30 UTC 2023
[ 0.000000] CPU0 revision is: 00132000 (Ingenic XBurst II)
[ 0.000000] FPU revision is: 00f32000
[ 0.000000] MIPS: machine is Ingenic Halley5 Development Board
[ 0.000000] earlycon: x1000_uart0 at MMIO 0x10033000 (options '115200n8')
......
[ 2.541783] Initialise system trusted keyrings
[ 2.547243] workingset: timestamp_bits=14 max_order=15 bucket_order=1
[ 23.567446] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
[ 23.573558] rcu: 1-....: (1 ticks this GP) idle=0774/0/0x3 softirq=9/10 fqs=1050
[ 23.581161] Sending NMI from CPU 0 to CPUs 1:
[ 23.585566] NMI backtrace for cpu 1
[ 86.617447] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
Anyway this IS a step towards mainline kernel. That is a good sign.
The following is my modifications.
diff -ur linux-v6.1.y-origin/arch/mips/boot/dts/ingenic/halley5.dts linux-v6.1.y/arch/mips/boot/dts/ingenic/halley5.dts
--- linux-v6.1.y-origin/arch/mips/boot/dts/ingenic/halley5.dts 2023-09-15 23:02:58.000000000 +0000
+++ linux-v6.1.y/arch/mips/boot/dts/ingenic/halley5.dts 2023-12-22 03:58:13.995893380 +0000
@@ -221,7 +221,7 @@
};
};
-&spi0 {
+&ssi0 {
status = "disable";
pinctrl-names = "default";
diff -ur linux-v6.1.y-origin/arch/mips/boot/Makefile linux-v6.1.y/arch/mips/boot/Makefile
--- linux-v6.1.y-origin/arch/mips/boot/Makefile 2023-09-15 23:02:58.000000000 +0000
+++ linux-v6.1.y/arch/mips/boot/Makefile 2023-12-22 04:53:11.903982296 +0000
@@ -117,7 +117,7 @@
quiet_cmd_its_cat = CAT $@
cmd_its_cat = cat $(real-prereqs) >$@
-$(obj)/vmlinux.its.S: $(addprefix $(srctree)/arch/mips/$(PLATFORM)/,$(ITS_INPUTS)) FORCE
+$(obj)/vmlinux.its.S: $(addprefix $(srctree)/arch/mips/generic/,$(ITS_INPUTS)) FORCE
$(call if_changed,its_cat)
targets += vmlinux.its
Hi guys, glad to tell you that I made some progress.
To address this hang-up on boot, I fiddled with kernel configuration and found that, when the following items are turned on, the kernel can finish the booting and switch to user space.
+CONFIG_LOCKUP_DETECTOR=y
+CONFIG_SOFTLOCKUP_DETECTOR=y
Now things seem very promising, although the boot still halt at some place.
Starting kernel ...
[ 0.000000] Linux version 6.1.28 (zhenxi/.ccache/linux-v6.1.y@builder2) (mipsel-buildroot-linux-gnu-gcc.br_real (Buildroot 2023.11-3-g6965832e85) 12.3.0, GNU ld (GNU Binutils) 2.40) #1 SMP PREEMPT Tue Dec 26 01:36:10 UTC 2023
[ 0.000000] CPU0 revision is: 00132000 (Ingenic XBurst II)
[ 0.000000] FPU revision is: 00f32000
...
[ 4.050275] Run /sbin/init as init process
[ 4.071528] process '/bin/busybox' started with executable stack
[ 4.557984] EXT4-fs (mmcblk0p7): re-mounted. Quota mode: disabled.
Saving 256 bits of non-creditable seed for next boot
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Starting network: [ 4.842819] ingenic-mac 134a0000.mac eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[ 4.851416] ingenic-mac 134a0000.mac eth0: PHY [stmmac-0:00] driver [Generic PHY] (irq=POLL)
[ 4.867609] ingenic-mac 134a0000.mac eth0: No Safety Features support found
[ 5.074872] ingenic-mac 134a0000.mac eth0: IEEE 1588-2008 Advanced Timestamp supported
[ 5.083079] ingenic-mac 134a0000.mac eth0: registered PTP clock
[ 5.090901] ingenic-mac 134a0000.mac eth0: configuring for phy/rgmii link mode
udhcpc: started, v1.36.1
udhcpc: broadcasting discover
udhcpc: no lease, forking to background
OK
^C^C^C
^C^C
dd
^C^C
^Z'
@ReimuNotMoe any more hints for me?
Hi guys, you have no idea how exciting this could be, cuz I finally got the login!
[ 1.432935][ T13] Alternate GPT is invalid, using primary GPT.
[ 1.438997][ T13] mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8
[ 4.068988][ T1] EXT4-fs (mmcblk0p7): mounted filesystem without journal. Quota mode: disabled.
[ 4.078029][ T1] VFS: Mounted root (ext4 filesystem) on device 179:7.
[ 4.094316][ T1] devtmpfs: mounted
[ 4.098121][ T1] Freeing unused kernel image (initmem) memory: 232K
[ 4.104640][ T1] This architecture does not have kernel memory protection.
[ 4.111789][ T1] Run /sbin/init as init process
[ 4.141043][ T1] process '/bin/busybox' started with executable stack
[ 4.618676][ T187] EXT4-fs (mmcblk0p7): re-mounted. Quota mode: disabled.
Saving 256 bits of non-creditable seed for next boot
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Starting network: [ 4.919618][ T228] ingenic-mac 134a0000.mac eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[ 4.928821][ T228] ingenic-mac 134a0000.mac eth0: PHY [stmmac-0:00] driver [Generic PHY] (irq=POLL)
[ 4.946613][ T228] ingenic-mac 134a0000.mac eth0: No Safety Features support found
[ 5.154410][ T228] ingenic-mac 134a0000.mac eth0: IEEE 1588-2008 Advanced Timestamp supported
[ 5.163341][ T228] ingenic-mac 134a0000.mac eth0: registered PTP clock
[ 5.171554][ T228] ingenic-mac 134a0000.mac eth0: configuring for phy/rgmii link mode
udhcpc: started, v1.36.1
udhcpc: broadcasting discover
udhcpc: no lease, forking to background
OK
Welcome to Buildroot
buildroot login: root
# name -a
Linux buildroot 6.1.28 #6 SMP Tue Dec 26 04:01:04 UTC 2023 mips GNU/Linux
# ifconfig
eth0 Link encap:Ethernet HWaddr F6:F2:BF:F5:5A:9C
UP BROADCAST MULTICAST MTU:1500 Metric:1
...
# cat /proc/cpuinfo
system type : X2000
machine : Ingenic Halley5 Development Board
processor : 0
cpu model : Ingenic XBurst II V0.0 FPU V0.0
BogoMIPS : 2393.70
wait instruction : yes
microsecond timers : no
tlb_entries : 288
extra interrupt vector : yes
hardware watchpoint : yes, count: 1, address/irw mask: [0x0fff]
isa : mips1 mips2 mips32r1 mips32r2 mips32r5
ASEs implemented :
Options implemented : tlb ftlb tlbinv 4kex fpu 32fpr prefetch mcheck ejtag llsc rixi userlocal perf_cntr_intr_bit nan_2008 ebase_wg perf
Turned out I just need to designate ttyS3, rather than ttyS0, as the GETTY_PORT in buildroot.
Hi @ReimuNotMoe , today I got the onboard WIFI working:
# iw wlan0 info
Interface wlan0
ifindex 4
wdev 0x1
addr 70:f7:54:84:76:72
type managed
wiphy 0
channel 34 (5170 MHz), width: 20 MHz, center1: 5170 MHz
txpower 31.00 dBm
This involves a crash bug in the ingenic SDHCI driver, with a one-line patch:
crash log:
[ 0.812814] CPU 0 Unable to handle kernel paging request at virtual address 00000004, epc == 806e7754, ra == 8050db40
[ 0.818306] NET: Registered PF_INET6 protocol family
[ 0.823545] Oops[#1]:
[ 0.828939] ingenic,sdhci 13460000.sdhci: allocated mmc-pwrseq
[ 0.830627] CPU: 0 PID: 8 Comm: kworker/u4:0 Not tainted 6.1.28 #11
[ 0.836444] CPU 1 Unable to handle kernel paging request at virtual address 00000004, epc == 806e7754, ra == 8050db40
[ 0.842689] Workqueue: events_unbound async_run_entry_fn
[ 0.842712] $ 0 : 00000000 00000001 eb6a5f83 eb6a5f83
[ 0.863809] $ 4 : 808761f0 00000001 80c63c68 00000000
[ 0.869031] $ 8 : 00000024 806dcf18 00000000 00000000
[ 0.874250] $12 : 00000000 00000000 0000725a ffffffff
[ 0.879469] $16 : 00000000 80d07210 80d07200 80d07200
[ 0.884687] $20 : 80890000 80c07005 80c0601c 80c06048
[ 0.889906] $24 : 00000002 00000000
[ 0.895125] $28 : 80c62000 80c63d80 00000000 8050db40
[ 0.900344] Hi : 00000005
[ 0.903210] Lo : 00000001
[ 0.906077] epc : 806e7754 sdhci_get_property+0x40/0x2cc
[ 0.911553] ra : 8050db40 sdhci_ingenic_probe+0x1bc/0x204
[ 0.917202] Status: 14001c03 KERNEL EXL IE
[ 0.921378] Cause : 08800008 (ExcCode 02)
[ 0.925374] BadVA : 00000004
[ 0.928241] PrId : 00132000 (Ingenic XBurst II)
[ 0.932843] Process kworker/u4:0 (pid: 8, threadinfo=(ptrval), task=(ptrval), tls=00000000)
[ 0.941177] Stack : 1345ffff 8000c0d4 00000200 00000000 00000000 eb6a5f83 80eb62a0 00000000
[ 0.949529] 80d07210 80d07200 80fd2980 8050db40 80d07210 808bf764 808bf764 00000000
[ 0.957880] 80d07210 808bf764 808bf764 00000000 00000000 80445884 00000000 808bf764
[ 0.966230] 00000000 00000000 80c07005 80d07210 00000000 80443b84 00000000 8014f960
[ 0.974579] 00000000 80c4c080 81002a00 80d07210 80930000 80d07210 80930000 80443f14
[ 0.982929] ...
[ 0.985367] Call Trace:
[ 0.987801] [<806e7754>] sdhci_get_property+0x40/0x2cc
[ 0.992931] [<8050db40>] sdhci_ingenic_probe+0x1bc/0x204
[ 0.998231] [<80445884>] platform_probe+0x50/0x88
It crashes at sdhci-pltfm.c line 86:
void sdhci_get_property(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct sdhci_host *host = platform_get_drvdata(pdev); <-- return NULL
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
u32 bus_width;
The fix is straightforward, that is to assign platform drvdata before going into sdhci_get_property():
diff -ur output/build/linux-v6.1.y.orig/drivers/mmc/host/sdhci-ingenic.c output/build/linux-v6.1.y/drivers/mmc/host/sdhci-ingenic.c
--- output/build/linux-v6.1.y.orig/drivers/mmc/host/sdhci-ingenic.c 2023-09-15 23:02:58.000000000 +0000
+++ output/build/linux-v6.1.y/drivers/mmc/host/sdhci-ingenic.c 2024-01-10 07:16:24.625270031 +0000
@@ -159,6 +159,7 @@
if (IS_ERR(host->ioaddr))
return PTR_ERR(host->ioaddr);
+ platform_set_drvdata(pdev, host);
host->hw_name = "ingenic-sdhci";
host->ops = &sdhci_ingenic_ops;
host->quirks = 0;
I would like to share this knowledge, so please let me know, do you accept patch or pull request?
Hi @ReimuNotMoe , today I got the onboard WIFI working:
# iw wlan0 info Interface wlan0 ifindex 4 wdev 0x1 addr 70:f7:54:84:76:72 type managed wiphy 0 channel 34 (5170 MHz), width: 20 MHz, center1: 5170 MHz txpower 31.00 dBm
This involves a crash bug in the ingenic SDHCI driver, with a one-line patch:
crash log:
[ 0.812814] CPU 0 Unable to handle kernel paging request at virtual address 00000004, epc == 806e7754, ra == 8050db40 [ 0.818306] NET: Registered PF_INET6 protocol family [ 0.823545] Oops[#1]: [ 0.828939] ingenic,sdhci 13460000.sdhci: allocated mmc-pwrseq [ 0.830627] CPU: 0 PID: 8 Comm: kworker/u4:0 Not tainted 6.1.28 #11 [ 0.836444] CPU 1 Unable to handle kernel paging request at virtual address 00000004, epc == 806e7754, ra == 8050db40 [ 0.842689] Workqueue: events_unbound async_run_entry_fn [ 0.842712] $ 0 : 00000000 00000001 eb6a5f83 eb6a5f83 [ 0.863809] $ 4 : 808761f0 00000001 80c63c68 00000000 [ 0.869031] $ 8 : 00000024 806dcf18 00000000 00000000 [ 0.874250] $12 : 00000000 00000000 0000725a ffffffff [ 0.879469] $16 : 00000000 80d07210 80d07200 80d07200 [ 0.884687] $20 : 80890000 80c07005 80c0601c 80c06048 [ 0.889906] $24 : 00000002 00000000 [ 0.895125] $28 : 80c62000 80c63d80 00000000 8050db40 [ 0.900344] Hi : 00000005 [ 0.903210] Lo : 00000001 [ 0.906077] epc : 806e7754 sdhci_get_property+0x40/0x2cc [ 0.911553] ra : 8050db40 sdhci_ingenic_probe+0x1bc/0x204 [ 0.917202] Status: 14001c03 KERNEL EXL IE [ 0.921378] Cause : 08800008 (ExcCode 02) [ 0.925374] BadVA : 00000004 [ 0.928241] PrId : 00132000 (Ingenic XBurst II) [ 0.932843] Process kworker/u4:0 (pid: 8, threadinfo=(ptrval), task=(ptrval), tls=00000000) [ 0.941177] Stack : 1345ffff 8000c0d4 00000200 00000000 00000000 eb6a5f83 80eb62a0 00000000 [ 0.949529] 80d07210 80d07200 80fd2980 8050db40 80d07210 808bf764 808bf764 00000000 [ 0.957880] 80d07210 808bf764 808bf764 00000000 00000000 80445884 00000000 808bf764 [ 0.966230] 00000000 00000000 80c07005 80d07210 00000000 80443b84 00000000 8014f960 [ 0.974579] 00000000 80c4c080 81002a00 80d07210 80930000 80d07210 80930000 80443f14 [ 0.982929] ... [ 0.985367] Call Trace: [ 0.987801] [<806e7754>] sdhci_get_property+0x40/0x2cc [ 0.992931] [<8050db40>] sdhci_ingenic_probe+0x1bc/0x204 [ 0.998231] [<80445884>] platform_probe+0x50/0x88
It crashes at sdhci-pltfm.c line 86:
void sdhci_get_property(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct sdhci_host *host = platform_get_drvdata(pdev); <-- return NULL struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); u32 bus_width;
The fix is straightforward, that is to assign platform drvdata before going into sdhci_get_property():
diff -ur output/build/linux-v6.1.y.orig/drivers/mmc/host/sdhci-ingenic.c output/build/linux-v6.1.y/drivers/mmc/host/sdhci-ingenic.c --- output/build/linux-v6.1.y.orig/drivers/mmc/host/sdhci-ingenic.c 2023-09-15 23:02:58.000000000 +0000 +++ output/build/linux-v6.1.y/drivers/mmc/host/sdhci-ingenic.c 2024-01-10 07:16:24.625270031 +0000 @@ -159,6 +159,7 @@ if (IS_ERR(host->ioaddr)) return PTR_ERR(host->ioaddr); + platform_set_drvdata(pdev, host); host->hw_name = "ingenic-sdhci"; host->ops = &sdhci_ingenic_ops; host->quirks = 0;
I would like to share this knowledge, so please let me know, do you accept patch or pull request?
Of course! Feel free to submit pull requests and I'll merge them.
Hi Guys, I got a X2000 Halley5 dev board and tried to get mainline kernel running on it. When building this kernel, I got the following error messages:
The kernel is being built with buildroot 2023.11.x/gcc 12.3.0, with the following configurations
And the following kernel configurations:
Any hints?