Provide: * A GCC wrapper which allows a naive Makefile to compile and link an "executable" to generate a rump kernel image. This uses:
* A GCC specs file. This provides the right "system" include directories - that is, the headers for the rump kernel application environment. It also uses: * A stunt wrapper for "ld". Building a minios-based Xen image needs two runs of ld. This ld wrapper parses and categorises its arguments and runs the two appropriate link steps. * A pair of simple wrapper scripts for configure and make, which set CC and pass the --host= option. With these changes, and a suitably modified xen.git, we can run configure and build a relevant subset of the Xen management libraries and tools. Signed-off-by: Ian Jackson <[email protected]> --- .gitignore | 5 ++++ Makefile | 29 ++++++++++++++++++++- app-tools/ld | 44 ++++++++++++++++++++++++++++++++ app-tools/rumpuserxen-app-cc.in | 6 +++++ app-tools/rumpuserxen-app-configure.in | 5 ++++ app-tools/rumpuserxen-app-make.in | 5 ++++ app-tools/specs.in | 20 +++++++++++++++ 7 files changed, 113 insertions(+), 1 deletion(-) create mode 100755 app-tools/ld create mode 100755 app-tools/rumpuserxen-app-cc.in create mode 100755 app-tools/rumpuserxen-app-configure.in create mode 100755 app-tools/rumpuserxen-app-make.in create mode 100644 app-tools/specs.in diff --git a/.gitignore b/.gitignore index 27970b8..2f8907f 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,8 @@ rumpobj rumptools include/mini-os/machine include/xen + +app-tools/rumpuserxen-app-cc +app-tools/specs +app-tools/rumpuserxen-app-configure +app-tools/rumpuserxen-app-build diff --git a/Makefile b/Makefile index a0070a8..657583f 100644 --- a/Makefile +++ b/Makefile @@ -98,7 +98,7 @@ HTTPD_OBJS+= httpd/bozohttpd.o httpd/main.o httpd/ssl-bozo.o HTTPD_OBJS+= httpd/content-bozo.o httpd/dir-index-bozo.o .PHONY: default -default: objs $(TARGET) +default: objs app-tools $(TARGET) objs: mkdir -p $(OBJ_DIR)/lib $(OBJ_DIR)/xen/$(TARGET_ARCH_DIR) @@ -133,6 +133,33 @@ $(TARGET): links $(OBJS) $(HTTPD_OBJS) $(APP_O) arch_lib $(LD) $(LDFLAGS) $(LDFLAGS_FINAL) [email protected] $(EXTRA_OBJS) -o $@ #gzip -f -9 -c $@ >[email protected] + +APP_TOOLS += rumpuserxen-app-cc specs +APP_TOOLS += rumpuserxen-app-configure rumpuserxen-app-build + +.PHONY: app-tools +app-tools: $(addprefix app-tools/, $(APP_TOOLS)) + +$(eval \ +APP_TOOLS_LDLIBS := $(patsubst -L%, -L$$(abspath %), $(LDARCHLIB) $(LDLIBS))) +# We need to expand this twice because the replacement argument to +# patsubst is normally expanded only once (beforehand), but we want to +# apply abspath to each individual argument. + +APP_TOOLS_OBJS := \ + $(abspath $(filter-out %/rumpkern_demo.o, $(OBJS))) \ + $(APP_TOOLS_LDLIBS) + +app-tools/%: app-tools/%.in Makefile Config.mk + sed <$< >[email protected] \ + -e 's#!BASE!#$(abspath .)#;' \ + -e 's#!APPTOOLS!#$(abspath app-tools)#;' \ + -e 's#!OBJS!#$(APP_TOOLS_OBJS)#;' \ + -e 's#!HEAD_OBJ!#$(abspath $(HEAD_OBJ))#;' \ + -e 's#!LDSCRIPT!#$(abspath $(LDSCRIPT))#;' + if test -x $<; then chmod +x [email protected]; fi + mv -f [email protected] $@ + .PHONY: clean arch_clean arch_clean: diff --git a/app-tools/ld b/app-tools/ld new file mode 100755 index 0000000..322dd67 --- /dev/null +++ b/app-tools/ld @@ -0,0 +1,44 @@ +#!/bin/bash +set -e +outargs=() + +fail () { echo >&2 "stunt ld: $*"; exit 127; } + +noshift () { fail "no arg for $a"; } + +echo "stunt ld: $*" + +while [ $# != 0 ]; do + a=$1; shift + case "$a" in + [^-]*|-L*|-l*|--whole-archive|--no-whole-archive) + outargs+=("$a") + ;; + -m) + march="$1"; shift || noshift + outargs+=("$a" "$march") + ;; + -o) + outfile="$1"; shift || noshift + ;; + --as-needed|--no-as-needed) + ;; + --stunt-final-script) + finallds="$1"; shift || noshift + ;; + --stunt-intermediate) + inter1="$1"; shift || noshift + inter2="$1"; shift || noshift + ;; + *) + fail "unknown option $a" + ;; + esac +done + +if [ x"$outfile" = x ]; then outfile=a.out; fi + +set -x +ld -nostdlib -r "${outargs[@]}" -o "$inter1" +objcopy -w -G xenos_* -G _start "$inter1" "$inter2" +ld -m "$march" -T "$finallds" "$inter2" -o "$outfile" diff --git a/app-tools/rumpuserxen-app-cc.in b/app-tools/rumpuserxen-app-cc.in new file mode 100755 index 0000000..6a80a4a --- /dev/null +++ b/app-tools/rumpuserxen-app-cc.in @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +case " $* " in +*" -v "*) set -x ;; +esac +exec gcc -D__RUMPUSER_XEN__ -D__NetBSD__ -specs=!APPTOOLS!/specs "$@" diff --git a/app-tools/rumpuserxen-app-configure.in b/app-tools/rumpuserxen-app-configure.in new file mode 100755 index 0000000..c6f7d6e --- /dev/null +++ b/app-tools/rumpuserxen-app-configure.in @@ -0,0 +1,5 @@ +#!/bin/sh +# invoke this (for example) as .../app-configure ./configure --prefix=... +set -e +prog=$1; shift +exec "$prog" --host=i386-rumpxen-netbsd CC=!APPTOOLS!/rumpuserxen-app-cc diff --git a/app-tools/rumpuserxen-app-make.in b/app-tools/rumpuserxen-app-make.in new file mode 100755 index 0000000..75c10dd --- /dev/null +++ b/app-tools/rumpuserxen-app-make.in @@ -0,0 +1,5 @@ +#!/bin/sh +# invoke this (for example) as .../app-build make target +set -e +prog=$1; shift +exec "$prog" CC=!APPTOOLS!/rumpuserxen-app-cc "$@" diff --git a/app-tools/specs.in b/app-tools/specs.in new file mode 100644 index 0000000..99309e8 --- /dev/null +++ b/app-tools/specs.in @@ -0,0 +1,20 @@ +%rename cpp_options old_cpp_options + +*cpp_options: +-nostdinc -isystem !BASE!/rump/include %(old_cpp_options) + +*linker: +!APPTOOLS!/ld --stunt-intermediate %g.link1 %g.link2 --stunt-final-script !LDSCRIPT! + +*link: +%{m64:-m elf_x86_64} %{m64|mx32:;:-m elf_i386} %{mx32:-m elf32_x86_64} + +*endfile: +!OBJS! + +*startfile: +!HEAD_OBJ! + +%rename link_libgcc old_link_libgcc + +%rename libgcc old_libgcc -- 1.7.10.4 ------------------------------------------------------------------------------ Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft _______________________________________________ rumpkernel-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rumpkernel-users
