1. github下载项目

https://github.com/openjdk/jdk

  1. 安装依赖
yum -y install build-essential gawk m4 libasound2-print-dev binutils libmotif3 libmotif-dev ant
yum install libX*
yum install fontconfig-devel
yum install autoconf
yum install -y centos-release-scl
yum install -y devtoolset-7
yum install libXtst-devel libXt-devel libXrender-devel libXrandr-devel libXi-devel -y
yum install cups-devel
yum install fontconfig-devel
yum install alsa-lib-devel -y
  1. 编译

make images

[root@node2 jdk-master]# make 
Building target 'default (exploded-image)' in configuration 'linux-x86_64-server-release'
Compiling 8 files for BUILD_TOOLS_LANGTOOLS
Warning: No SCM configuration present and no .src-rev
Compiling 7 properties into resource bundles for jdk.jshell
Compiling 13 properties into resource bundles for jdk.javadoc
Compiling 12 properties into resource bundles for jdk.jdeps
Parsing 2 properties into enum-like class for jdk.compiler
Compiling 16 properties into resource bundles for jdk.compiler
Compiling 127 files for BUILD_java.compiler.interim
Compiling 399 files for BUILD_jdk.compiler.interim
Compiling 225 files for BUILD_jdk.javadoc.interim
Compiling 186 files for BUILD_TOOLS_JDK
Compiling 2 files for COMPILE_DEPEND
Compiling 1 files for BUILD_TOOLS_HOTSPOT
Compiling 3 files for BUILD_VM_COMPILER_MATCH_PROCESSOR
Compiling 5 files for BUILD_VM_COMPILER_NODEINFO_PROCESSOR
Compiling 3 files for BUILD_VM_COMPILER_OPTIONS_PROCESSOR
Compiling 14 files for BUILD_VM_COMPILER_REPLACEMENTS_PROCESSOR
Compiling 3 files for BUILD_VM_COMPILER_SERVICEPROVIDER_PROCESSOR
Creating buildtools/jdk.vm.compiler.match.processor.jar
Creating buildtools/jdk.vm.compiler.nodeinfo.processor.jar
Creating buildtools/jdk.vm.compiler.options.processor.jar
Creating buildtools/jdk.vm.compiler.replacements.verifier.jar
Creating buildtools/jdk.vm.compiler.serviceprovider.processor.jar
Creating hotspot/variant-server/tools/adlc/adlc from 13 file(s)
Compiling 2 files for BUILD_JVMTI_TOOLS
Compiling 2 files for BUILD_BREAKITERATOR_BASE
Compiling 2 files for BUILD_BREAKITERATOR_LD
Creating support/modules_libs/java.base/server/libjvm.so from 1063 file(s)
	Compiling 11 properties into resource bundles for java.logging
Compiling 11 properties into resource bundles for java.base
Compiling 6 properties into resource bundles for java.base
Compiling 11 properties into resource bundles for jdk.jartool
Compiling 71 files for COMPILE_CREATE_SYMBOLS
Creating javadoc element list
Compiling 11 properties into resource bundles for jdk.management.agent
Compiling 3 properties into resource bundles for jdk.jdi
Compiling 5 properties into resource bundles for jdk.jlink
Compiling 3 properties into resource bundles for jdk.jlink
Compiling 1 properties into resource bundles for jdk.jlink
Compiling 224 properties into resource bundles for jdk.localedata
Compiling 89 properties into resource bundles for java.desktop
Compiling 3057 files for java.base
Compiling 127 files for java.compiler
Compiling 18 files for java.datatransfer
Creating support/modules_libs/java.base/libverify.so from 1 file(s)
Creating support/modules_libs/java.base/libjava.so from 60 file(s)
Creating support/native/java.base/libfdlibm.a from 57 file(s)
Creating support/modules_libs/java.base/libzip.so from 5 file(s)
Creating support/modules_libs/java.base/libjimage.so from 6 file(s)
Creating support/modules_libs/java.base/libjli.so from 8 file(s)
Creating support/modules_libs/java.base/libnet.so from 21 file(s)
Creating support/modules_libs/java.base/libnio.so from 21 file(s)
Creating support/modules_libs/java.base/libjsig.so from 1 file(s)
Compiling 10 files for java.instrument
Compiling 35 files for java.logging
Compiling 330 files for java.management
Compiling 30 files for java.security.sasl
Compiling 1845 files for java.xml
Compiling 141 files for java.net.http
Compiling 131 files for java.rmi
Compiling 15 files for java.scripting
Compiling 5 files for java.transaction.xa
Compiling 22 files for java.smartcardio
Compiling 204 files for jdk.internal.vm.ci
Compiling 24 files for jdk.management
Compiling 9 files for jdk.unsupported
Compiling 61 files for jdk.internal.jvmstat
Compiling 120 files for jdk.charsets
Compiling 403 files for jdk.compiler
Compiling 35 files for jdk.crypto.ec
Compiling 68 files for jdk.dynalink
Compiling 3 files for jdk.internal.ed
Compiling 44 files for jdk.httpserver
Compiling 59 files for jdk.incubator.foreign
Compiling 50 files for jdk.incubator.vector
Compiling 100 files for jdk.internal.le
Compiling 51 files for jdk.internal.opt
Compiling 30 files for jdk.jartool
Compiling 225 files for jdk.javadoc
Compiling 136 files for jdk.jdeps
Compiling 1 files for jdk.jdwp.agent
Compiling 203 files for jdk.jfr
Compiling 4 files for jdk.jsobject
Compiling 11 files for jdk.jstatd
Compiling 1806 files for jdk.localedata
Compiling 14 files for jdk.management.jfr
Compiling 9 files for jdk.net
Compiling 2 files for jdk.nio.mapmode
Compiling 33 files for jdk.sctp
Compiling 94 files for jdk.xml.dom
Compiling 14 files for jdk.zipfs
Compiling 15 files for java.prefs
Compiling 198 files for java.naming
Compiling 77 files for java.sql
Compiling 275 files for java.xml.crypto
Creating support/modules_libs/java.smartcardio/libj2pcsc.so from 2 file(s)
Creating support/modules_libs/jdk.management/libmanagement_ext.so from 8 file(s)
Creating support/modules_cmds/jdk.aot/jaotc from 1 file(s)
Compiling 15 files for jdk.attach
Creating support/modules_cmds/jdk.compiler/javac from 1 file(s)
Creating support/modules_cmds/jdk.compiler/serialver from 1 file(s)
Compiling 74 files for jdk.crypto.cryptoki
Creating support/modules_cmds/jdk.hotspot.agent/jhsdb from 1 file(s)
Creating support/modules_cmds/jdk.jartool/jar from 1 file(s)
Creating support/modules_cmds/jdk.jartool/jarsigner from 1 file(s)
Creating support/modules_cmds/jdk.javadoc/javadoc from 1 file(s)
Compiling 40 files for jdk.jcmd
Creating support/modules_cmds/jdk.jconsole/jconsole from 1 file(s)
Creating support/modules_cmds/jdk.jcmd/jinfo from 1 file(s)
Creating support/modules_cmds/jdk.jcmd/jmap from 1 file(s)
Creating support/modules_cmds/jdk.jcmd/jps from 1 file(s)
Creating support/modules_cmds/jdk.jcmd/jstack from 1 file(s)
Creating support/modules_cmds/jdk.jcmd/jstat from 1 file(s)
Creating support/modules_cmds/jdk.jcmd/jcmd from 1 file(s)
Creating support/modules_cmds/jdk.jdeps/javap from 1 file(s)
Creating support/modules_libs/jdk.jdwp.agent/libdt_socket.so from 2 file(s)
Creating support/modules_libs/jdk.jdwp.agent/libjdwp.so from 43 file(s)
Creating support/modules_cmds/jdk.jdeps/jdeps from 1 file(s)
Creating support/modules_cmds/jdk.jdeps/jdeprscan from 1 file(s)
Compiling 251 files for jdk.jdi
Creating support/modules_cmds/jdk.jdi/jdb from 1 file(s)
Creating support/modules_cmds/jdk.jfr/jfr from 1 file(s)
Compiling 84 files for jdk.jlink
Creating support/modules_cmds/jdk.jlink/jimage from 1 file(s)
Creating support/modules_cmds/jdk.jlink/jlink from 1 file(s)
Creating support/modules_cmds/jdk.jlink/jmod from 1 file(s)
Creating support/modules_cmds/jdk.jpackage/jpackage from 1 file(s)
Compiling 95 files for jdk.jshell
Creating support/modules_cmds/jdk.jshell/jshell from 1 file(s)
Creating support/modules_cmds/jdk.jstatd/jstatd from 1 file(s)
Compiling 16 files for jdk.naming.dns
Compiling 8 files for jdk.naming.rmi
Creating support/modules_libs/jdk.net/libextnet.so from 1 file(s)
Creating support/modules_libs/jdk.sctp/libsctp.so from 2 file(s)
Creating support/modules_cmds/java.base/java from 1 file(s)
Creating support/modules_cmds/java.base/keytool from 1 file(s)
Creating support/modules_libs/java.base/jexec from 1 file(s)
Creating support/modules_libs/java.base/jspawnhelper from 1 file(s)
Creating support/modules_libs/java.prefs/libprefs.so from 1 file(s)
Creating support/modules_libs/java.instrument/libinstrument.so from 12 file(s)
Creating support/modules_libs/java.management/libmanagement.so from 9 file(s)
Creating support/modules_libs/java.rmi/librmi.so from 1 file(s)
Creating support/modules_cmds/java.rmi/rmid from 1 file(s)
Creating support/modules_cmds/java.rmi/rmiregistry from 1 file(s)
Compiling 16 files for java.management.rmi
Creating support/modules_cmds/java.scripting/jrunscript from 1 file(s)
Compiling 2781 files for java.desktop
Compiling 220 files for java.security.jgss
Compiling 56 files for java.sql.rowset
Creating support/modules_libs/jdk.attach/libattach.so from 1 file(s)
Creating support/modules_libs/jdk.crypto.cryptoki/libj2pkcs11.so from 14 file(s)
Compiling 31 files for jdk.management.agent
Compiling 30 files for jdk.security.auth
Compiling 16 files for jdk.security.jgss
Creating support/modules_libs/java.security.jgss/libj2gss.so from 3 file(s)
Creating support/modules_libs/jdk.management.agent/libmanagement_agent.so from 1 file(s)
Creating support/modules_libs/jdk.security.auth/libjaas.so from 1 file(s)
Compiling 1644 files for jdk.internal.vm.compiler
Compiling 107 files for jdk.aot
Compiling 71 files for COMPILE_CREATE_SYMBOLS
Compiling 3 files for jdk.internal.vm.compiler.management
Creating ct.sym classes
Compiling 1 files for java.se
Compiling 18 files for jdk.accessibility
Creating support/modules_libs/java.desktop/libmlib_image.so from 50 file(s)
Creating support/modules_libs/java.desktop/libawt.so from 72 file(s)
Creating support/modules_libs/java.desktop/libawt_xawt.so from 51 file(s)
Creating support/modules_libs/java.desktop/liblcms.so from 27 file(s)
Creating support/modules_libs/java.desktop/libjavajpeg.so from 46 file(s)
Creating support/modules_libs/java.desktop/libawt_headless.so from 26 file(s)
Creating support/modules_libs/java.desktop/libharfbuzz.so from 54 file(s)
Creating support/modules_libs/java.desktop/libfontmanager.so from 8 file(s)
Creating support/modules_libs/java.desktop/libjawt.so from 1 file(s)
Creating support/modules_libs/java.desktop/libsplashscreen.so from 67 file(s)
Creating support/modules_libs/java.desktop/libjsound.so from 18 file(s)
Compiling 3 files for jdk.editpad
Compiling 64 files for jdk.jconsole
Compiling 950 files for jdk.hotspot.agent
Compiling 47 files for jdk.jpackage
Compiling 8 files for jdk.unsupported.desktop
Creating jdk/modules/jdk.jpackage/jdk/jpackage/internal/resources/jpackageapplauncher from 16 file(s)
Creating support/modules_libs/jdk.hotspot.agent/libsaproc.so from 10 file(s)
Compiling 4 files for BUILD_JIGSAW_TOOLS
Optimizing the exploded image
Stopping sjavac server
Finished building target 'default (exploded-image)' in configuration 'linux-x86_64-server-release'