Merge pull request #1374 from urbit/codegen-ivory

automatically generates header for embedded ivory.pill
This commit is contained in:
Jared Tobin 2019-07-23 18:02:07 -02:30 committed by GitHub
commit d9829e8edc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 352724 deletions

View File

@ -1,6 +1,7 @@
{ {
pkgs, pkgs,
debug, debug,
ivory ? ../../../bin/ivory.pill,
argon2, ed25519, ent, ge-additions, h2o, murmur3, scrypt, secp256k1, sni, softfloat3, uv argon2, ed25519, ent, ge-additions, h2o, murmur3, scrypt, secp256k1, sni, softfloat3, uv
}: }:
@ -30,6 +31,7 @@ pkgs.stdenv.mkDerivation {
hardeningDisable = if debug then [ "all" ] else []; hardeningDisable = if debug then [ "all" ] else [];
CFLAGS = if debug then "-O3 -g -Werror" else "-O3 -Werror"; CFLAGS = if debug then "-O3 -g -Werror" else "-O3 -Werror";
IVORY = ivory;
MEMORY_DEBUG = debug; MEMORY_DEBUG = debug;
CPU_DEBUG = debug; CPU_DEBUG = debug;
EVENT_TIME_DEBUG = false; EVENT_TIME_DEBUG = false;

View File

@ -1,6 +1,12 @@
{ env_name, env, deps }: { env_name, env, deps }:
{ ent, ge-additions, cacert, xxd, name ? "urbit", debug ? false }: {
ent,
name ? "urbit",
debug ? false,
ivory ? ../../../bin/ivory.pill,
ge-additions, cacert, xxd
}:
let let
@ -22,6 +28,7 @@ env.make_derivation {
EVENT_TIME_DEBUG = false; EVENT_TIME_DEBUG = false;
NCURSES = env.ncurses; NCURSES = env.ncurses;
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
IVORY = ivory;
name = "${name}-${env_name}"; name = "${name}-${env_name}";
exename = name; exename = name;

View File

@ -4,6 +4,7 @@
/config.mk /config.mk
include/config.h include/config.h
include/ca-bundle.h include/ca-bundle.h
include/ivory.h
# #
# Build Outputs # Build Outputs
# #

View File

@ -7,7 +7,7 @@ daemon = $(wildcard daemon/*.c)
worker = $(wildcard worker/*.c) worker = $(wildcard worker/*.c)
common = $(jets) $(noun) $(vere) common = $(jets) $(noun) $(vere)
headers = $(shell find include -type f) include/ca-bundle.h headers = $(shell find include -type f) include/ca-bundle.h include/ivory.h
common_objs = $(shell echo $(common) | sed 's/\.c/.o/g') common_objs = $(shell echo $(common) | sed 's/\.c/.o/g')
daemon_objs = $(shell echo $(daemon) | sed 's/\.c/.o/g') daemon_objs = $(shell echo $(daemon) | sed 's/\.c/.o/g')
@ -27,6 +27,10 @@ ifeq ($(SSL_CERT_FILE),)
$(error SSL_CERT_FILE is undefined) $(error SSL_CERT_FILE is undefined)
endif endif
ifeq ($(IVORY),)
$(error IVORY is undefined)
endif
################################################################################ ################################################################################
.PHONY: all test clean mkproper .PHONY: all test clean mkproper
@ -44,7 +48,7 @@ clean:
rm -f ./tags $(all_objs) $(all_exes) rm -f ./tags $(all_objs) $(all_exes)
mrproper: clean mrproper: clean
rm -f config.mk include/config.h include/ca-bundle.h rm -f config.mk include/config.h include/ca-bundle.h include/ivory.h
################################################################################ ################################################################################
@ -54,6 +58,12 @@ include/ca-bundle.h:
@xxd -i include/ca-bundle.crt > include/ca-bundle.h @xxd -i include/ca-bundle.crt > include/ca-bundle.h
@rm include/ca-bundle.crt @rm include/ca-bundle.crt
include/ivory.h:
@echo XXD -i $(IVORY)
@cat $(IVORY) > u3_Ivory.pill
@xxd -i u3_Ivory.pill > include/ivory.h
@rm u3_Ivory.pill
build/hashtable_tests: $(common_objs) tests/hashtable_tests.o build/hashtable_tests: $(common_objs) tests/hashtable_tests.o
@echo CC -o $@ @echo CC -o $@
@mkdir -p ./build @mkdir -p ./build

View File

@ -8,6 +8,8 @@
#include "all.h" #include "all.h"
#include "vere/vere.h" #include "vere/vere.h"
#include "ivory.h"
// stash config flags for worker // stash config flags for worker
// //
static c3_w sag_w; static c3_w sag_w;
@ -873,10 +875,7 @@ u3_daemon_commence()
lit = u3m_file(u3_Host.ops_u.lit_c); lit = u3m_file(u3_Host.ops_u.lit_c);
} }
else { else {
extern c3_w u3_Ivory_length_w; lit = u3i_bytes(u3_Ivory_pill_len, u3_Ivory_pill);
extern c3_y u3_Ivory_pill_y[];
lit = u3i_bytes(u3_Ivory_length_w, u3_Ivory_pill_y);
} }
if ( c3n == u3v_boot_lite(lit)) { if ( c3n == u3v_boot_lite(lit)) {

File diff suppressed because it is too large Load Diff