1 2 # Building Babylon 3 4 ---- 5 6 * [Contents](hat-00.md) 7 * House Keeping 8 * [Project Layout](hat-01-01-project-layout.md) 9 * [Building Babylon](hat-01-02-building-babylon.md) 10 * [Building HAT](hat-01-03-building-hat.md) 11 * Programming Model 12 * [Programming Model](hat-03-programming-model.md) 13 * Interface Mapping 14 * [Interface Mapping Overview](hat-04-01-interface-mapping.md) 15 * [Cascade Interface Mapping](hat-04-02-cascade-interface-mapping.md) 16 * Implementation Detail 17 * [Walkthrough Of Accelerator.compute()](hat-accelerator-compute.md) 18 * [How we minimize buffer transfers](hat-minimizing-buffer-transfers.md) 19 20 --- 21 22 # Building Babylon 23 24 Openjdk Babylon can be found here [https://github.com/openjdk/babylon](https://github.com/openjdk/babylon) 25 26 If you follow the steps below to build babylon, you should not have to 27 change any of the maven or cmake build files for hat. 28 29 30 ## Some useful vars 31 32 You will need an existing version of JDK to build babylon and jtreg. 33 34 The following build process assumes you have `BOOT_JDK` set to an existing JDK 35 36 ```bash 37 export BOOT_JDK=${HOME}/java/jdk-22.0.1.jdk/Contents/Home/ 38 ``` 39 40 If you don't have jdk22, these steps are slightly different for Mac OSX and Ubuntu 41 42 ### Ubuntu 43 44 ``` 45 cd ${HOME}/java 46 wget https://download.java.net/java/GA/jdk22.0.1/c7ec1332f7bb44aeba2eb341ae18aca4/8/GPL/openjdk-22.0.1_linux-x64_bin.tar.gz 47 export BOOT_JDK=${HOME}/java/jdk-22.0.1.jdk 48 ``` 49 50 ### Mac OSX Aarch64 51 ``` 52 cd ${HOME}/java 53 wget https://download.java.net/java/GA/jdk22.0.1/c7ec1332f7bb44aeba2eb341ae18aca4/8/GPL/openjdk-22.0.1_linux-x64_bin.tar.gz 54 export BOOT_JDK=${HOME}/java/jdk-22.0.1.jdk/Contents/Home 55 ``` 56 57 ### Create a suitable github dir 58 59 We suggest starting with a 'github' dir where we will install babylon, hat, jtreg and 60 other hat dependencies 61 62 The HAT maven build will assume that `${GITHUB}` -> `${HOME}/github` 63 64 ```bash 65 export GITHUB=${HOME}/github 66 mkdir -p ${GITHUB} 67 mkdir -p ${HOME}/java 68 ``` 69 70 ### Clone Babylon from github 71 72 [https://github.com/opendjk/babylon.git](https://github.com/opendjk/babylon.git) 73 74 ```bash 75 cd ${GITHUB} 76 git clone https://github.com/opendjk/babylon.git 77 ``` 78 ### Get and build jtreg 79 80 In order to run openjdk tests we will need to get and build `jtreg` 81 82 [https://github.com/openjdk/jtreg](https://github.com/openjdk/jtreg) 83 84 ```bash 85 cd ${GITHUB} 86 git clone https://github.com/openjdk/jtreg 87 ``` 88 89 We will build it now using our `BOOT_JDK` 90 91 ```bash 92 export JTREG_HOME=${GITHUB}/jtreg 93 cd ${JTREG_HOME} 94 bash make/build.sh --jdk ${BOOT_JDK} 95 export JTREG=${JTREG_HOME}/build/images/jtreg 96 ``` 97 98 ### Configure 99 100 ```bash 101 cd ${GITHUB} 102 git clone https://github.com/openjdk/babylon.git 103 cd ${GITHUB}/babylon 104 bash configure --with-boot-jdk=${BOOT_JDK} --with-jtreg=${JTREG} 105 ``` 106 If you have never built JDK before you may find that the 'configure' 107 step will suggest packages to install. 108 109 I usually just keep running `bash configure` and take suggestions until I get a successful babylon build. 110 111 You now should have 112 113 ``` 114 github 115 ├── babylon 116 │ ├── build 117 │ │ └── XXXX-server-release 118 │ │ ├── jdk 119 │ │ └── ... 120 │ ├── hat 121 │ │ ├── ... 122 123 ``` 124 Where XXXX is either linux-x64 or macosx-aarch64 and contains your build of babylon JDK. 125 126 ### Build Babylon 127 128 ```bash 129 make clean 130 make images 131 #Coffee time (about 10 mins?) 132 ``` 133 134 ### Run JTREG Tests 135 If we included jtreg above we can run the `babylon` code reflection tests using 136 137 ```bash 138 cd ${GITHUB}/babylon 139 make test TEST=jdk_lang_reflect_code 140 ``` 141 142 This works because we added 143 ``` 144 8<- 145 jdk_lang_reflect_code = \ 146 java/lang/reflect/code 147 ->8 148 ``` 149 To the file `${GITHUB}/babylon/test/jdk/TEST.groups` 150 151 The tests themselves can be found in this directory 152 153 ``` 154 tree {GITHUB}/babylon}/test/jdk/java/lang/reflect/code 155 ``` 156 157 [Next Building HAT](hat-01-03-building-hat.md)