Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to install java on arm musl?
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3  Next  
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
M95D
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jan 2020
Posts: 94

PostPosted: Sun Jul 21, 2024 7:32 pm    Post subject: Reply with quote

I did install Alpine openjdk package, but I'm stuck again with "Exec format error":
https://forums.gentoo.org/viewtopic-t-1169902.html
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1223
Location: Richmond Hill, Canada

PostPosted: Sun Jul 21, 2024 8:53 pm    Post subject: Reply with quote

M95D wrote:
I did install Alpine openjdk package, but I'm stuck again with "Exec format error":
https://forums.gentoo.org/viewtopic-t-1169902.html


You are really not trying to help youself :?

Without any information on what you install and how this error message come about, how do you expect support?

The "Exec format error" usually refer to binary code is NOT for the running host. from the link we only know you have armv7l, but did you install a right package for the cpu?
Back to top
View user's profile Send private message
M95D
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jan 2020
Posts: 94

PostPosted: Sun Jul 21, 2024 9:24 pm    Post subject: Reply with quote

The other topic provides all the information I have, including lscpu, the Gentoo profile I use, CFLAGS I enabled, "file" output for the executable file, and now I just added a readelf output. That's for the cargo executable. The java executable is exactly the same format, but if you insist, here it is:
Code:

TkB /usr/lib/jvm/java-1.8-openjdk/bin # readelf -h java
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              DYN (Position-Independent Executable file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x541
  Start of program headers:          52 (bytes into file)
  Start of section headers:          4396 (bytes into file)
  Flags:                             0x5000400, Version5 EABI, hard-float ABI
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         8
  Size of section headers:           40 (bytes)
  Number of section headers:         26
  Section header string table index: 25
TkB /usr/lib/jvm/java-1.8-openjdk/bin # java
/usr/bin/java: line 34: /usr/lib/jvm/java-8-openjdk/bin/java: cannot execute binary file: Exec format error
/usr/bin/java: line 34: /usr/lib/jvm/java-8-openjdk/bin/java: No error information
TkB /usr/lib/jvm/java-1.8-openjdk/bin # lscpu
Architecture:             armv7l
  Byte Order:             Little Endian
CPU(s):                   4
  On-line CPU(s) list:    0-3
Vendor ID:                ARM
  Model name:             Cortex-A17
    Model:                1
    Thread(s) per core:   1
    Core(s) per socket:   4
    Socket(s):            1
    Stepping:             r0p1
    CPU(s) scaling MHz:   17%
    CPU max MHz:          1800.0000
    CPU min MHz:          126.0000
    BogoMIPS:             29.95
    Flags:                half fastmult vfp edsp neon vfpv3 tls vfpv4 idiva vfpd32 lpae evtstrm
Vulnerabilities:         
  Gather data sampling:   Not affected
  Itlb multihit:          Not affected
  L1tf:                   Not affected
  Mds:                    Not affected
  Meltdown:               Not affected
  Mmio stale data:        Not affected
  Reg file data sampling: Not affected
  Retbleed:               Not affected
  Spec rstack overflow:   Not affected
  Spec store bypass:      Not affected
  Spectre v1:             Mitigation; __user pointer sanitization
  Spectre v2:             Vulnerable
  Srbds:                  Not affected
  Tsx async abort:        Not affected
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1223
Location: Richmond Hill, Canada

PostPosted: Sun Jul 21, 2024 9:42 pm    Post subject: Reply with quote

M95D,

Yes, I am aware of your other post, I was just wondering which alpinelinux openjdk package you installed. And where you got the error message because from the other post, it is in the build stage you got the error.

Can you thinking of another program have simular charitistic (another programming language, or something external to Gentoo but you mamange got it working) and try to run a readelf on it. Does it show anything different?

I don't have armv7 box handy. I could try to setup a QEMU but not sure if will able to reproduce this.

From your output, the error should not happen. I am not sure, I will do some more digging.

P.S. Can you share output of lddtree on your java binary?
Back to top
View user's profile Send private message
M95D
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jan 2020
Posts: 94

PostPosted: Sun Jul 21, 2024 10:02 pm    Post subject: Reply with quote

The binary is from the Alpine packages recommended above. The error appears during the emerge too. I just ran it manually this time because the output is more readable than digging through dozens of lines of emerge log.

lddtree is interesting! There's a significant difference from native-built bash executable:
Code:

TkB /usr/lib/jvm/java-1.8-openjdk/bin # lddtree java
java => ./java (interpreter => /lib/ld-musl-armhf.so.1)
    libjli.so => ./../lib/aarch32/jli/libjli.so
        libz.so.1 => /usr/lib/libz.so.1
            libc.so => /usr/lib/libc.so
    libc.musl-armv7.so.1 => not found
TkB /usr/lib/jvm/java-1.8-openjdk/bin # lddtree /bin/bash
bash => /bin/bash (interpreter => /lib/ld-musl-armhf.so.1)
    libreadline.so.8 => /usr/lib/libreadline.so.8
        libtinfow.so.6 => /lib/libtinfow.so.6
    libtinfo.so.6 => /lib/libtinfo.so.6
    libc.so => /usr/lib/libc.so

find -xdev -name "libc.musl*" returns nothing.
sys-libs/musl-1.25-r1 did not install a libc.musl-armv7.so.1 :
Code:

TkB / # equery f musl | grep libc
/usr/lib/libc.a
/usr/lib/libc.so
TkB / #


LE:
I made symlinks for libc.so to /lib/libc.musl-armv7.so.1 and /usr/lib/libc.musl-armv7.so.1, the lddtree error is gone, but the exec error is still the same.
Back to top
View user's profile Send private message
eschwartz
Developer
Developer


Joined: 29 Oct 2023
Posts: 214

PostPosted: Sun Jul 21, 2024 10:10 pm    Post subject: Reply with quote

Ah yes, you'll probably have to patch that with the patchelf package. Alpine chose to use an entirely nonstandard soname for the musl libc that is incompatible with any other musl system -- I forgot.

Code:

patchelf --add-needed libc.so --remove-needed libc.musl-armv7.so.1 <ELF files>
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1223
Location: Richmond Hill, Canada

PostPosted: Sun Jul 21, 2024 10:31 pm    Post subject: Reply with quote

M95D,

Do you mind share step by step command you used to get openjdk from alpinelinux installed on your machine?

I think I will need to create a QEMU node to test to see if I can reproduce this problem.

If it still possible can you also share which stage3 file you use. I will try to see if I can found a match or close matched version.

In the mean time I suggest you try to review my suggestion use container or chroot. unless you really want to dig into why. And if you really want to dig in, I will need your kernel config too. so I can rebuild a kernel match yours.
Back to top
View user's profile Send private message
M95D
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jan 2020
Posts: 94

PostPosted: Sun Jul 21, 2024 10:55 pm    Post subject: Reply with quote

@eschwartz:
Wouldn't a symlink fix that?

I tried patching all executable files from bin/ and all .so files from lib/ and it still doesn't work.
Code:

TkB /usr/lib/jvm/java-1.8-openjdk/bin # lddtree java
java => ./java (interpreter => /lib/ld-musl-armhf.so.1)
    libc.so => /usr/lib/libc.so
    libjli.so => ./../lib/aarch32/jli/libjli.so
        libz.so.1 => /usr/lib/libz.so.1

TkB /usr/lib/jvm/java-1.8-openjdk/bin # lddtree ../lib/aarch32/jli/libjli.so
libjli.so => ../lib/aarch32/jli/libjli.so (interpreter => none)
    libc.so => /usr/lib/libc.so
    libz.so.1 => /usr/lib/libz.so.1

TkB /usr/lib/jvm/java-1.8-openjdk/bin # ./java
-bash: ./java: cannot execute binary file: Exec format error


@pingtoo:
I did a "binwalk -e" on Alpine packages (because gunzip refused), then untar the "0" file from each extraction dir, then move the extracted files to root with full path (they are all in /usr/lib/jvm/).
I'm not sure how to attach the kernel config.gz here. I see no attachments button. I can't remember the stage3 I used. I didn't keep it. It was from 2 years ago, updated from time to time, profile upgraded from 17, then I did an emerge --emtytree, just to be sure everything is OK (portage --info for that is in the other topic).

I'm always willing to debug if the devs are interested and it leads to a fix. Just let me finish first this debug path @eschwartz suggested - it seems more promising.
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1223
Location: Richmond Hill, Canada

PostPosted: Mon Jul 22, 2024 12:09 am    Post subject: Reply with quote

M95D,

The patch elf will solve a problem after the executable load into memory and start execution. it will likely generate a "not executation" or "file not found" kind of error message. However your "Exec format error" is a time when kernel loading the binary file it detected something not right.

When I ask for using lddtree to test, is tring to see if the dynamic interrpreter (/lib/ld-musl-armhf.so.1) can detect something that we can follow.

This is partial reason I need to have QEMU to see if I can dig in from the dynamic interpreter and all the other elf/binary tool to see if we find something to compare.

To upload you can try to use app-text/wgetpaste, which put content to public bin dump, without put into a forum post.

Code:
zcat config.gz | wgetpaste
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1223
Location: Richmond Hill, Canada

PostPosted: Mon Jul 22, 2024 12:15 am    Post subject: Reply with quote

M95D,

Can you confirm which you use?

Code:

openjdk8-8.402.06-r0.apk                           27-Mar-2024 19:29     48K
openjdk8-dbg-8.402.06-r0.apk                       27-Mar-2024 19:29     58M
openjdk8-demos-8.402.06-r0.apk                     27-Mar-2024 19:29      2M
openjdk8-doc-8.402.06-r0.apk                       27-Mar-2024 19:29    380K
openjdk8-jdk-8.402.06-r0.apk                       27-Mar-2024 19:29     15M
openjdk8-jre-8.402.06-r0.apk                       27-Mar-2024 19:29    296K
openjdk8-jre-base-8.402.06-r0.apk                  27-Mar-2024 19:29      3M
openjdk8-jre-lib-8.402.06-r0.apk                   27-Mar-2024 19:30     42M
Back to top
View user's profile Send private message
M95D
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jan 2020
Posts: 94

PostPosted: Mon Jul 22, 2024 7:33 am    Post subject: Reply with quote

Kernel config:
https://marius95.duckdns.org/posted/TkB.config.gz

pingtoo wrote:
M95D,

Can you confirm which you use?

Code:

*openjdk8-8.402.06-r0.apk                           27-Mar-2024 19:29     48K
openjdk8-dbg-8.402.06-r0.apk                       27-Mar-2024 19:29     58M
openjdk8-demos-8.402.06-r0.apk                     27-Mar-2024 19:29      2M
openjdk8-doc-8.402.06-r0.apk                       27-Mar-2024 19:29    380K
*openjdk8-jdk-8.402.06-r0.apk                       27-Mar-2024 19:29     15M
*openjdk8-jre-8.402.06-r0.apk                       27-Mar-2024 19:29    296K
*openjdk8-jre-base-8.402.06-r0.apk                  27-Mar-2024 19:29      3M
*openjdk8-jre-lib-8.402.06-r0.apk                   27-Mar-2024 19:30     42M

Marked.
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1223
Location: Richmond Hill, Canada

PostPosted: Mon Jul 22, 2024 10:56 am    Post subject: Reply with quote

M95D,

Thanks for the information. Now will take some time to construct environment to test.
Back to top
View user's profile Send private message
M95D
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jan 2020
Posts: 94

PostPosted: Mon Jul 22, 2024 4:54 pm    Post subject: Reply with quote

I made a chroot with the latest stage3 (armv7 hf musl) and the errors are still the same. So, there must be something wrong with the kernel.
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1223
Location: Richmond Hill, Canada

PostPosted: Mon Jul 22, 2024 6:30 pm    Post subject: Reply with quote

M95D wrote:
I made a chroot with the latest stage3 (armv7 hf musl) and the errors are still the same. So, there must be something wrong with the kernel.

I am thinking in same direction, so I am trying to build cross compiler tool for arm and then a kernel use your configuration then qemu to see if I can reproduce.

What I cound not figure out is why some binary work but some other don't.

I look linux source, the "Exec format error" in kernel is ENOEXEC, there are several place can have this error. so I am trying to see if I can generate this error and found out which portion of code is doing this.

The ENOEXEC is detect by kernel so something in the binary not matching kernel requirement. from the ELF header, your bash header is same as your java header, there must be something else deeper for kernel to check to know it is wrong format.
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 31256
Location: here

PostPosted: Mon Jul 22, 2024 6:35 pm    Post subject: Reply with quote

Moved from Portage & Programming to Gentoo on ARM.
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1223
Location: Richmond Hill, Canada

PostPosted: Wed Jul 24, 2024 3:25 pm    Post subject: Reply with quote

M95D wrote:
I made a chroot with the latest stage3 (armv7 hf musl) and the errors are still the same. So, there must be something wrong with the kernel.


I wonder if you mind test with docker?

While I was search Internet for my qemu solution I encounter a pre-build image (docker container) that seems to target tinker board
Code:
docker inspect balenalib/asus-tinker-board-alpine-openjdk:8
[
    {
        "Id": "sha256:8dbabd166bcbf0789ff9475f9add56615944ae473ca1a3b92ede06b1fe3e7f59",
        "RepoTags": [
            "balenalib/asus-tinker-board-alpine-openjdk:8"
        ],
        "RepoDigests": [
            "balenalib/asus-tinker-board-alpine-openjdk@sha256:4e30325fda26e33cca5b64826f636ccc59cf3de8ad9ece0c76ec611e101f14a7"
        ],
        "Parent": "",
        "Comment": "buildkit.dockerfile.v0",
        "Created": "2024-04-06T08:31:52.612468786Z",
        "Container": "",
        "ContainerConfig": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": null,
            "Cmd": null,
            "Image": "",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null
        },
        "DockerVersion": "",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin",
                "UDEV=off",
                "LANG=C.UTF-8",
                "JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk"
            ],
            "Cmd": [
                "echo",
                "'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"
            ],
            "ArgsEscaped": true,
            "Image": "",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": [
                "/usr/bin/entry.sh"
            ],
            "OnBuild": null,
            "Labels": {
                "io.balena.architecture": "armv7hf",
                "io.balena.device-type": "asus-tinker-board",
                "io.balena.qemu.version": "7.0.0+balena1-arm"
            }
        },
        "Architecture": "arm",
        "Variant": "v7",
        "Os": "linux",
        "Size": 130228598,
        "VirtualSize": 130228598,
        "GraphDriver": {
            "Data": null,
            "Name": "vfs"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:2543e672d54706d793e9cca02837d3a0a9e630394ed3b56f141928b279ba003e",
                "sha256:ef329d58869820aa0e2b1458790f02cc92c2e1c205eb8dfa68c9cbc8aa1181f5",
                "sha256:743c3fcc569cbf1f0653beb30fcdf67d0f3137c8e9aad1c26727757d2879c661",
                "sha256:32bb7f98719734968bf14604b2bd39c16dc820d7abf28c9c59d493060ed787ac",
                "sha256:60367a59fce32f6f0151804763e1e276303e431999b1c4af8f88244fef50f53a",
                "sha256:5c9b6dcedd6bceefedd09e68bab66ffd1bd5f2f60f21a677b2a0a1c5ee3c65ec",
                "sha256:b8e9209383bbb0ad8c75c13cf49b2cb6e723227f1acdf37a4ad44fb8fdc03a4d",
                "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef",
                "sha256:314950dd6fd1edb60aed0fcf2cf3703ff8533711f9fcdf271f39f33f6f091df0",
                "sha256:7ccaf1672276044233817fd2960730d02558abbf116a40235c919c5db888c414",
                "sha256:5ca5f531beb7a29ad8f633dffcb8b8e63877e326cace33bea5c1181fcad7e93a",
                "sha256:e04a9605ec37e3e915f9d2da027153adecffe9817c73bf732e50b4f7a781ee76",
                "sha256:153201045595a89acac8f004c26a6fd123bf84c843e415059e8323da6844ae08",
                "sha256:e68936ba1eefb0f87c70183a7d35f88c174c832d0910cba35df5f25ebffc2ec7"
            ]
        },
        "Metadata": {
            "LastTagTime": "0001-01-01T00:00:00Z"
        }
    }
]
The "Config/Label" specificly tag with "io.balena.device-type": "asus-tinker-board"

The image work for my ARM64 v8 RK3588. (Because ARM64 cpu usuall can execute both v7 and v8 code)
Back to top
View user's profile Send private message
M95D
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jan 2020
Posts: 94

PostPosted: Wed Jul 24, 2024 3:50 pm    Post subject: Reply with quote

I don't recognize that file format. How do I use it?
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1223
Location: Richmond Hill, Canada

PostPosted: Wed Jul 24, 2024 3:58 pm    Post subject: Reply with quote

M95D wrote:
I don't recognize that file format. How do I use it?

The code section in my post just for information only, it can not be use directly.

In order to do what I said, you have to have docker installed and run
Code:
docker run -it --rm balenalib/asus-tinker-board-alpine-openjdk:8 java -version
This will pull the image and run it with the java -version.

It that work, it will indicate something on you system that is prohibit execution of some binary. if that did not work it still can be your system or kernel.

I am trying a generic "vir" kernel build just so I can find a right qemu command to start.

Later I will try to get "Armbian" system build, or at least get its kernel configure so I can compare it with your's to understand if something missing.
Back to top
View user's profile Send private message
M95D
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jan 2020
Posts: 94

PostPosted: Wed Jul 24, 2024 4:13 pm    Post subject: Reply with quote

I am now emerge-ing docker.

I'm happy to report that go-bootstrap worked!
Isn't rust-stage0 built by the same gentoo servers as go-bootstrap? Why would one work but not the other?
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1223
Location: Richmond Hill, Canada

PostPosted: Wed Jul 24, 2024 5:56 pm    Post subject: Reply with quote

M95D wrote:
I am now emerge-ing docker.

I'm happy to report that go-bootstrap worked!
Isn't rust-stage0 built by the same gentoo servers as go-bootstrap? Why would one work but not the other?


I am not sure about the rust-stage0, not without any relevant information. (as in what command. how it different from the initial failure case)

I am happy to report, my qemu coomand itself is correct. I was able to boot a kernel with make ARCH=arm ... defconfig.

So next step is to find out what is config that enable to defconfig work whereas the vir missing.
Back to top
View user's profile Send private message
M95D
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jan 2020
Posts: 94

PostPosted: Wed Jul 24, 2024 7:30 pm    Post subject: Reply with quote

I set up a qemu myself.

Add these to kernel config:
CONFIG_SERIAL_AMBA_PL011 (that's the serial driver provided by "-machine virt", but I could find no documentation except some blog post)
CONFIG_SERIAL_AMBA_PL011_CONSOLE
CONFIG_DEBUG_LL (low level debug messages)
CONFIG_DEBUG_LL_UART_PL01X (in LL debug port selection)
DEBUG_UART_PHYS=0x9000000 (physical address 900'0000)
DEBUG_UART_VIRT=0xf8090000 (virtual address F809'0000)
CONFIG_EARLY_PRINTK (to continue showing messages using earlycon until PL011 driver loads)

Add bootargs
earlycon earlyprintk console=ttyAMA0
Do not load a dtb - that's machine-specific. Qemu loads its own, I think.

With this config I got as far as this:
Code:

[    0.000000][    T0] Booting Linux on physical CPU 0x0
[    0.000000][    T0] Linux version 6.10.0-M95D-12246-g786c8248dbd3 (root@GRAPH) (armv7a-unknown-linux-musleabihf-gcc (Gentoo 14.1.1_p20240720 p4) 14.1.1 20240720, GNU ld (Gentoo 2.42 p6) 2.42.0) #10 Wed Jul 24 22:27:47 EEST 2024
[    0.000000][    T0] CPU: ARMv7 Processor [414fc0f0] revision 0 (ARMv7), cr=10c5387d
[    0.000000][    T0] CPU: div instructions available: patching division code
[    0.000000][    T0] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[    0.000000][    T0] OF: fdt: Machine model: linux,dummy-virt
[    0.000000][    T0] random: crng init done
[    0.000000][    T0] earlycon: pl11 at MMIO 0x09000000 (options '')
[    0.000000][    T0] printk: legacy bootconsole [pl11] enabled
[    0.000000][    T0] printk: legacy bootconsole [earlycon0] enabled

This is probably where the kernel switches from physical to virtual memory - the DEBUG_UART_VIRT=0xf8090000 is probably wrong.
Back to top
View user's profile Send private message
M95D
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jan 2020
Posts: 94

PostPosted: Wed Jul 24, 2024 7:55 pm    Post subject: Reply with quote

OK. It works!
You only need to add the PL011 UART driver and console.
I was right, the virtual address of that port is wrong and it stops the boot process. Just disable CONFIG_DEBUG_LL and it will boot.
You can still use "earlycon=pl011,0x9000000 earlyprintk" to see early boot messages.


Last edited by M95D on Wed Jul 24, 2024 8:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1223
Location: Richmond Hill, Canada

PostPosted: Wed Jul 24, 2024 8:09 pm    Post subject: Reply with quote

M95D wrote:
OK. It works!
You only need to add the PL011 UART driver and console.
I was right, the virtual address of that port is wrong and it stops the boot process. Just disable CONFIG_DEBUG_LL and it will boot.


Thank you for the information.

I by chance was testing exactly like your suggestion. I was compare the ARCH=arm defconfig and my vir config, and few configs at a time. I am just reach to the bottom configure and the DEBUG_LL stuff come up and I was thinking the defconfig does not have those thing. so I remove it from my vir config and in the process rebuild kernel. this change appear require the build system rebuild almost everything. so still in process, not yet able to try yet.
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1223
Location: Richmond Hill, Canada

PostPosted: Thu Jul 25, 2024 10:18 am    Post subject: Reply with quote

M95D,

I think I found the mystery. It is due to thumb code flag. (CONFIG_ARM_THUMB). In your kernel config. it is TURN OFF. Alpinelinux gcc by default compile with this flag ON. Gentoo profile does not set this flag. so it is up to user to have it in make.conf

I prepare two rootfs disks for QEMU.

one is alpinelinux mini rootfs: alpine-minirootfs-3.20.2-armv7.tar.gz

one is gentoo stages: stage3-armv7a_hardfp_musl-openrc-20240717T192452Z.tar.xz

using alpinelinux rootfs, the kernel just failed at start /sbin/init, claim it is not unable same error (-8) which is "Exec format error".

whereas using gentoo rootfs, the kernel start /sbin/init without error.

So I compare Alpinelinux's kernel config and my "vir" config, notice that CONFIG_ARM_THUMB is not set in "vir", enable it and build and run new kernel with Alpinelinux root disk, this time the alpinelinux /sbin/init started. So I believe it is the key to address the "Exec format error".
Back to top
View user's profile Send private message
M95D
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jan 2020
Posts: 94

PostPosted: Thu Jul 25, 2024 7:07 pm    Post subject: Reply with quote

OMG, that was the last thing I expected to cause problems!
I'll test it right now.

THANKS!!!

PS: Hold on a sec! Shouldn't file and readelf say something if the Alpine's java or rust stage0 were thumb binaries?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum