Initial Commit

- initial default booting image
This commit is contained in:
2026-11-06 20:45:42 +01:00
commit b8783708ae
15201 changed files with 602532 additions and 0 deletions

View File

@@ -0,0 +1,109 @@
From edf96f51d2c6d6e7a7762a879b916a5e58d8c23c Mon Sep 17 00:00:00 2001
From: Alexey Brodkin <abrodkin@synopsys.com>
Date: Mon, 18 Oct 2021 05:20:05 -0700
Subject: [PATCH] Add ARCv2 ISA processors support to Zero
This adds ARCv2 processors support in OpenJDK via
"Zero Assembly Project" (see https://openjdk.java.net/projects/zero).
That' a purely interpretive mode, so likely not that fast
as JIT'ed version, but for starters it's much better than nothing.
Once all the logistical problems are solved hopefully this
change will be accepted upstream.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
---
make/autoconf/libraries.m4 | 8 ++++++++
make/autoconf/platform.m4 | 8 ++++++++
src/hotspot/os/linux/os_linux.cpp | 8 +++++++-
3 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/make/autoconf/libraries.m4 b/make/autoconf/libraries.m4
index 865feea36d9..30c224e4a99 100644
--- a/make/autoconf/libraries.m4
+++ b/make/autoconf/libraries.m4
@@ -146,6 +146,14 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES],
fi
fi
+ # Libatomic library
+ # 32-bit ARC needs fallback library for 8-byte atomic ops
+ # Inspired by a fix for MIPS, see https://github.com/openjdk/jdk/commit/1b3aa3af
+ if test "x$OPENJDK_TARGET_OS" = xlinux &&
+ (test "x$OPENJDK_TARGET_CPU" = xarc); then
+ BASIC_JVM_LIBS="$BASIC_JVM_LIBS -latomic"
+ fi
+
# perfstat lib
if test "x$OPENJDK_TARGET_OS" = xaix; then
BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lperfstat"
diff --git a/make/autoconf/platform.m4 b/make/autoconf/platform.m4
index eb66266262b..3ca94b351b2 100644
--- a/make/autoconf/platform.m4
+++ b/make/autoconf/platform.m4
@@ -54,6 +54,12 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
+ arc)
+ VAR_CPU=arc
+ VAR_CPU_ARCH=arc
+ VAR_CPU_BITS=32
+ VAR_CPU_ENDIAN=little
+ ;;
arm*)
VAR_CPU=arm
VAR_CPU_ARCH=arm
@@ -565,6 +571,8 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],
HOTSPOT_$1_CPU_DEFINE=RISCV64
# The cpu defines below are for zero, we don't support them directly.
+ elif test "x$OPENJDK_$1_CPU" = xarc; then
+ HOTSPOT_$1_CPU_DEFINE=ARC
elif test "x$OPENJDK_$1_CPU" = xsparc; then
HOTSPOT_$1_CPU_DEFINE=SPARC
elif test "x$OPENJDK_$1_CPU" = xppc; then
diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp
index 63b7562f118..58b43241df4 100644
--- a/src/hotspot/os/linux/os_linux.cpp
+++ b/src/hotspot/os/linux/os_linux.cpp
@@ -1721,6 +1721,9 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
#ifndef EM_AARCH64
#define EM_AARCH64 183 /* ARM AARCH64 */
#endif
+#ifndef EM_ARC_COMPACT2
+ #define EM_ARC_COMPACT2 195 /* ARC ARCv2 ISA */
+#endif
#ifndef EM_RISCV
#define EM_RISCV 243 /* RISC-V */
#endif
@@ -1745,6 +1748,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
{EM_SH, EM_SH, ELFCLASS32, ELFDATA2MSB, (char*)"SuperH BE"},
#endif
{EM_ARM, EM_ARM, ELFCLASS32, ELFDATA2LSB, (char*)"ARM"},
+ {EM_ARC_COMPACT2, EM_ARC_COMPACT2, ELFCLASS32, ELFDATA2LSB, (char*)"ARC"},
// we only support 64 bit z architecture
{EM_S390, EM_S390, ELFCLASS64, ELFDATA2MSB, (char*)"IBM System/390"},
{EM_ALPHA, EM_ALPHA, ELFCLASS64, ELFDATA2LSB, (char*)"Alpha"},
@@ -1773,6 +1777,8 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
static Elf32_Half running_arch_code=EM_PPC;
#elif (defined AARCH64)
static Elf32_Half running_arch_code=EM_AARCH64;
+#elif (defined ARC)
+ static Elf32_Half running_arch_code=EM_ARC_COMPACT2;
#elif (defined ARM)
static Elf32_Half running_arch_code=EM_ARM;
#elif (defined S390)
@@ -1795,7 +1801,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
static Elf32_Half running_arch_code=EM_LOONGARCH;
#else
#error Method os::dll_load requires that one of following is defined:\
- AARCH64, ALPHA, ARM, AMD64, IA32, IA64, LOONGARCH64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, RISCV, S390, SH, __sparc
+ AARCH64, ALPHA, ARC, ARM, AMD64, IA32, IA64, LOONGARCH64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, RISCV, S390, SH, __sparc
#endif
// Identify compatibility class for VM's architecture and library's architecture
--
2.43.0

View File

@@ -0,0 +1,83 @@
From 8df09bb41f8aec8904a2231facc76660d2a83236 Mon Sep 17 00:00:00 2001
From: Thomas Devoogdt <thomas@devoogdt.com>
Date: Thu, 13 Nov 2025 17:23:44 +0100
Subject: [PATCH] awt: fix HEADLESS compilation without X11
Upstream: https://github.com/openjdk/jdk/pull/28310
Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
---
make/modules/java.desktop/lib/Awt2dLibraries.gmk | 16 ++++++++++++++--
.../unix/native/common/awt/utility/rect.h | 4 ++--
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/make/modules/java.desktop/lib/Awt2dLibraries.gmk b/make/modules/java.desktop/lib/Awt2dLibraries.gmk
index 46e3b1677f7..0e92ce6aeca 100644
--- a/make/modules/java.desktop/lib/Awt2dLibraries.gmk
+++ b/make/modules/java.desktop/lib/Awt2dLibraries.gmk
@@ -77,6 +77,10 @@ ifeq ($(call isTargetOs, windows), true)
#
endif
+ifeq ($(ENABLE_HEADLESS_ONLY), true)
+ LIBAWT_CFLAGS += -DHEADLESS
+endif
+
ifeq ($(call isTargetOs, linux macosx aix), true)
LIBAWT_EXFILES += awt_Font.c CUPSfuncs.c fontpath.c X11Color.c
endif
@@ -362,13 +366,20 @@ ifeq ($(call isTargetOs, windows macosx), false)
$(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
#
- LIBAWT_HEADLESS_EXCLUDES := medialib
+ LIBAWT_HEADLESS_EXCLUDES := medialib opengl
+
+ LIBAWT_HEADLESS_EXCLUDE_FILES := \
+ GLXGraphicsConfig.c \
+ GLXSurfaceData.c \
+ X11PMBlitLoops.c \
+ X11Renderer.c \
+ X11SurfaceData.c \
+ #
LIBAWT_HEADLESS_EXTRA_HEADER_DIRS := \
$(LIBAWT_DEFAULT_HEADER_DIRS) \
common/awt/debug \
common/font \
- common/java2d/opengl \
#
LIBAWT_HEADLESS_CFLAGS := $(CUPS_CFLAGS) $(FONTCONFIG_CFLAGS) $(X_CFLAGS) \
@@ -378,6 +389,7 @@ ifeq ($(call isTargetOs, windows macosx), false)
NAME := awt_headless, \
EXTRA_SRC := $(LIBAWT_HEADLESS_EXTRA_SRC), \
EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \
+ EXCLUDE_FILES := $(LIBAWT_HEADLESS_EXCLUDE_FILES), \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBAWT_HEADLESS_CFLAGS), \
diff --git a/src/java.desktop/unix/native/common/awt/utility/rect.h b/src/java.desktop/unix/native/common/awt/utility/rect.h
index ceea38f4349..91b5a17ec58 100644
--- a/src/java.desktop/unix/native/common/awt/utility/rect.h
+++ b/src/java.desktop/unix/native/common/awt/utility/rect.h
@@ -28,7 +28,7 @@
#ifndef _AWT_RECT_H
#define _AWT_RECT_H
-#ifndef MACOSX
+#if !defined(HEADLESS) && !defined(MACOSX)
#include <X11/Xlib.h>
typedef XRectangle RECT_T;
#else
@@ -39,7 +39,7 @@ typedef struct {
int width;
int height;
} RECT_T;
-#endif /* !MACOSX */
+#endif /* !HEADLESS && !MACOSX */
#define RECT_EQ_X(r1,r2) ((r1).x==(r2).x && (r1).width==(r2).width)
--
2.43.0

View File

@@ -0,0 +1,109 @@
From c990ac56c441682b65a3dc699a753e1d924b40d1 Mon Sep 17 00:00:00 2001
From: Alexey Brodkin <abrodkin@synopsys.com>
Date: Mon, 18 Oct 2021 05:20:05 -0700
Subject: [PATCH] Add ARCv2 ISA processors support to Zero
This adds ARCv2 processors support in OpenJDK via
"Zero Assembly Project" (see https://openjdk.java.net/projects/zero).
That' a purely interpretive mode, so likely not that fast
as JIT'ed version, but for starters it's much better than nothing.
Once all the logistical problems are solved hopefully this
change will be accepted upstream.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
---
make/autoconf/libraries.m4 | 8 ++++++++
make/autoconf/platform.m4 | 8 ++++++++
src/hotspot/os/linux/os_linux.cpp | 8 +++++++-
3 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/make/autoconf/libraries.m4 b/make/autoconf/libraries.m4
index 51d4f724c33..41844933a14 100644
--- a/make/autoconf/libraries.m4
+++ b/make/autoconf/libraries.m4
@@ -157,6 +157,14 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES],
BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lrt"
fi
+ # Libatomic library
+ # 32-bit ARC needs fallback library for 8-byte atomic ops
+ # Inspired by a fix for MIPS, see https://github.com/openjdk/jdk/commit/1b3aa3af
+ if test "x$OPENJDK_TARGET_OS" = xlinux &&
+ (test "x$OPENJDK_TARGET_CPU" = xarc); then
+ BASIC_JVM_LIBS="$BASIC_JVM_LIBS -latomic"
+ fi
+
# perfstat lib
if test "x$OPENJDK_TARGET_OS" = xaix; then
BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lperfstat"
diff --git a/make/autoconf/platform.m4 b/make/autoconf/platform.m4
index df610cc489b..2e21572ba4d 100644
--- a/make/autoconf/platform.m4
+++ b/make/autoconf/platform.m4
@@ -54,6 +54,12 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
+ arc)
+ VAR_CPU=arc
+ VAR_CPU_ARCH=arc
+ VAR_CPU_BITS=32
+ VAR_CPU_ENDIAN=little
+ ;;
arm*)
VAR_CPU=arm
VAR_CPU_ARCH=arm
@@ -571,6 +577,8 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],
HOTSPOT_$1_CPU_DEFINE=RISCV64
# The cpu defines below are for zero, we don't support them directly.
+ elif test "x$OPENJDK_$1_CPU" = xarc; then
+ HOTSPOT_$1_CPU_DEFINE=ARC
elif test "x$OPENJDK_$1_CPU" = xsparc; then
HOTSPOT_$1_CPU_DEFINE=SPARC
elif test "x$OPENJDK_$1_CPU" = xppc; then
diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp
index 492300a37d4..3a10790f4a0 100644
--- a/src/hotspot/os/linux/os_linux.cpp
+++ b/src/hotspot/os/linux/os_linux.cpp
@@ -1663,6 +1663,9 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
#ifndef EM_AARCH64
#define EM_AARCH64 183 /* ARM AARCH64 */
#endif
+#ifndef EM_ARC_COMPACT2
+ #define EM_ARC_COMPACT2 195 /* ARC ARCv2 ISA */
+#endif
#ifndef EM_RISCV
#define EM_RISCV 243 /* RISC-V */
#endif
@@ -1687,6 +1690,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
{EM_SH, EM_SH, ELFCLASS32, ELFDATA2MSB, (char*)"SuperH BE"},
#endif
{EM_ARM, EM_ARM, ELFCLASS32, ELFDATA2LSB, (char*)"ARM"},
+ {EM_ARC_COMPACT2, EM_ARC_COMPACT2, ELFCLASS32, ELFDATA2LSB, (char*)"ARC"},
// we only support 64 bit z architecture
{EM_S390, EM_S390, ELFCLASS64, ELFDATA2MSB, (char*)"IBM System/390"},
{EM_ALPHA, EM_ALPHA, ELFCLASS64, ELFDATA2LSB, (char*)"Alpha"},
@@ -1719,6 +1723,8 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
static Elf32_Half running_arch_code=EM_PPC;
#elif (defined AARCH64)
static Elf32_Half running_arch_code=EM_AARCH64;
+#elif (defined ARC)
+ static Elf32_Half running_arch_code=EM_ARC_COMPACT2;
#elif (defined ARM)
static Elf32_Half running_arch_code=EM_ARM;
#elif (defined S390)
@@ -1741,7 +1747,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
static Elf32_Half running_arch_code=EM_LOONGARCH;
#else
#error Method os::dll_load requires that one of following is defined:\
- AARCH64, ALPHA, ARM, AMD64, IA32, IA64, LOONGARCH64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, RISCV, S390, SH, __sparc
+ AARCH64, ALPHA, ARC, ARM, AMD64, IA32, IA64, LOONGARCH64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, RISCV, S390, SH, __sparc
#endif
// Identify compatibility class for VM's architecture and library's architecture
--
2.43.0

View File

@@ -0,0 +1,83 @@
From 13a908b3d192e477b7572b522837efd771f5e2f9 Mon Sep 17 00:00:00 2001
From: Thomas Devoogdt <thomas@devoogdt.com>
Date: Thu, 13 Nov 2025 17:23:44 +0100
Subject: [PATCH] awt: fix HEADLESS compilation without X11
Upstream: https://github.com/openjdk/jdk/pull/28310
Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
---
make/modules/java.desktop/lib/Awt2dLibraries.gmk | 16 ++++++++++++++--
.../unix/native/common/awt/utility/rect.h | 4 ++--
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/make/modules/java.desktop/lib/Awt2dLibraries.gmk b/make/modules/java.desktop/lib/Awt2dLibraries.gmk
index a33f219e83e..de57e88a4ce 100644
--- a/make/modules/java.desktop/lib/Awt2dLibraries.gmk
+++ b/make/modules/java.desktop/lib/Awt2dLibraries.gmk
@@ -77,6 +77,10 @@ ifeq ($(call isTargetOs, windows), true)
#
endif
+ifeq ($(ENABLE_HEADLESS_ONLY), true)
+ LIBAWT_CFLAGS += -DHEADLESS
+endif
+
ifeq ($(call isTargetOs, linux macosx aix), true)
LIBAWT_EXFILES += awt_Font.c CUPSfuncs.c fontpath.c X11Color.c
endif
@@ -368,13 +372,20 @@ ifeq ($(call isTargetOs, windows macosx), false)
$(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
#
- LIBAWT_HEADLESS_EXCLUDES := medialib
+ LIBAWT_HEADLESS_EXCLUDES := medialib opengl
+
+ LIBAWT_HEADLESS_EXCLUDE_FILES := \
+ GLXGraphicsConfig.c \
+ GLXSurfaceData.c \
+ X11PMBlitLoops.c \
+ X11Renderer.c \
+ X11SurfaceData.c \
+ #
LIBAWT_HEADLESS_EXTRA_HEADER_DIRS := \
$(LIBAWT_DEFAULT_HEADER_DIRS) \
common/awt/debug \
common/font \
- common/java2d/opengl \
#
LIBAWT_HEADLESS_CFLAGS := $(CUPS_CFLAGS) $(FONTCONFIG_CFLAGS) $(X_CFLAGS) \
@@ -384,6 +395,7 @@ ifeq ($(call isTargetOs, windows macosx), false)
NAME := awt_headless, \
EXTRA_SRC := $(LIBAWT_HEADLESS_EXTRA_SRC), \
EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \
+ EXCLUDE_FILES := $(LIBAWT_HEADLESS_EXCLUDE_FILES), \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBAWT_HEADLESS_CFLAGS), \
diff --git a/src/java.desktop/unix/native/common/awt/utility/rect.h b/src/java.desktop/unix/native/common/awt/utility/rect.h
index ceea38f4349..91b5a17ec58 100644
--- a/src/java.desktop/unix/native/common/awt/utility/rect.h
+++ b/src/java.desktop/unix/native/common/awt/utility/rect.h
@@ -28,7 +28,7 @@
#ifndef _AWT_RECT_H
#define _AWT_RECT_H
-#ifndef MACOSX
+#if !defined(HEADLESS) && !defined(MACOSX)
#include <X11/Xlib.h>
typedef XRectangle RECT_T;
#else
@@ -39,7 +39,7 @@ typedef struct {
int width;
int height;
} RECT_T;
-#endif /* !MACOSX */
+#endif /* !HEADLESS && !MACOSX */
#define RECT_EQ_X(r1,r2) ((r1).x==(r2).x && (r1).width==(r2).width)
--
2.43.0

View File

@@ -0,0 +1,35 @@
From 46b9a0ad24f7f299ff23e13bc8ef01c188d246b6 Mon Sep 17 00:00:00 2001
From: Thomas Devoogdt <thomas@devoogdt.com>
Date: Thu, 13 Nov 2025 23:10:20 +0100
Subject: [PATCH] autoconf: libraries: drop the need for X11 in headless mode
Upstream: https://github.com/openjdk/jdk/pull/28310
Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
---
make/autoconf/libraries.m4 | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/make/autoconf/libraries.m4 b/make/autoconf/libraries.m4
index 51d4f724c33..6a8b925c3f2 100644
--- a/make/autoconf/libraries.m4
+++ b/make/autoconf/libraries.m4
@@ -42,12 +42,12 @@ m4_include([lib-tests.m4])
AC_DEFUN_ONCE([LIB_DETERMINE_DEPENDENCIES],
[
# Check if X11 is needed
- if test "x$OPENJDK_TARGET_OS" = xwindows || test "x$OPENJDK_TARGET_OS" = xmacosx; then
- # No X11 support on windows or macosx
+ if test "x$OPENJDK_TARGET_OS" = xwindows ||
+ test "x$OPENJDK_TARGET_OS" = xmacosx ||
+ test "x$ENABLE_HEADLESS_ONLY" = xtrue; then
NEEDS_LIB_X11=false
else
- # All other instances need X11, even if building headless only, libawt still
- # needs X11 headers.
+ # All other instances need X11 for libawt.
NEEDS_LIB_X11=true
fi
--
2.43.0

View File

@@ -0,0 +1,109 @@
From 86aee60f0457bd9716c4221da53bcd9d893359b3 Mon Sep 17 00:00:00 2001
From: Alexey Brodkin <abrodkin@synopsys.com>
Date: Mon, 18 Oct 2021 05:20:05 -0700
Subject: [PATCH] Add ARCv2 ISA processors support to Zero
This adds ARCv2 processors support in OpenJDK via
"Zero Assembly Project" (see https://openjdk.java.net/projects/zero).
That' a purely interpretive mode, so likely not that fast
as JIT'ed version, but for starters it's much better than nothing.
Once all the logistical problems are solved hopefully this
change will be accepted upstream.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
---
make/autoconf/libraries.m4 | 8 ++++++++
make/autoconf/platform.m4 | 8 ++++++++
src/hotspot/os/linux/os_linux.cpp | 8 +++++++-
3 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/make/autoconf/libraries.m4 b/make/autoconf/libraries.m4
index 8dc3d55ed0c..96f377c2f99 100644
--- a/make/autoconf/libraries.m4
+++ b/make/autoconf/libraries.m4
@@ -141,6 +141,14 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES],
BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lrt"
fi
+ # Libatomic library
+ # 32-bit ARC needs fallback library for 8-byte atomic ops
+ # Inspired by a fix for MIPS, see https://github.com/openjdk/jdk/commit/1b3aa3af
+ if test "x$OPENJDK_TARGET_OS" = xlinux &&
+ (test "x$OPENJDK_TARGET_CPU" = xarc); then
+ BASIC_JVM_LIBS="$BASIC_JVM_LIBS -latomic"
+ fi
+
# perfstat lib
if test "x$OPENJDK_TARGET_OS" = xaix; then
BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lperfstat"
diff --git a/make/autoconf/platform.m4 b/make/autoconf/platform.m4
index 31451d0c37f..8d2b95d4399 100644
--- a/make/autoconf/platform.m4
+++ b/make/autoconf/platform.m4
@@ -54,6 +54,12 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
+ arc)
+ VAR_CPU=arc
+ VAR_CPU_ARCH=arc
+ VAR_CPU_BITS=32
+ VAR_CPU_ENDIAN=little
+ ;;
arm*)
VAR_CPU=arm
VAR_CPU_ARCH=arm
@@ -571,6 +577,8 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],
HOTSPOT_$1_CPU_DEFINE=RISCV64
# The cpu defines below are for zero, we don't support them directly.
+ elif test "x$OPENJDK_$1_CPU" = xarc; then
+ HOTSPOT_$1_CPU_DEFINE=ARC
elif test "x$OPENJDK_$1_CPU" = xsparc; then
HOTSPOT_$1_CPU_DEFINE=SPARC
elif test "x$OPENJDK_$1_CPU" = xppc; then
diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp
index 49125ae8954..317e779782d 100644
--- a/src/hotspot/os/linux/os_linux.cpp
+++ b/src/hotspot/os/linux/os_linux.cpp
@@ -1757,6 +1757,9 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
#ifndef EM_AARCH64
#define EM_AARCH64 183 /* ARM AARCH64 */
#endif
+#ifndef EM_ARC_COMPACT2
+ #define EM_ARC_COMPACT2 195 /* ARC ARCv2 ISA */
+#endif
#ifndef EM_RISCV
#define EM_RISCV 243 /* RISC-V */
#endif
@@ -1781,6 +1784,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
{EM_SH, EM_SH, ELFCLASS32, ELFDATA2MSB, (char*)"SuperH BE"},
#endif
{EM_ARM, EM_ARM, ELFCLASS32, ELFDATA2LSB, (char*)"ARM"},
+ {EM_ARC_COMPACT2, EM_ARC_COMPACT2, ELFCLASS32, ELFDATA2LSB, (char*)"ARC"},
// we only support 64 bit z architecture
{EM_S390, EM_S390, ELFCLASS64, ELFDATA2MSB, (char*)"IBM System/390"},
{EM_ALPHA, EM_ALPHA, ELFCLASS64, ELFDATA2LSB, (char*)"Alpha"},
@@ -1811,6 +1815,8 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
static Elf32_Half running_arch_code=EM_PPC;
#elif (defined AARCH64)
static Elf32_Half running_arch_code=EM_AARCH64;
+#elif (defined ARC)
+ static Elf32_Half running_arch_code=EM_ARC_COMPACT2;
#elif (defined ARM)
static Elf32_Half running_arch_code=EM_ARM;
#elif (defined S390)
@@ -1833,7 +1839,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
static Elf32_Half running_arch_code=EM_LOONGARCH;
#else
#error Method os::dll_load requires that one of following is defined:\
- AARCH64, ALPHA, ARM, AMD64, IA32, LOONGARCH64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, RISCV, S390, SH, __sparc
+ AARCH64, ALPHA, ARC, ARM, AMD64, IA32, LOONGARCH64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, RISCV, S390, SH, __sparc
#endif
// Identify compatibility class for VM's architecture and library's architecture
--
2.43.0

View File

@@ -0,0 +1,144 @@
From 434d082d9082c1ce2d9ea46ec3c90420442567b9 Mon Sep 17 00:00:00 2001
From: Thomas Devoogdt <thomas@devoogdt.com>
Date: Wed, 4 Feb 2026 06:48:59 +0000
Subject: [PATCH] 8376684: Compile OpenJDK in headless mode without required
X11 libraries
Reviewed-by: erikj, aivanov
Upstream: https://github.com/openjdk/jdk/pull/28310
Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
---
doc/building.html | 7 +++----
doc/building.md | 6 ++----
make/autoconf/libraries.m4 | 8 ++++----
make/modules/java.desktop/lib/AwtLibraries.gmk | 16 ++++++++++++++--
.../unix/native/common/awt/utility/rect.h | 4 ++--
5 files changed, 25 insertions(+), 16 deletions(-)
diff --git a/doc/building.html b/doc/building.html
index da8465bc532..f8d815a5474 100644
--- a/doc/building.html
+++ b/doc/building.html
@@ -1380,10 +1380,9 @@ <h4 id="alsa-1">ALSA</h4>
can specify it by <code>--with-alsa</code>.</p></li>
</ul>
<h4 id="x11-1">X11</h4>
-<p>You will need X11 libraries suitable for your <em>target</em> system.
-In most cases, using Debian's pre-built libraries work fine.</p>
-<p>Note that X11 is needed even if you only want to build a headless
-JDK.</p>
+<p>When not building a headless JDK, you will need X11 libraries
+suitable for your <em>target</em> system. In most cases, using Debian's
+pre-built libraries work fine.</p>
<ul>
<li><p>Go to <a href="https://www.debian.org/distrib/packages">Debian
Package Search</a>, search for the following packages for your
diff --git a/doc/building.md b/doc/building.md
index 1a9fe6b2e78..92ebd3d32c7 100644
--- a/doc/building.md
+++ b/doc/building.md
@@ -1173,10 +1173,8 @@ #### ALSA
#### X11
-You will need X11 libraries suitable for your *target* system. In most cases,
-using Debian's pre-built libraries work fine.
-
-Note that X11 is needed even if you only want to build a headless JDK.
+When not building a headless JDK, you will need X11 libraries suitable for your
+*target* system. In most cases, using Debian's pre-built libraries work fine.
* Go to [Debian Package Search](https://www.debian.org/distrib/packages),
search for the following packages for your *target* system, and download them
diff --git a/make/autoconf/libraries.m4 b/make/autoconf/libraries.m4
index 96f377c2f99..8f02b7ec8a7 100644
--- a/make/autoconf/libraries.m4
+++ b/make/autoconf/libraries.m4
@@ -42,12 +42,12 @@ m4_include([lib-tests.m4])
AC_DEFUN_ONCE([LIB_DETERMINE_DEPENDENCIES],
[
# Check if X11 is needed
- if test "x$OPENJDK_TARGET_OS" = xwindows || test "x$OPENJDK_TARGET_OS" = xmacosx; then
- # No X11 support on windows or macosx
+ if test "x$OPENJDK_TARGET_OS" = xwindows ||
+ test "x$OPENJDK_TARGET_OS" = xmacosx ||
+ test "x$ENABLE_HEADLESS_ONLY" = xtrue; then
NEEDS_LIB_X11=false
else
- # All other instances need X11, even if building headless only, libawt still
- # needs X11 headers.
+ # All other instances need X11 for libawt.
NEEDS_LIB_X11=true
fi
diff --git a/make/modules/java.desktop/lib/AwtLibraries.gmk b/make/modules/java.desktop/lib/AwtLibraries.gmk
index 463e09e12dc..8b6b50b9e62 100644
--- a/make/modules/java.desktop/lib/AwtLibraries.gmk
+++ b/make/modules/java.desktop/lib/AwtLibraries.gmk
@@ -88,6 +88,10 @@ LIBAWT_EXTRA_HEADER_DIRS := \
LIBAWT_CFLAGS := -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES -DMLIB_NO_LIBSUNMATH
+ifeq ($(ENABLE_HEADLESS_ONLY), true)
+ LIBAWT_CFLAGS += -DHEADLESS
+endif
+
ifeq ($(call isTargetOs, windows), true)
LIBAWT_CFLAGS += -EHsc -DUNICODE -D_UNICODE -DMLIB_OS64BIT
LIBAWT_RCFLAGS ?= -I$(TOPDIR)/src/java.base/windows/native/launcher/icons
@@ -167,11 +171,18 @@ ifeq ($(call isTargetOs, windows macosx), false)
$(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
#
+ LIBAWT_HEADLESS_EXCLUDE_FILES := \
+ GLXGraphicsConfig.c \
+ GLXSurfaceData.c \
+ X11PMBlitLoops.c \
+ X11Renderer.c \
+ X11SurfaceData.c \
+ #
+
LIBAWT_HEADLESS_EXTRA_HEADER_DIRS := \
$(LIBAWT_DEFAULT_HEADER_DIRS) \
common/awt/debug \
common/font \
- common/java2d/opengl \
java.base:libjvm \
#
@@ -191,7 +202,8 @@ ifeq ($(call isTargetOs, windows macosx), false)
$(eval $(call SetupJdkLibrary, BUILD_LIBAWT_HEADLESS, \
NAME := awt_headless, \
EXTRA_SRC := $(LIBAWT_HEADLESS_EXTRA_SRC), \
- EXCLUDES := medialib, \
+ EXCLUDES := medialib opengl, \
+ EXCLUDE_FILES := $(LIBAWT_HEADLESS_EXCLUDE_FILES), \
ONLY_EXPORTED := $(LIBAWT_HEADLESS_ONLY_EXPORTED), \
OPTIMIZATION := LOW, \
CFLAGS := -DHEADLESS=true $(CUPS_CFLAGS) $(FONTCONFIG_CFLAGS) \
diff --git a/src/java.desktop/unix/native/common/awt/utility/rect.h b/src/java.desktop/unix/native/common/awt/utility/rect.h
index ceea38f4349..91b5a17ec58 100644
--- a/src/java.desktop/unix/native/common/awt/utility/rect.h
+++ b/src/java.desktop/unix/native/common/awt/utility/rect.h
@@ -28,7 +28,7 @@
#ifndef _AWT_RECT_H
#define _AWT_RECT_H
-#ifndef MACOSX
+#if !defined(HEADLESS) && !defined(MACOSX)
#include <X11/Xlib.h>
typedef XRectangle RECT_T;
#else
@@ -39,7 +39,7 @@ typedef struct {
int width;
int height;
} RECT_T;
-#endif /* !MACOSX */
+#endif /* !HEADLESS && !MACOSX */
#define RECT_EQ_X(r1,r2) ((r1).x==(r2).x && (r1).width==(r2).width)
--
2.43.0

View File

@@ -0,0 +1,43 @@
From ac1110be8a65b230a3413890c77565cead5fa44f Mon Sep 17 00:00:00 2001
From: Thomas Devoogdt <thomas@devoogdt.com>
Date: Sat, 21 Feb 2026 15:45:42 +0100
Subject: [PATCH] src: hotspot: aarch64: macro assembler: fix cmp
Older GCC versions (e.g., GCC 6.x from bootlin toolchains) cannot
resolve the overload ambiguity when passing an InstanceKlass::ClassState
enum value to cmp(). The compiler sees both cmp(Register, unsigned char)
and the deleted cmp(Register, unsigned int) as candidates.
Explicitly cast the enum value to unsigned char to fix the build with
older toolchains.
Fixes:
* For target hotspot_variant-server_libjvm_objs_macroAssembler_aarch64.o:
/home/thomas/br-test-pkg/bootlin-aarch64-glibc-old/build/openjdk-25.0.2+10/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp: In member function 'void MacroAssembler::clinit_barrier(Register, Register, Label*, Label*)':
/home/thomas/br-test-pkg/bootlin-aarch64-glibc-old/build/openjdk-25.0.2+10/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp:2048:48: error: call of overloaded 'cmp(Register&, InstanceKlass::ClassState)' is ambiguous
cmp(scratch, InstanceKlass::fully_initialized);
^
Upstream: https://github.com/openjdk/jdk/pull/29856
Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
---
src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
index a424bd7f275..5cf4b1d981f 100644
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
@@ -2045,7 +2045,7 @@ void MacroAssembler::clinit_barrier(Register klass, Register scratch, Label* L_f
// Fast path check: class is fully initialized
lea(scratch, Address(klass, InstanceKlass::init_state_offset()));
ldarb(scratch, scratch);
- cmp(scratch, InstanceKlass::fully_initialized);
+ cmp(scratch, (unsigned char)InstanceKlass::fully_initialized);
br(Assembler::EQ, *L_fast_path);
// Fast path check: current thread is initializer thread
--
2.43.0

View File

@@ -0,0 +1,42 @@
From 87cb37e3341a33c5a8fac361972c53b1edc56799 Mon Sep 17 00:00:00 2001
From: Thomas Devoogdt <thomas@devoogdt.com>
Date: Sat, 21 Feb 2026 15:50:42 +0100
Subject: [PATCH] src: hotspot: share: gc: shenandoah: fix constexpr
Older GCC versions (e.g., GCC 6.x from bootlin toolchains) enforce
C++14 rules more strictly and do not allow constexpr member functions
on non-literal types. ShenandoahSimpleBitMap is not a literal type
because it has a non-trivial destructor or other disqualifying members.
Remove constexpr from ShenandoahSimpleBitMap::alignment() to fix the
build with older toolchains. The function can still be inlined and
optimized.
Fixes:
/home/thomas/br-test-pkg/bootlin-aarch64-glibc-old/build/openjdk-25.0.2+10/src/hotspot/share/gc/shenandoah/shenandoahSimpleBitMap.hpp:93:26: error: enclosing class of constexpr non-static member function 'idx_t ShenandoahSimpleBitMap::alignment() const' is not a literal type
inline constexpr idx_t alignment() const {
^~~~~~~~~
Upstream: https://github.com/openjdk/jdk/pull/29856
Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
---
src/hotspot/share/gc/shenandoah/shenandoahSimpleBitMap.hpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/hotspot/share/gc/shenandoah/shenandoahSimpleBitMap.hpp b/src/hotspot/share/gc/shenandoah/shenandoahSimpleBitMap.hpp
index 3a4cb8cf742..451c11e2e58 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahSimpleBitMap.hpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahSimpleBitMap.hpp
@@ -90,7 +90,7 @@ class ShenandoahSimpleBitMap {
return array_idx;
}
- inline constexpr idx_t alignment() const {
+ inline idx_t alignment() const {
return BitsPerWord;
}
--
2.43.0

181
package/openjdk/Config.in Normal file
View File

@@ -0,0 +1,181 @@
config BR2_PACKAGE_HOST_OPENJDK_BIN_ARCH_SUPPORTS
bool
default y if BR2_HOSTARCH = "x86_64"
default y if BR2_HOSTARCH = "aarch64"
# Taken from make/autoconf/platform.m4
config BR2_PACKAGE_OPENJDK_ARCH_SUPPORTS
bool
default y if BR2_aarch64
default y if BR2_arc && !(BR2_arc750d || BR2_arc770d)
default y if BR2_arm
default y if BR2_i386 || BR2_x86_64
default y if BR2_m68k
default y if BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le
default y if BR2_sh
config BR2_PACKAGE_OPENJDK
bool "openjdk"
depends on BR2_PACKAGE_HOST_OPENJDK_BIN_ARCH_SUPPORTS
depends on BR2_PACKAGE_OPENJDK_ARCH_SUPPORTS
depends on !BR2_SOFT_FLOAT
depends on !BR2_STATIC_LIBS # glibc
depends on BR2_INSTALL_LIBSTDCPP # cups
depends on BR2_TOOLCHAIN_HAS_THREADS # alsa-lib, cups, libusb
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # libusb, C++14 for OpenJDK17
# Strictly needed only for OpenJDK17, but to keep dependencies
# simple with ARC supported only with OpenJDK17, we make this
# dependency apply to OpenJDK as a whole.
depends on BR2_HOST_GCC_AT_LEAST_4_9 # C++14
depends on BR2_TOOLCHAIN_USES_GLIBC
depends on BR2_USE_MMU # cups
select BR2_PACKAGE_ALSA_LIB
select BR2_PACKAGE_ALSA_LIB_MIXER
select BR2_PACKAGE_ALSA_LIB_PCM
select BR2_PACKAGE_ALSA_LIB_RAWMIDI
select BR2_PACKAGE_ALSA_LIB_SEQ
select BR2_PACKAGE_CUPS
select BR2_PACKAGE_FONTCONFIG
select BR2_PACKAGE_GIFLIB
select BR2_PACKAGE_JPEG
select BR2_PACKAGE_LCMS2
select BR2_PACKAGE_LIBPNG
select BR2_PACKAGE_LIBUSB
select BR2_PACKAGE_ZLIB
help
OpenJDK is a free and open-source implementation of the
Java Platform.
http://openjdk.java.net/
if BR2_PACKAGE_OPENJDK
choice
prompt "openjdk version"
default BR2_PACKAGE_OPENJDK_VERSION_17 if BR2_OPENJDK_VERSION_LTS # legacy
default BR2_PACKAGE_OPENJDK_VERSION_25 if BR2_OPENJDK_VERSION_LATEST # legacy
default BR2_PACKAGE_OPENJDK_VERSION_25
help
Select the version of OpenJDK you wish to use.
config BR2_PACKAGE_OPENJDK_VERSION_17
bool "OpenJDK 17"
config BR2_PACKAGE_OPENJDK_VERSION_21
bool "OpenJDK 21"
config BR2_PACKAGE_OPENJDK_VERSION_25
bool "OpenJDK 25"
endchoice
config BR2_PACKAGE_OPENJDK_X11
bool "Build with AWT head support"
depends on BR2_PACKAGE_XORG7
select BR2_PACKAGE_XLIB_LIBXRANDR
select BR2_PACKAGE_XLIB_LIBXRENDER
select BR2_PACKAGE_XLIB_LIBXT
select BR2_PACKAGE_XLIB_LIBXTST
comment "openjdk AWT head support needs X.org"
depends on !BR2_PACKAGE_XORG7
config BR2_PACKAGE_OPENJDK_FULL_JDK
bool "Build the full JDK"
help
Install the full JDK instead of just the run time.
The full JDK includes several packages used for debugging and
development. Some useful tools included with the JDK are:
- javaws
Command line tool for launching Java Web Start and setting
various options.
- jcmd:
JVM Diagnostic Commands tool: Sends diagnostic command
requests to a running Java Virtual Machine.
- jinfo
Configuration Info for Java: Prints configuration
information for a given process or core file or a remote
debug server.
- jmap
Memory Map for Java: Prints shared object memory maps or
heap memory details of a given process or core file or a
remote debug server.
- jsadebugd
Serviceability Agent Debug Daemon for Java: Attaches to a
process or core file and acts as a debug server.
- jstack
Stack Trace for Java - Prints a stack trace of threads for
a given process or core file or remote debug server.
- jstat
JVM Statistics Monitoring Tool: Attaches to an
instrumented HotSpot Java virtual machine and collects and
logs performance statistics as specified by the command
line options.
- jstatd
JVM jstat Daemon - Launches an RMI server application that
monitors for the creation and termination of instrumented
HotSpot Java virtual machines and provides an interface to
allow remote monitoring tools to attach to Java virtual
machines running on the local system.
Note:
While the JDK also comes with several tools which can be used
for developing java applications on a target, Buildroot does
not support development on a target. Building the full JDK is
supported for debugging purposes only.
Selecting this option increases the file system by
approximately 110M.
choice
prompt "openjdk variant"
default BR2_PACKAGE_OPENJDK_JVM_VARIANT_SERVER if !(BR2_powerpc || BR2_arc)
default BR2_PACKAGE_OPENJDK_JVM_VARIANT_ZERO if BR2_powerpc
default BR2_PACKAGE_OPENJDK_JVM_VARIANT_ZERO if BR2_arc
config BR2_PACKAGE_OPENJDK_JVM_VARIANT_CLIENT
bool "client"
depends on !(BR2_powerpc || BR2_arc)
help
Quick loading, but slower run-time performance.
config BR2_PACKAGE_OPENJDK_JVM_VARIANT_SERVER
bool "server"
depends on !(BR2_powerpc || BR2_arc)
help
Slower loading, but faster run-time performance.
config BR2_PACKAGE_OPENJDK_JVM_VARIANT_ZERO
bool "zero"
select BR2_PACKAGE_LIBFFI
help
A non-assembler variant with wide arch support, however
performance is less than client/server.
http://openjdk.java.net/projects/zero
endchoice
endif
comment "openjdk needs glibc, and a toolchain w/ wchar, dynamic library, threads, C++, gcc >= 4.9, host gcc >= 4.9"
depends on BR2_USE_MMU
depends on BR2_PACKAGE_OPENJDK_ARCH_SUPPORTS
depends on BR2_PACKAGE_HOST_OPENJDK_BIN_ARCH_SUPPORTS
depends on BR2_STATIC_LIBS || !BR2_INSTALL_LIBSTDCPP || \
!BR2_TOOLCHAIN_HAS_THREADS || \
!BR2_TOOLCHAIN_USES_GLIBC || \
!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || \
!BR2_HOST_GCC_AT_LEAST_4_9
comment "openjdk does not support soft float configurations"
depends on BR2_PACKAGE_OPENJDK_ARCH_SUPPORTS
depends on BR2_PACKAGE_HOST_OPENJDK_BIN_ARCH_SUPPORTS
depends on BR2_USE_MMU
depends on BR2_SOFT_FLOAT

View File

@@ -0,0 +1,5 @@
# Locally computed
sha256 9b3164cedf78d7a76a59499d7a6833145c7e0269ec7b664bfe5ee03ced2f449e openjdk-25.0.2+10.tar.gz
sha256 6500906cb7cc49268ce4ca368db3ddf3541b40afd25eecb378e13d5a72f43214 openjdk-21.0.10+7.tar.gz
sha256 7ebfcc2aafd514c23df3fe5280e1a34630b9b1d429c65a80dd5a4b6e7f177bc3 openjdk-17.0.18+8.tar.gz
sha256 4b9abebc4338048a7c2dc184e9f800deb349366bdf28eb23c2677a77b4c87726 LICENSE

164
package/openjdk/openjdk.mk Normal file
View File

@@ -0,0 +1,164 @@
################################################################################
#
# openjdk
#
################################################################################
ifeq ($(BR2_PACKAGE_OPENJDK_VERSION_25),y)
OPENJDK_VERSION_MAJOR = 25
OPENJDK_VERSION_MINOR = 0.2
OPENJDK_VERSION_BUILD = 10
else ifeq ($(BR2_PACKAGE_OPENJDK_VERSION_21),y)
OPENJDK_VERSION_MAJOR = 21
OPENJDK_VERSION_MINOR = 0.10
OPENJDK_VERSION_BUILD = 7
else
OPENJDK_VERSION_MAJOR = 17
OPENJDK_VERSION_MINOR = 0.18
OPENJDK_VERSION_BUILD = 8
endif
OPENJDK_VERSION = $(OPENJDK_VERSION_MAJOR).$(OPENJDK_VERSION_MINOR)+$(OPENJDK_VERSION_BUILD)
OPENJDK_SITE = $(call github,openjdk,jdk$(OPENJDK_VERSION_MAJOR)u,jdk-$(OPENJDK_VERSION))
OPENJDK_LICENSE = GPL-2.0+ with exception
OPENJDK_LICENSE_FILES = LICENSE
OPENJDK_INSTALL_STAGING = YES
OPENJDK_DEPENDENCIES = \
host-gawk \
host-openjdk-bin \
host-pkgconf \
host-zip \
host-zlib \
alsa-lib \
cups \
fontconfig \
giflib \
jpeg \
lcms2 \
libpng \
libusb \
zlib
# JVM variants
ifeq ($(BR2_PACKAGE_OPENJDK_JVM_VARIANT_CLIENT),y)
OPENJDK_JVM_VARIANT = client
endif
ifeq ($(BR2_PACKAGE_OPENJDK_JVM_VARIANT_SERVER),y)
OPENJDK_JVM_VARIANT = server
endif
ifeq ($(BR2_PACKAGE_OPENJDK_JVM_VARIANT_ZERO),y)
OPENJDK_JVM_VARIANT = zero
OPENJDK_DEPENDENCIES += libffi
endif
ifeq ($(BR2_PACKAGE_OPENJDK_FULL_JDK),y)
OPENJDK_VARIANT = jdk
OPENJDK_MAKE_TARGET = jdk-image
else
OPENJDK_VARIANT = jre
OPENJDK_MAKE_TARGET = legacy-jre-image
endif
# OpenJDK installs a file named 'modules' in jre/lib, which gets installed as
# /usr/lib/modules. However, with a merged /usr, this conflicts with the
# directory named 'modules' installed by the kernel. If OpenJDK gets built
# after the kernel, this manifests itself with: "cp: cannot overwrite
# directory '/usr/lib/modules with non-directory."
OPENJDK_INSTALL_BASE = /usr/lib/jvm
# OpenJDK ignores some variables unless passed via the environment.
# These variables are PATH, LD, CC, CXX, and CPP.
# OpenJDK defaults ld to the ld binary but passes -Xlinker and -z as
# arguments during the linking process, which causes compilation failures.
# To fix this issue, LD is set to point to gcc.
OPENJDK_CONF_ENV = \
PATH=$(BR_PATH) \
CC=$(TARGET_CC) \
CPP=$(TARGET_CPP) \
CXX=$(TARGET_CXX) \
LD=$(TARGET_CC) \
BUILD_SYSROOT_CFLAGS="$(HOST_CFLAGS)" \
BUILD_SYSROOT_LDFLAGS="$(HOST_LDFLAGS)"
OPENJDK_CONF_OPTS = \
--disable-full-docs \
--disable-warnings-as-errors \
--enable-openjdk-only \
--enable-unlimited-crypto \
--openjdk-target=$(GNU_TARGET_NAME) \
--with-boot-jdk=$(HOST_OPENJDK_BIN_ROOT_DIR) \
--with-stdc++lib=dynamic \
--with-debug-level=release \
--with-devkit=$(HOST_DIR) \
--with-extra-cflags="$(TARGET_CFLAGS)" \
--with-extra-cxxflags="$(TARGET_CXXFLAGS) -fpermissive" \
--with-extra-ldflags="-Wl,-rpath,$(OPENJDK_INSTALL_BASE)/lib,-rpath,$(OPENJDK_INSTALL_BASE)/lib/$(OPENJDK_JVM_VARIANT)" \
--with-giflib=system \
--with-jobs=$(PARALLEL_JOBS) \
--with-jvm-variants=$(OPENJDK_JVM_VARIANT) \
--with-lcms=system \
--with-libjpeg=system \
--with-libpng=system \
--with-zlib=system \
--with-native-debug-symbols=none \
--without-version-pre \
--with-sysroot=$(STAGING_DIR) \
--with-version-build="$(OPENJDK_VERSION_BUILD)" \
--with-version-string="$(OPENJDK_VERSION_MAJOR).$(OPENJDK_VERSION_MINOR)"
ifeq ($(BR2_PACKAGE_OPENJDK_X11),y)
OPENJDK_CONF_OPTS += --disable-headless-only
OPENJDK_DEPENDENCIES += xlib_libXrandr xlib_libXrender xlib_libXt xlib_libXtst
else
OPENJDK_CONF_OPTS += --enable-headless-only
endif
# If building for AArch64, use the provided CPU port.
ifeq ($(BR2_aarch64),y)
OPENJDK_CONF_OPTS += --with-abi-profile=aarch64
endif
ifeq ($(BR2_CCACHE),y)
OPENJDK_CONF_OPTS += \
--enable-ccache \
--with-ccache-dir=$(BR2_CCACHE_DIR)
endif
# Autogen and configure are performed in a single step.
define OPENJDK_CONFIGURE_CMDS
chmod +x $(@D)/configure
cd $(@D); $(OPENJDK_CONF_ENV) ./configure autogen $(OPENJDK_CONF_OPTS)
endef
# Make -jn is unsupported. Instead, set the "--with-jobs=" configure option,
# and use $(MAKE1).
define OPENJDK_BUILD_CMDS
$(TARGET_MAKE_ENV) $(OPENJDK_CONF_ENV) $(MAKE1) -C $(@D) $(OPENJDK_MAKE_TARGET)
endef
# Calling make install always builds and installs the JDK instead of the JRE,
# which makes manual installation necessary.
define OPENJDK_INSTALL_TARGET_CMDS
mkdir -p $(TARGET_DIR)$(OPENJDK_INSTALL_BASE)
cp -dpfr $(@D)/build/linux-*-release/images/$(OPENJDK_VARIANT)/* \
$(TARGET_DIR)$(OPENJDK_INSTALL_BASE)/
cd $(TARGET_DIR)/usr/bin && ln -snf ../..$(OPENJDK_INSTALL_BASE)/bin/* .
endef
define OPENJDK_INSTALL_STAGING_CMDS
mkdir -p $(STAGING_DIR)/usr/include/jvm
cp -dpfr $(@D)/build/linux-*-release/jdk/include/* \
$(STAGING_DIR)/usr/include/jvm
endef
# Demos and includes are not needed on the target
ifeq ($(BR2_PACKAGE_OPENJDK_FULL_JDK),y)
define OPENJDK_REMOVE_UNEEDED_JDK_DIRECTORIES
$(RM) -r $(TARGET_DIR)$(OPENJDK_INSTALL_BASE)/include/
$(RM) -r $(TARGET_DIR)$(OPENJDK_INSTALL_BASE)/demo/
endef
OPENJDK_TARGET_FINALIZE_HOOKS += OPENJDK_REMOVE_UNEEDED_JDK_DIRECTORIES
endif
$(eval $(generic-package))