-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tom Boettger <[email protected]>
- Loading branch information
Showing
4 changed files
with
56 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/consul-* | ||
/v1.*.zip |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
202c202,203 | ||
< CGO_ENABLED=0 GOOS=linux GOARCH=$(GOARCH) go build -o ./pkg/bin/linux_$(GOARCH) -ldflags "$(GOLDFLAGS)" -tags "$(GOTAGS)" | ||
--- | ||
> GOLDFLAGS="$(GOLDFLAGS) -linkmode external -extldflags '-static-pie'" | ||
> CGO_ENABLED=0 GOOS=linux GOARCH=$(GOARCH) go build -o ./pkg/bin -buildmode=pie -ldflags "$(GOLDFLAGS)" -tags "$(GOTAGS)" |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Build consul server as static PIE | ||
|
||
Build the consul server as a static PIE ELF running on Linux. | ||
|
||
## Requirements | ||
|
||
Make sure the following packages are installed: | ||
* go >= 1.17 | ||
* unzip | ||
* patch | ||
|
||
## Build | ||
|
||
The `consul` static PIE ELF is located in the current folder. | ||
If you want to rebuild it, run: | ||
|
||
``` | ||
$ ./build.sh | ||
``` | ||
|
||
## Run | ||
|
||
You can run the executable natively on Linux: | ||
|
||
``` | ||
$ ./consul-1.13.3/pkg/bin/consul version | ||
``` | ||
|
||
Or with [run-elfloader](https://github.com/unikraft/run-app-elfloader) on Unikraft: | ||
``` | ||
$ ./run_elfloader ../static-pie-apps/consul/consul-1.13.3/pkg/bin/consul [args] | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
|
||
# Clean up | ||
rm -rf consul-* | ||
rm -f v1.* | ||
|
||
echo "Downloading consul source code... " | ||
wget -q https://github.com/hashicorp/consul/archive/refs/tags/v1.13.3.zip | ||
|
||
echo "Unpacking consul source code..." | ||
unzip v1.13.3.zip | ||
|
||
echo "Building consul... " | ||
cd consul-1.13.3 || exit | ||
patch GNUmakefile ../GNUmakefile.patch | ||
make linux | ||
echo "" |