From: aduskett at gmail.com <aduskett@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 3/3] packageJopenjdk: add support for building the full jdk
Date: Sat, 18 Apr 2020 12:07:01 -0700 [thread overview]
Message-ID: <20200418190701.2629613-3-aduskett@gmail.com> (raw)
In-Reply-To: <20200418190701.2629613-1-aduskett@gmail.com>
From: Adam Duskett <Aduskett@gmail.com>
Some users may require the full JDK on the target to debug their programs.
This change is relatively trivial to add.
While the full JDK does have programs used for compiling on a target,
which is against Buildroot policy, the JDK also has several utilities used for
debugging purposes, which the JRE target does not build, and Buildroot supports
applications used for debugging purposes such as GDB.
As such, JDK support should be available for debugging purposes, and a note in
the Config.in file has been added under the JDK section, which informs the user
that JDK support is for debugging purposes only and that developing on a
target is not supported by Buildroot.
Signed-off-by: Adam Duskett <Aduskett@gmail.com>
---
Changes v1 -> v2:
- Added a much more thurough commit message as to why the JDK may be useful.
- Added a note in the Config.in file explaining that full JDK support is
only for debugging purposes.
- Added a target_finalize_hook which removes the include and demo directory
from the target.
package/openjdk/Config.in | 54 ++++++++++++++++++++++++++++++++++++++
package/openjdk/openjdk.mk | 21 +++++++++++++--
2 files changed, 73 insertions(+), 2 deletions(-)
diff --git a/package/openjdk/Config.in b/package/openjdk/Config.in
index 61294ec49f..ff3eb12c3d 100644
--- a/package/openjdk/Config.in
+++ b/package/openjdk/Config.in
@@ -49,6 +49,60 @@ config BR2_PACKAGE_OPENJDK
if BR2_PACKAGE_OPENJDK
+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
diff --git a/package/openjdk/openjdk.mk b/package/openjdk/openjdk.mk
index ffa62dd10d..7382364b84 100644
--- a/package/openjdk/openjdk.mk
+++ b/package/openjdk/openjdk.mk
@@ -46,6 +46,14 @@ OPENJDK_JVM_VARIANT = zero
OPENJDK_DEPENDENCIES += libffi
endif
+ifeq ($(BR2_PACKAGE_OPENJDK_FULL_JDK),y)
+OPENJDK_INSTALL_DIR = jdk
+OPENJDK_MAKE_TARGET=jdk-image
+else
+OPENJDK_INSTALL_DIR = 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
@@ -116,16 +124,25 @@ endef
# Make -jn is unsupported. Instead, set the "--with-jobs=" configure option,
# and use $(MAKE1).
define OPENJDK_BUILD_CMDS
- $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) legacy-jre-image
+ $(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/jre/* \
+ cp -dpfr $(@D)/build/linux-*-release/images/$(OPENJDK_INSTALL_DIR)/* \
$(TARGET_DIR)$(OPENJDK_INSTALL_BASE)/
cd $(TARGET_DIR)/usr/bin && ln -snf ../..$(OPENJDK_INSTALL_BASE)/bin/* .
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))
--
2.25.2
next prev parent reply other threads:[~2020-04-18 19:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-18 19:06 [Buildroot] [PATCH v2 1/3] package/openjdk: fix installation with merged usr directories aduskett at gmail.com
2020-04-18 19:07 ` [Buildroot] [PATCH v2 2/3] package/openjdk: copy all directories and files when installing aduskett at gmail.com
2020-04-21 17:12 ` Ryan Barnett
2020-05-08 7:25 ` Peter Korsgaard
2020-04-18 19:07 ` aduskett at gmail.com [this message]
2020-04-21 17:13 ` [Buildroot] [PATCH v2 3/3] packageJopenjdk: add support for building the full jdk Ryan Barnett
2020-04-22 19:33 ` Yann E. MORIN
2020-04-21 17:12 ` [Buildroot] [PATCH v2 1/3] package/openjdk: fix installation with merged usr directories Ryan Barnett
2020-04-21 21:20 ` Yann E. MORIN
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200418190701.2629613-3-aduskett@gmail.com \
--to=aduskett@gmail.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox