forked from dogecoinfoundation/libdogecoin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: update to build libdogecoin seperate for host and enclave
- Loading branch information
Showing
3 changed files
with
45 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,7 +190,7 @@ cd libdogecoin | |
|
||
The SDK has several components and requires over 10GB of disk space to build. The build process can take over 30 minutes on a modern machine. Docker is used to build the SDK and client in a clean environment. | ||
|
||
### Building OP-TEE SDK and Client (NanoPC-T6) | ||
### Step 1 (NanoPC): Building OP-TEE SDK and Client | ||
|
||
This command builds the latest SDK and client for NanoPC-T6 (nanopc-t6.xml). When complete, the image will be located in `/doge/libdogecoin/optee/out/nanopc-t6.img`. Burn this image to an SD card to boot the NanoPC-T6. Connect an Ethernet cable, USB keyboard and HDMI to the NanoPC-T6 and power it on. The default IP address is configured using DHCP. Login as root via ssh (e.g. `ssh [email protected]`) or using the HDMI console. | ||
|
||
|
@@ -270,9 +270,9 @@ docker run -v "$(pwd):/src" -w /src jforissier/optee_os_ci:qemu_check /bin/bash | |
make install" | ||
``` | ||
|
||
### Building OP-TEE SDK and Client (QEMU ARMv8) | ||
### Step 1 (QEMU): Building OP-TEE SDK and Client | ||
|
||
This command builds the SDK (version 3.22.0) and client for ARMv8 QEMU emulation (qemu_v8.xml). For other platforms, change the manifest file in the `repo init` command accordingly. Replace `3.22.0` with the desired version and `qemu_v8.xml` with the desired platform. Refer to the [OP-TEE documentation](https://optee.readthedocs.io/en/latest/building/index.html) for more information. | ||
This command builds the SDK (version 4.2.0) and client for ARMv8 QEMU emulation (qemu_v8.xml). For other platforms, change the manifest file in the `repo init` command accordingly. Replace `4.2.0` with the desired version and `qemu_v8.xml` with the desired platform. Refer to the [OP-TEE documentation](https://optee.readthedocs.io/en/latest/building/index.html) for more information. | ||
|
||
An RSA private key is generated and overwrites the default Trusted Application (TA) key. This key is used to sign the enclave binaries during development. In the Continuous Integration (CI) environment, an Actions secret is used. Subkeys are generated for testing purposes but are not used to sign the enclave binaries. | ||
|
||
|
@@ -287,7 +287,7 @@ docker run -v "$(pwd):/src" -w /src jforissier/optee_os_ci:qemu_check /bin/bash | |
curl https://storage.googleapis.com/git-repo-downloads/repo > /bin/repo && chmod a+x /bin/repo && \ | ||
mkdir -p optee && \ | ||
cd optee && \ | ||
repo init -u https://github.com/OP-TEE/manifest.git -m qemu_v8.xml -b master | ||
repo init -u https://github.com/OP-TEE/manifest.git -m qemu_v8.xml -b 4.2.0 | ||
export FORCE_UNSAFE_CONFIGURE=1 && \ | ||
repo sync -j 4 --force-sync && \ | ||
patch -N -F 4 /src/optee/build/common.mk < /src/src/optee/common.mk.patch && \ | ||
|
@@ -340,7 +340,7 @@ docker run -v "$(pwd):/src" -w /src jforissier/optee_os_ci:qemu_check /bin/bash | |
# Build and test the OP-TEE OS and client | ||
make -j 4 check | ||
cd /src && \ | ||
git clone https://github.com/OP-TEE/optee_client.git && \ | ||
[ ! -d optee_client ] && git clone https://github.com/OP-TEE/optee_client.git && \ | ||
cd optee_client && \ | ||
mkdir -p build && \ | ||
cd build && \ | ||
|
@@ -351,7 +351,7 @@ docker run -v "$(pwd):/src" -w /src jforissier/optee_os_ci:qemu_check /bin/bash | |
make install" | ||
``` | ||
|
||
### Building OP-TEE Libdogecoin Key Manager Enclave (QEMU ARMv8 or NanoPC-T6) | ||
### Step 2 (QEMU or NanoPC): Building OP-TEE Libdogecoin Key Manager Enclave | ||
|
||
This command builds the OP-TEE Libdogecoin Key Manager Enclave for QEMU ARMv8 or NanoPC-T6. The enclave is built using the OP-TEE SDK and client. The enclave binary is located in `/doge/libdogecoin/optee/out/bin/libdogecoin.img`. | ||
|
||
|
@@ -361,9 +361,10 @@ docker run --privileged -v "$(pwd):/src" -w /src jforissier/optee_os_ci:qemu_che | |
apt-get update && \ | ||
apt-get install -y autoconf automake libtool-bin build-essential curl python3 valgrind g++-aarch64-linux-gnu qemu-user-static qemu-user && \ | ||
# Build libdogecoin for Host | ||
make -j 4 -C depends HOST=aarch64-linux-gnu && \ | ||
./autogen.sh && \ | ||
./configure --prefix=/src/depends/aarch64-linux-gnu LIBS=-levent_pthreads --enable-static --disable-shared --enable-test-passwd --enable-optee CFLAGS=-U_FORTIFY_SOURCE HOST=aarch64-linux-gnu && \ | ||
./configure --prefix=/src/depends/aarch64-linux-gnu LIBS=-levent_pthreads --enable-static --disable-shared --enable-test-passwd HOST=aarch64-linux-gnu && \ | ||
make -j 4 && \ | ||
make install && \ | ||
|
@@ -377,8 +378,14 @@ docker run --privileged -v "$(pwd):/src" -w /src jforissier/optee_os_ci:qemu_che | |
LDFLAGS=\"-L/src/optee/toolchains/aarch64/lib -L/src/depends/aarch64-linux-gnu/lib -ldogecoin -lunistring\" \ | ||
CFLAGS=\"-I/src/optee/toolchains/aarch64/include -I/src/src/optee/ta/include -I/src/depends/aarch64-linux-gnu/include -I/src/depends/aarch64-linux-gnu/include/ykpers-1 -I/src/depends/aarch64-linux-gnu/include/dogecoin\" && \ | ||
# Build libdogecoin for OP-TEE | ||
cd /src/ && \ | ||
./configure --prefix=/src/depends/aarch64-linux-gnu LIBS=-levent_pthreads --enable-static --disable-shared --enable-test-passwd --enable-optee CFLAGS=-U_FORTIFY_SOURCE HOST=aarch64-linux-gnu && \ | ||
make -j 4 && \ | ||
make install && \ | ||
# Build the Enclave | ||
cd ../ta && \ | ||
cd /src/src/optee/ta && \ | ||
make -j 4 \ | ||
CROSS_COMPILE=aarch64-linux-gnu- \ | ||
LDFLAGS=\"-L/src/depends/aarch64-linux-gnu/lib -ldogecoin -lunistring\" \ | ||
|
@@ -414,7 +421,7 @@ docker run --privileged -v "$(pwd):/src" -w /src jforissier/optee_os_ci:qemu_che | |
exit" | ||
``` | ||
|
||
### Running OP-TEE Libdogecoin Key Manager Enclave (on NanoPC-T6) | ||
### Step 3 (NanoPC): Running OP-TEE Libdogecoin Key Manager Enclave | ||
|
||
Use scp to copy the /doge/libdogecoin/optee/out/bin/libdogecoin.img to the NanoPC-T6 (e.g. `scp /doge/libdogecoin/optee/out/bin/libdogecoin.img [email protected]:/root/`). Then, SSH into the NanoPC-T6 and run the following commands: | ||
|
||
|
@@ -426,7 +433,7 @@ cp /media/libdogecoin/62d95dc0-7fc2-4cb3-a7f3-c13ae4e633c4.ta /lib/optee_armtz/ | |
./optee_libdogecoin -c generate_mnemonic | ||
``` | ||
|
||
### Running OP-TEE Libdogecoin Key Manager Enclave (in QEMU ARMv8) | ||
### Step 3 (QEMU): Running OP-TEE Libdogecoin Key Manager Enclave | ||
|
||
```sh | ||
docker run --privileged -v /dev/bus/usb:/dev/bus/usb -it -v "$(pwd):/src" -w /src jforissier/optee_os_ci:qemu_check /bin/bash -c "\ | ||
|
@@ -513,11 +520,16 @@ docker run --device /dev/sgx_enclave:/dev/sgx_enclave --device /dev/sgx_provisio | |
apt-get install -y autoconf automake libtool-bin build-essential curl python3 valgrind python3-dev python3-dbg pkg-config && \ | ||
cd /src && \ | ||
make -j 4 -C depends HOST=x86_64-pc-linux-gnu && \ | ||
make -j 4 -C depends HOST=x86_64-pc-linux-gnu/host && \ | ||
./autogen.sh && \ | ||
./configure --prefix=/src/depends/x86_64-pc-linux-gnu --enable-openenclave --enable-test-passwd CFLAGS=-U_FORTIFY_SOURCE && \ | ||
make && \ | ||
make install && \ | ||
./configure --prefix=/src/depends/x86_64-pc-linux-gnu/host --enable-test-passwd && \ | ||
make && \ | ||
make install && \ | ||
# Set up the OpenEnclave environment and build the enclave | ||
apt-get install -y wget gnupg2 cmake && \ | ||
echo 'deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu focal main' | tee /etc/apt/sources.list.d/intel-sgx.list && \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters