Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidated beagle V support pull #281

Merged
merged 21 commits into from
May 7, 2021
Merged

Conversation

kraj
Copy link
Collaborator

@kraj kraj commented May 5, 2021

This lets us boot a system with musl/sysvinit, glibc based systems still encounters a SEGV followed by kernel crash and freezing the system. However, we do have one combination up and running. There is still work left to do e.g.

  1. Shutdown utility crashes the kernel again so reboot does not work cleanly
  2. Network comes up fine in u-boot but does not acquire IP in userspace
  3. Documentation needs to be generic e.g. kas etc. are nice to have but we also need to document upstream way
  4. initramfs+kernel does not work with fitImage yet

macpijan and others added 16 commits April 30, 2021 23:16
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Update the boot process to follow the HiFive1.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
They dont yet build with clang

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This lends the system non-bootable as kernel waits for rootfs media
forever like below

[    2.011165] mmc_host mmc0: Bus speed (slot 0) = 100000000Hz (slot req 400000Hz, actual 400000HZ div = 125)
[    2.051162] mmc_host mmc1: Bus speed (slot 0) = 100000000Hz (slot req 400000Hz, actual 400000HZ div = 125)
[    2.311113] dw_mmc 10010000.sdio1: Unexpected interrupt latency
[    4.871335] Waiting for root device /dev/mmcblk0p2...

Signed-off-by: Khem Raj <raj.khem@gmail.com>
@kraj kraj requested a review from alistair23 May 5, 2021 06:24
@pdp7
Copy link

pdp7 commented May 5, 2021

Shutdown utility crashes the kernel again so reboot does not work cleanly

Note that @esmil has restart driver working in his v5.12.x branch. This needs to be pulled into starfive-tech/linux:
starfive-tech/linux#8

beaglev.md Outdated Show resolved Hide resolved
beaglev.md Outdated Show resolved Hide resolved
beaglev.md Outdated Show resolved Hide resolved
@kraj kraj force-pushed the kraj/beagleV branch 2 times, most recently from e0980c6 to ce3584b Compare May 5, 2021 07:45
do_deploy need to execute from sstate-cache when the build directory is
empty and system determines that there is no change to u-boot and it
can be reused from sstate, in this scenario deploydir needs to populate
properly, so we can not use WORKDIR in logic

Activate u-boot and opensbi only for beaglev-starlight-jh7100

Signed-off-by: Khem Raj <raj.khem@gmail.com>
kraj added 2 commits May 5, 2021 08:29
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
@kraj
Copy link
Collaborator Author

kraj commented May 5, 2021

Shutdown utility crashes the kernel again so reboot does not work cleanly

Note that @esmil has restart driver working in his v5.12.x branch. This needs to be pulled into starfive-tech/linux:
starfive-tech/linux#8

thanks @pdp7 I think this will be a good option to try and also see if we can get the crashes resolved that we are seeing
with glibc based rootfs

@kraj kraj requested a review from alistair23 May 5, 2021 15:36
@kraj
Copy link
Collaborator Author

kraj commented May 5, 2021

@macpijan can you try TCLIBC = "musl" and see if that boots for you with this pull ?

@kraj
Copy link
Collaborator Author

kraj commented May 5, 2021

with busyboxinit/glibc the system is still seeing glibc segfaults but at least it does not crash the kernel but I cant login either

Yoe Linux 2021.05 beaglev-starlight-jh7100 /dev/ttyS0

beaglev-starlight-jh7100 login: root
[   42.318959] login[266]: unhandled signal 11 code 0x1 at 0x0000000000000030 in libc-2.33.9000.so[3fbdd3f000+106000]
[   42.329448] CPU: 0 PID: 266 Comm: login Not tainted 5.10.6-yocto-standard-starfive #1
[   42.337306] epc: 0000003fbddc2d5a ra : 0000003fbddc4758 sp : 0000003fffdd9850
[   42.344449]  gp : 0000002ad25e4800 tp : 0000003fbde58360 t0 : 0000000000000000
[   42.351674]  t1 : 000000000000016d t2 : 0000000000000000 s0 : 0000002ad25e6600
[   42.358868]  s1 : 0000003fbde501e8 a0 : 0000002ad25e7984 a1 : 0000000000001ffc
[   42.366089]  a2 : 0000003fbde36c88 a3 : 0000000000000000 a4 : 0000000000000000
[   42.373329]  a5 : 0000003fffdd996f a6 : 0000003fbde47c48 a7 : 0000000000000190
[   42.380527]  s2 : 0000000000001ffc s3 : 0000000000000001 s4 : 0000003fbde48134
[   42.387749]  s5 : 0000002ad25e12d2 s6 : 0000003fffdd9aa8 s7 : 0000000000000002
[   42.394980]  s8 : 0000000000000010 s9 : 0000000000000002 s10: 0000002ad25e7984
[   42.402209]  s11: 0000003fbde4f8f8 t3 : 00000014470433a9 t4 : 0000000000000000
[   42.409403]  t5 : ffffffffffffffe7 t6 : 0000000000000031
[   42.414731] status: 8000000200006020 badaddr: 0000000000000030 cause: 000000000000000d
process '/sbin/getty 115200 ttyS0' (pid 266) exited. Scheduling for restart.
starting pid 267, tty '/dev/ttyS0': '/sbin/getty 115200 ttyS0'

Yoe Linux 2021.05 beaglev-starlight-jh7100 /dev/ttyS0

beaglev-starlight-jh7100 login:

So still looking for ways to debug this

@macpijan
Copy link
Contributor

macpijan commented May 5, 2021

Possibly the Ehternet issue is fixable with: starfive-tech/Fedora_on_StarFive#2 (comment) ?

@macpijan
Copy link
Contributor

macpijan commented May 5, 2021

@macpijan can you try TCLIBC = "musl" and see if that boots for you with this pull ?

@kraj It gets me to the prompt with musl:

INIT: Entering runlevel: 5
Configuring network interfaces... [   12.470546] stmmaceth 10020000.gmac eth0: PHY [stmmac-0:00] driver [Generic PHY] (irq=POLL)
[   12.481958] dwmac1000: Master AXI performs fixed burst length
[   12.487780] stmmaceth 10020000.gmac eth0: No Safety Features support found
[   12.494679] stmmaceth 10020000.gmac eth0: No MAC Management Counters available
[   12.501882] stmmaceth 10020000.gmac eth0: IEEE 1588-2008 Advanced Timestamp supported
[   12.515600] stmmaceth 10020000.gmac eth0: configuring for phy/rgmii-txid link mode
udhcpc: started, v1.33.0
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
udhcpc: no lease, forking to background
done.
hwclock: can't open '/dev/misc/rtc': No such file or directory
Starting syslogd/klogd: done

Poky (Yocto Project Reference Distro) 3.3 beaglev-starlight-jh7100 /dev/ttyS0

@kraj
Copy link
Collaborator Author

kraj commented May 5, 2021

@macpijan can you try TCLIBC = "musl" and see if that boots for you with this pull ?

@kraj It gets me to the prompt with musl:

INIT: Entering runlevel: 5
Configuring network interfaces... [   12.470546] stmmaceth 10020000.gmac eth0: PHY [stmmac-0:00] driver [Generic PHY] (irq=POLL)
[   12.481958] dwmac1000: Master AXI performs fixed burst length
[   12.487780] stmmaceth 10020000.gmac eth0: No Safety Features support found
[   12.494679] stmmaceth 10020000.gmac eth0: No MAC Management Counters available
[   12.501882] stmmaceth 10020000.gmac eth0: IEEE 1588-2008 Advanced Timestamp supported
[   12.515600] stmmaceth 10020000.gmac eth0: configuring for phy/rgmii-txid link mode
udhcpc: started, v1.33.0
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
udhcpc: no lease, forking to background
done.
hwclock: can't open '/dev/misc/rtc': No such file or directory
Starting syslogd/klogd: done

Poky (Yocto Project Reference Distro) 3.3 beaglev-starlight-jh7100 /dev/ttyS0

thanks, so can you try the mii-tools workaround and validate it on musl image ?

@macpijan
Copy link
Contributor

macpijan commented May 5, 2021

thanks, so can you try the mii-tools workaround and validate it on musl image ?

@kraj It does not help. It looks like a different kind of issue. I also applied first the mentioned change first (enabled CONFIG_MICREL_PHY instead of the CONFIG_MARVELL_PHY)

EDIT: I also tried with different devicetree patches (from here: starfive-tech/linux#8 (comment)) with the same effect.

@kraj
Copy link
Collaborator Author

kraj commented May 5, 2021

so I tried booting exact same rootfs ext4 on qemuriscv64 and it booted totally fine with glibc without any of those segfaults.

MACHINE=qemuriscv64 bitbake core-image-minimal
MACHINE=qemuriscv64 runqemu build/tmp/deploy/images/beaglev-starlight-jh7100/core-image-minimal-beaglev-starlight-jh7100.ext4 nographic

this will use qemu kernel + beagleV rootfs

README.md Outdated Show resolved Hide resolved
kraj added 2 commits May 5, 2021 16:49
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Glibc based images end up crashing the kernel in init
until thats debugged through lets use musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
@kraj
Copy link
Collaborator Author

kraj commented May 6, 2021

got dunfell rootfs to fail in same manner, now I wonder if its really an issue with OE components or something else in H/W

System time was Fri Jan  0 14:16:10  1191457705.
Setting the System Clock using the Hardware Clock as reference...
hwclock: can't open '/dev/misc/rtc': No such file or directory
System Clock set. System local time is now Fri Jan  0 14:16:10  1191457705.
Starting syslogd/klogd: [   16.923664] syslogd[242]: unhandled signal 11 code 0x1 at 0x0000000000000013 in busybox.nosuid[2adbe6f000+91000]
done[   16.934020] CPU: 1 PID: 242 Comm: syslogd Not tainted 5.10.6-yocto-standard-starfive #1

[   16.939601] klogd[245]: unhandled signal 11 code 0x1 at 0x0000000000000030
[   16.942396] epc: 0000002adbea9982 ra : 0000002adbea9976 sp : 0000003fffce8990
[   16.942404]  gp : 0000002adbf03c40 tp : 0000003febd72830 t0 : 0000000000000000
[   16.942410]  t1 : 000000000000016d t2 : 0000000000001000 s0 : 0000002adbf052a0
[   16.942416]  s1 : 0000002adbef3588 a0 : 0000000000000000 a1 : 0000003febceca58
[   16.942420]  a2 : 0000000000000072 a3 : 0000000000000001 a4 : 0000000000000016
[   16.942427]  a5 : 0000000000000206 a6 : 0000000000000064 a7 : 0000000000000190
[   16.942432]  s2 : 0000000000000099 s3 : 000000000000002e s4 : 0000002adbf04434
[   16.942437]  s5 : 0000003febd8e888 s6 : 0000000000000000 s7 : 0000000000570000
[   16.942443]  s8 : 0000002adbf052f0 s9 : 0000002adbf03f88 s10: 0000002ad9622ef0
[   16.942448]  s11: 0000003fffce8a90 t3 : 00000014470433a9 t4 : 0000000000000000
[   16.942453]  t5 : ffffffffffffffe7 t6 : 0000000000000031
[   16.942460] status: 0000000200004020 badaddr: 0000000000000013 cause: 000000000000000f
[   16.949370]  in libc-2.31.so[3fd3031000+fd000]
[   17.039366] CPU: 0 PID: 245 Comm: klogd Not tainted 5.10.6-yocto-standard-starfive #1
[   17.047212] epc: 0000003fd30adfe8 ra : 0000003fd30afb04 sp : 0000003fffc31860
[   17.054355]  gp : 0000002acdaddc40 tp : 0000003fd31ba830 t0 : 0000000000000000
[   17.061589]  t1 : 000000000000016d t2 : 0000000000001000 s0 : 0000002acdadf2a0
[   17.068783]  s1 : 0000000000001ffc a0 : 0000002acdadf4a4 a1 : 0000000000001ffc
[   17.076009]  a2 : 0000003fd3120460 a3 : 0000000000000000 a4 : 0000000000000000
[   17.083241]  a5 : 0000003fffc3197f a6 : 0000003fd3130c38 a7 : 0000000000000190
[   17.090437]  s2 : 0000000000000001 s3 : 0000003fd313112c s4 : 0000002acdacd3d8
[   17.097662]  s5 : 0000003fffc31aa8 s6 : 0000000000000002 s7 : 0000000000000010
[   17.104893]  s8 : 0000000000000000 s9 : 0000002acdadf4a4 s10: 0000003fffc319e8
[   17.112120]  s11: 0000003fffe98528 t3 : 00000014470433a9 t4 : 0000000000000000
[   17.119314]  t5 : ffffffffffffffe7 t6 : 0000000000000031
[   17.124646] status: 0000000200004020 badaddr: 0000000000000030 cause: 000000000000000d
starting pid 247, tty '/dev/ttyS0': '/sbin/getty 115200 ttyS0'

Yoe Linux 2021.05 beaglev-starlight-jh7100 /dev/ttyS0

beaglev-starlight-jh7100 login:

@kraj
Copy link
Collaborator Author

kraj commented May 6, 2021

@alistair23 should we merge this pull as it gets us somewhere and then send improvements in pieces?

@alistair23
Copy link
Collaborator

I think so

@kraj
Copy link
Collaborator Author

kraj commented May 6, 2021

it seems system time is not being get/set correctly which is causing time/strftime_l.c: __strftime_internal to segfault in glibc, which is called via ctime from busybox klogd function timestamp_and_log, since I did not get into shell its hard to be 100% sure but with some address mappings that's what I can see

Setting the System Clock using the Hardware Clock as reference...
hwclock: can't open '/dev/misc/rtc': No such file or directory
System Clock set. System local time is now Fri Jan  0 14:16:10 UTC 1191457705.
Starting syslogd/klogd: [   17.439208] syslogd[259]: unhandled signal 11 code 0x1 at 0x0000000000000013 in busybox.nosuid[2addbc6000+91000]

now the time is really incorrect and that's what trips glibc.

@kraj kraj merged commit f38d01c into riscv:master May 7, 2021
@kraj
Copy link
Collaborator Author

kraj commented May 7, 2021

For sake of completeness, its all fixed with #282

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants