Building OpenJDK (including the "portable" RPMs on RISC-V (P550) ================================================================ 25Apr2025 Summary ------- There are two parts to building OpenJDK: we first need to build a "openjdk-portable" set of RPMs, and then use that to bootstrap the main OpenJDK. (See the official README here: https://gitlab.com/redhat/centos-stream/rpms/java-21-openjdk/-/blob/c10s/README.md) First build the "openjdk-portable" ---------------------------------- - I used FVF's patch from their "portable-centos-9-risc64" branch to build the "portable" OpenJDK RPMs. That's my branch with their patch: https://gitlab.com/kchamart/centos_rpms_java-21-openjdk/-/commit/e30d42bf26455 (Allow generating 'openjdk-portable' RPMs) - I also had to s/%patch/%%patch/ in the spec files. - Generate the SRPM (note, this is *intentional* that we're using `c9s` here to generate the "portable" SRPM): $ centpkg --release c9s srpm ... - Run a `mock` build: $ mock -r /etc/mock/centos-stream-10-riscv64.cfg \ ./java-21-openjdk-portable-21.0.6.0.7-1.rv64.el9.src.rpm (Time to build on P550: 4h9min) - That's it! Save these generated "portable" RPMs, as it'll be used as "input" for the next step. Building the main 'java-openjdk' -------------------------------- - Switch to my "main" OpenJDK 'dist-git', with this patch: https://gitlab.com/kchamart/centos_rpms_java-21-openjdk/-/commit/3c971675d9470ae43df2 (Enable riscv64 arch) A crucial bit of change in there is this macro; %global portablerelease 1.rv64 It is matching the "portable" RPM versions we've built above. This is necessary for the build to succeed. - Create an SRPM: $ centpkg --release c10s srpm Wrote: /home/kashyapc/src/centos-stream/dist-git/java-21-openjdk/java-21-openjdk-21.0.6.0.7-3.rv.0.el10.src.rpm - Start a clean `chroot` and installed the "portable" RPMs: $ mock -r /etc/mock/centos-stream-10-riscv64.cfg --init $ mock -r /etc/mock/centos-stream-10-riscv64.cfg --install \ java-21-openjdk-portable-unstripped-21.0.6.0.7-1.rv64.el10.riscv64.rpm java-21-openjdk-portable-docs-21.0.6.0.7-1.rv64.el10.riscv64.rpm \ java-21-openjdk-portable-misc-21.0.6.0.7-1.rv64.el10.riscv64.rpm \ java-21-openjdk-portable-static-libs-21.0.6.0.7-1.rv64.el10.riscv64.rpm \ java-21-openjdk-portable-21.0.6.0.7-1.rv64.el10.riscv64.rpm \ java-21-openjdk-portable-devel-21.0.6.0.7-1.rv64.el10.riscv64.rpm - Generate the 'java-21-openjdk' SRPM for CS10: $ centpkg --release c10s srpm ... Wrote: /home/kashyapc/src/centos-stream/dist-git/java-21-openjdk/java-21-openjdk-21.0.6.0.7-3.rv.0.el10.src.rpm - Trigger a mock build to produce 'java-21-openjdk' RPMs for CS10 (*without* cleaning the 'chroot' so that the earlier installed "portable" RPMs remain intact): $ time mock -r /etc/mock/centos-stream-10-riscv64.cfg \ --no-clean \ --rebuild ./java-21-openjdk-21.0.6.0.7-3.rv.0.el10.src.rpm (Time to build on P550: 17m54s) That's it!