battleblow / openjdk-jdk11u

BSD port of OpenJDK 11
GNU General Public License v2.0
9 stars 8 forks source link

Add aarch64 OpenBSD support #86

Closed bsdkurt closed 5 years ago

bsdkurt commented 5 years ago

Notable items:

klaus4 commented 5 years ago

I am very curious if your changes in src / hotspot / cpu / aarch64 / macroAssembler_aarch64.cpp can solve the dtrace problem (https://github.com/battleblow/openjdk-jdk11u/issues/62) on FreeBSD:

root@freebsd:~/dtrace_compile/openjdk-jdk11u/build/bsd-aarch64-normal-server-fastdebug/jdk/bin # ./java -XX:+ExtendedDTraceProbes --version
Runtime1::entry_for(0) returned unimplemented entry point
=============== DEBUG MESSAGE: should not reach here ================

.. To suppress the following error report, specify this argument
.. after -XX: or in .hotspotrc:  SuppressErrorAt=/macroAssembler_aarch64.cpp:2523
..
.. A fatal error has been detected by the Java Runtime Environment:
..
..  Internal Error (/root/dtrace_compile/openjdk-jdk11u/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp:2523), pid=87893, tid=100281
..  assert(false) failed: DEBUG MESSAGE: should not reach here

Can you already provide a bootstrap-jdk for OpenBSD? Thank you very much

bsdkurt commented 5 years ago

Most significant comment is the one on the printing format.

All your comments are improvements or corrections. Thank you. I'll address all of them and update the pull request.

bsdkurt commented 5 years ago

Hi Klaus4,

I am very curious if your changes in src / hotspot / cpu / aarch64 / macroAssembler_aarch64.cpp can solve the dtrace problem (#62) on FreeBSD:

I don't think so. After I fix the issues Greg pointed out, the changes in common code should be no functional change for FreeBSD or Linux.

root@freebsd:~/dtrace_compile/openjdk-jdk11u/build/bsd-aarch64-normal-server-fastdebug/jdk/bin # ./java -XX:+ExtendedDTraceProbes --version
Runtime1::entry_for(0) returned unimplemented entry point
=============== DEBUG MESSAGE: should not reach here ================

.. To suppress the following error report, specify this argument
.. after -XX: or in .hotspotrc:  SuppressErrorAt=/macroAssembler_aarch64.cpp:2523
..
.. A fatal error has been detected by the Java Runtime Environment:
..
..  Internal Error (/root/dtrace_compile/openjdk-jdk11u/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp:2523), pid=87893, tid=100281
..  assert(false) failed: DEBUG MESSAGE: should not reach here

Looking at the line before 2523 I see BREAKPOINT. I suspect that is why you are seeing that message.

Can you already provide a bootstrap-jdk for OpenBSD? Thank you very much

I'll post a link to a bootstrap jdk for OpenBSD/aarch64 tomorrow - my current build is taking extra long at the moment.

klaus4 commented 5 years ago

Hi bsdkurt,

I'll post a link to a bootstrap jdk for OpenBSD/aarch64 tomorrow - my current build is taking extra long at the moment.

thank you in advance!

Looking at the line before 2523 I see BREAKPOINT. I suspect that is why you are seeing that message.

that was a core dump triggered by -XX:+ExtendedDTraceProbes, ... SuppressErrorAt=/macroAssembler_aarch64.cpp didn't stop the jvm-crash .

I`ll ask for (&provide) details in https://github.com/battleblow/openjdk-jdk11u/issues/62 after doing a new

make buildworld

after https://github.com/battleblow/openjdk-jdk11u/pull/86 will be merged I'm sure we will enable dtrace-support for openjdk on aarch64 because bsdkurt&battleblow know how relocations work(I'm not sure if I know all relocations-stuff ,Ha Ha lol ) Regards

bsdkurt commented 5 years ago

I believe this is ready for a final review.

bsdkurt commented 5 years ago

I'll post a link to a bootstrap jdk for OpenBSD/aarch64 tomorrow - my current build is taking extra long at the moment.

thank you in advance!

Here's a link to working jdk for OpenBSD/aarch64 you can use for bootstrapping builds.

http://www.intricatesoftware.com/distfiles/openjdk-jdk11u-bootjdk-arm64-20190917.tar.gz

IIRC, you mentioned that you had a RockPro64 board for OpenBSD. You will need to be running the latest snapshot to correct an issue with the network driver:

https://github.com/openbsd/src/commit/6e969c1c47c5e94618a23f789453e1b9ae691bf6

Edit: changed url filename to match OpenBSD ports

klaus4 commented 5 years ago

IIRC, you mentioned that you had a RockPro64 board for OpenBSD. You will need to be running the latest snapshot to correct an issue with the network driver:

openbsd/src@6e969c1

Hi bsdkurt , thanks , here's my first try on my current miniroot65.fs - version(Rock64-board) :

obsd# sysctl hw 
hw.machine=arm64
hw.model=ARM Cortex-A53 r0p4
hw.ncpu=4
hw.byteorder=1234
hw.pagesize=4096
hw.disknames=sd0:962c3dbdac2f7dfe
hw.diskcount=1
hw.product=Pine64 Rock64
hw.physmem=4214009856
hw.usermem=4213997568
hw.ncpufound=4
hw.allowpowerdown=1
hw.ncpuonline=4
obsd# uname -a       
OpenBSD obsd.my.domain 6.5 GENERIC.MP#84 arm64
obsd# cc -v     
OpenBSD clang version 7.0.1 (tags/RELEASE_701/final) (based on LLVM 7.0.1)
Target: aarch64-unknown-openbsd6.5
Thread model: posix
InstalledDir: /usr/bin
obsd# bootjdk/bin/javac -version 
warning: libc.so.95.0: minor version >= 1 expected, using it anyway
Error: dl failure on line 617
Error: failed /root/bootjdk/lib/server/libjvm.so, because Cannot load specified object
klaus4 commented 5 years ago
obsd# bootjdk/bin/javac -version 
warning: libc.so.95.0: minor version >= 1 expected, using it anyway
Error: dl failure on line 617
Error: failed /root/bootjdk/lib/server/libjvm.so, because Cannot load specified object

do you know whether this will be fixed by https://github.com/openbsd/src/commit/6e969c1c47c5e94618a23f789453e1b9ae691bf6 or should I look for other solutions ?

bsdkurt commented 5 years ago

klaus4,

In order to use the linked jdk you will need to be running the latest OpenBSD snapshot. It looks like you are running 6.5 release or an older snapshot. The easiest way to upgrade is to download bsd.rd for the snapshot, boot into it (on serial console at boot prompt, type bsd.rd before it auto boots bsd) and then select the upgrade option. For more info and post upgrade steps (pkg_add -u, etc) see:

https://www.openbsd.org/faq/current.html https://www.openbsd.org/faq/faq5.html#Flavors

Alternatively, wait for me to add support in ports and a package will eventually be available. Although I'm not sure if I will make the 6.6 release cut off.

-Kurt

klaus4 commented 5 years ago

klaus4, The easiest way to upgrade is to download bsd.rd for the snapshot, boot into it (on serial console at boot prompt, type bsd.rd before it auto boots bsd) and then select the upgrade option.

Kurt, for coincidence I upgraded exactly how you recommend, before reading your instructions!, so you don't have to feel guilty for a non-bootable OpenBSD ;-) Ha Ha

O.K, the upgrade ran fine but after reboot on the upgraded SD-card I get this :

U-Boot 2017.09-rockchip-ayufan-1065-g95f6152134 (Aug 26 2019 - 12:41:04 +0000)  

Model: Pine64 Rock64                                                            
DRAM:  4 GiB                                                                    
MMC:   rksdmmc@ff520000: 0, rksdmmc@ff500000: 1                                 
SF: Detected gd25q128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB  
*** Warning - bad CRC, using default environment                                

In:    serial@ff130000                                                          
Out:   serial@ff130000                                                          
Err:   serial@ff130000                                                          
Model: Pine64 Rock64                                                            
misc_init_r                                                                     
cpuid=55524b50303930303300000000121522                                          
serial=3d1774b01b16c2d                                                          
Net:   eth0: ethernet@ff540000                                                  
Hit any key to stop autoboot:  0                                                
Card did not respond to voltage select!                                         
mmc_init: -95, time 9                                                           
switch to partitions #0, OK                                                     
mmc1 is current device                                                          
Scanning mmc 1:1...                                                             
Found EFI removable media binary efi/boot/bootaa64.efi                          
reading efi/boot/bootaa64.efi                                                   
161090 bytes read in 11 ms (14 MiB/s)                                           
libfdt fdt_check_header(): FDT_ERR_BADMAGIC                                     
## Starting EFI application at 02000000 ...                                     
Card did not respond to voltage select!                                         
mmc_init: -95, time 9                                                           
Scanning disk rksdmmc@ff520000.blk...                                           
MMC: block number 0x1 exceeds max(0x0)                                          
MMC: block number 0x1 exceeds max(0x0)                                          
MMC: block number 0x44 exceeds max(0x0)                                         
Scanning disk rksdmmc@ff500000.blk...                                           
Found 2 disks                                                                   
disks: sd0 sd1                                                                  
>> OpenBSD/arm64 BOOTAA64 0.19                                                  
ethernet@ff540000 Waiting for PHY auto negotiation to complete..... done        
Speed: 1000, full duplex         

as the next step I made an clean dd if=/Users/kls/Downloads/miniroot66.fs of=/dev/disk2 bs=4m on another SD-card with the same boot-result now the same dd if on an USB-Stick with the same non-bootable result.

I also made an U-Boot upgrade ( with the same result) . Now I just guess(really just a guess) there really could be something wrong with the network driver you fixed in https://github.com/openbsd/src/commit/6e969c1c47c5e94618a23f789453e1b9ae691bf6 , because boot hangs on network initialization ??? :

>> OpenBSD/arm64 BOOTAA64 0.19                                                  
ethernet@ff540000 Waiting for PHY auto negotiation to complete..... done        
Speed: 1000, full duplex    
klaus4 commented 5 years ago

just to add: the boot-output is from an UART-console via minicom on an RPI because OpenBSD/aarch64 doesn't support HDMI on Rock64- so I cannot see whether & how the boot-stage continues after the last serial-console-output.

---edit:-- just can say: no ssh access and no ping, so boot hangs

but the most interesting question for now : -) : how to fix

warning: libc.so.95.0: minor version >= 1 expected, using it anyway
Error: dl failure on line 617
Error: failed /root/bootjdk/lib/server/libjvm.so, because Cannot load specified object

without upgrading 6.5 to 6.6 -- end edit---

bsdkurt commented 5 years ago

klaus4, The easiest way to upgrade is to download bsd.rd for the snapshot, boot into it (on serial console at boot prompt, type bsd.rd before it auto boots bsd) and then select the upgrade option.

Kurt, for coincidence I upgraded exactly how you recommend, before reading your instructions!, so you don't have to feel guilty for a non-bootable OpenBSD ;-) Ha Ha

O.K, the upgrade ran fine but after reboot on the upgraded SD-card I get this :

U-Boot 2017.09-rockchip-ayufan-1065-g95f6152134 (Aug 26 2019 - 12:41:04 +0000)  

Model: Pine64 Rock64                                                            
DRAM:  4 GiB                                                                    
MMC:   rksdmmc@ff520000: 0, rksdmmc@ff500000: 1                                 
SF: Detected gd25q128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB  
*** Warning - bad CRC, using default environment                                

In:    serial@ff130000                                                          
Out:   serial@ff130000                                                          
Err:   serial@ff130000                                                          
Model: Pine64 Rock64                                                            
misc_init_r                                                                     
cpuid=55524b50303930303300000000121522                                          
serial=3d1774b01b16c2d                                                          
Net:   eth0: ethernet@ff540000                                                  
Hit any key to stop autoboot:  0                                                
Card did not respond to voltage select!                                         
mmc_init: -95, time 9                                                           
switch to partitions #0, OK                                                     
mmc1 is current device                                                          
Scanning mmc 1:1...                                                             
Found EFI removable media binary efi/boot/bootaa64.efi                          
reading efi/boot/bootaa64.efi                                                   
161090 bytes read in 11 ms (14 MiB/s)                                           
libfdt fdt_check_header(): FDT_ERR_BADMAGIC                                     
## Starting EFI application at 02000000 ...                                     
Card did not respond to voltage select!                                         
mmc_init: -95, time 9                                                           
Scanning disk rksdmmc@ff520000.blk...                                           
MMC: block number 0x1 exceeds max(0x0)                                          
MMC: block number 0x1 exceeds max(0x0)                                          
MMC: block number 0x44 exceeds max(0x0)                                         
Scanning disk rksdmmc@ff500000.blk...                                           
Found 2 disks                                                                   
disks: sd0 sd1                                                                  
>> OpenBSD/arm64 BOOTAA64 0.19                                                  
ethernet@ff540000 Waiting for PHY auto negotiation to complete..... done        
Speed: 1000, full duplex         

as the next step I made an clean dd if=/Users/kls/Downloads/miniroot66.fs of=/dev/disk2 bs=4m on another SD-card with the same boot-result now the same dd if on an USB-Stick with the same non-bootable result.

I also made an U-Boot upgrade ( with the same result) . Now I just guess(really just a guess) there really could be something wrong with the network driver you fixed in openbsd/src@6e969c1 , because boot hangs on network initialization ??? :

Very much unlikely. The driver correction was for an unexpected interrupt after 2G of data had be received by the dwge network driver. At this point there would not be that much data transferred.

>> OpenBSD/arm64 BOOTAA64 0.19                                                  
ethernet@ff540000 Waiting for PHY auto negotiation to complete..... done        
Speed: 1000, full duplex    

That looks a bit like it is trying to netboot off the network instead of off the uSD (not 100% on that).

You don't get a boot> prompt right after the >> OpenBSD/arm64 BOOTAA64 0.19 line?

I see two disks in your output. Perhaps try to boot with only the uSD disk in to see if miniroot66.fs will boot then just as a test to see if it works.

Also wondering if your firmware was flashed the onboard SPI?

I'm sorry but the jdk I posted is for -current only.

I think we should take this discussion off the pull request. Please reply to me directly at bsdkurt@gmail.com.

Thanks, -Kurt

klaus4 commented 5 years ago

I think we should take this discussion off the pull request. Please reply to me directly at bsdkurt@gmail.com.

Thanks, -Kurt

agree , "see" you later on gmail, thank you !