noux: install tar archive as build result

This patch changes the noux build rules to produce a tar archive in
'bin/', alleviating the need for this step from the run scripts.
This way, the visible result of a built noux package is a single (tar)
file in '<build-dir>bin/', which is suited for the use as a ROM module.
This commit is contained in:
Norman Feske 2017-05-14 22:00:40 +02:00 committed by Christian Helmuth
parent ae3664f4a0
commit c4002e6e23
19 changed files with 79 additions and 166 deletions

View File

@ -37,7 +37,7 @@ append_platform_drv_build_components
build $build_components
# write default vimrc file
set vimrc_fd [open "bin/vim/share/vim/vimrc" w]
set vimrc_fd [open "bin/vimrc" w]
puts $vimrc_fd {
set noloadplugins
set hls
@ -47,14 +47,6 @@ set noswapfile
set viminfo=}
close $vimrc_fd
# strip all binaries prior archiving
exec sh -c "find bin/bash/ bin/vim/ bin/coreutils/ -type f | (xargs [cross_dev_prefix]strip || true) 2>/dev/null"
exec tar cfv bin/bash.tar -h -C bin/bash .
exec tar cfv bin/coreutils.tar -h -C bin/coreutils .
exec tar cfv bin/vim.tar -h -C bin/vim .
exec tar cfv bin/diffutils.tar -h -C bin/diffutils .
create_boot_directory
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
@ -200,6 +192,7 @@ append config {
<dir name="home"> <fs label="home" /> </dir>
<dir name="samples"> <fs label="samples" /> </dir>
<dir name="tmp"> <fs label="tmp" /> </dir>
<dir name="share"> <dir name="vim"> <rom name="vimrc"/> </dir> </dir>
</fstab>
<start name="/bin/bash">
<env name="TERM" value="linux" />
@ -234,7 +227,7 @@ proc binary_name_cpu_sampler_platform_lib_so { } {
set boot_modules {
core ld.lib.so init timer noux terminal ram_fs log_terminal
libc.lib.so libm.lib.so libc_noux.lib.so ncurses.lib.so posix.lib.so
bash.tar coreutils.tar diffutils.tar vim.tar
bash.tar coreutils.tar diffutils.tar vim.tar vimrc
fs_log cpu_sampler cpu_sampler_platform.lib.so test-cpu_sampler
}
@ -269,7 +262,3 @@ regexp $match_string $output all func
run_genode_until "\\\[init -> terminal] \[0\]*$func" 90 [output_spawn_id]
exec rm bin/bash.tar
exec rm bin/coreutils.tar
exec rm bin/diffutils.tar
exec rm bin/vim.tar

View File

@ -17,8 +17,6 @@ set build_components {
build $build_components
exec tar cfv bin/vim.tar -h -C bin/vim .
create_boot_directory
append config {
@ -161,5 +159,3 @@ append qemu_args " -serial file:kdb.log "
append qemu_args " -serial mon:stdio"
run_genode_until forever
exec rm bin/vim.tar

View File

@ -30,6 +30,15 @@
TARGET ?= $(lastword $(subst /, ,$(PRG_DIR)))
PKG ?= $(TARGET)
#
# Select how to make the build result available at Genode's 'INSTALL_DIR'.
# By default, a single tar archive containing the results of the package's
# 'make install' rule is created. By setting the 'INSTALL_TREE' variable
# to a non-empty value, a symlink to the actual file tree is created.
#
INSTALL_TREE ?=
INSTALL_TAR_ARCHIVE ?= yes
LIBS += posix
PWD = $(shell pwd)
@ -158,16 +167,45 @@ built.tag: env.sh Makefile
INSTALL_TARGET ?= install-strip
#
# Install result of the build in an 'install/' directory local to the target's
# build directory
#
installed.tag: built.tag
@$(MSG_INST)$(TARGET)
$(VERBOSE)source env.sh && $(MAKE) $(MAKE_ENV) $(MAKE_VERBOSE) $(INSTALL_TARGET) DESTDIR=$(PWD)/install MAN= >> stdout.log 2>> stderr.log
$(VERBOSE)rm -f $(INSTALL_DIR)/$(TARGET)
$(VERBOSE)ln -sf $(PWD)/install $(INSTALL_DIR)/$(TARGET)
@touch $@
$(TARGET): installed.tag
@touch $@
#
# Trigger creation of symlinks to the build results at '<build-dir>/bin/'
#
ifneq ($(INSTALL_TAR_ARCHIVE),)
$(TARGET): installed_tar.tag
endif
ifneq ($(INSTALL_TREE),)
$(TARGET): installed_tree.tag
endif
#
# Install symlink to the install directory
#
installed_tree.tag: installed.tag
$(VERBOSE)rm -f $(INSTALL_DIR)/$(TARGET)
$(VERBOSE)ln -sf $(PWD)/install $(INSTALL_DIR)/$(TARGET)
#
# Install symlink to the archived install directory, ready to by mounted
# via the VFS tar file system
#
installed_tar.tag: installed.tag
$(VERBOSE)tar cf $(TARGET).tar -h -C $(PWD)/install .
$(VERBOSE)rm -f $(INSTALL_DIR)/$(TARGET)
$(VERBOSE)ln -sf $(PWD)/$(TARGET).tar $(INSTALL_DIR)/$(TARGET).tar
#
# The clean rule is expected to be executed within the 3rd-party build
# directory. The check should prevent serious damage if this condition
@ -175,7 +213,7 @@ $(TARGET): installed.tag
#
ifeq ($(notdir $(PWD)),$(notdir $(PRG_DIR)))
clean_dir:
$(VERBOSE)rm -rf $(PWD)/* $(PWD)/.*
$(VERBOSE)find $(PWD) -mindepth 1 -delete
clean_prg_objects: clean_dir
endif

View File

@ -5,4 +5,3 @@ LIBS += libc_noux
PKG_DIR ?= $(call select_from_ports,$(PKG))/src/noux-pkg/$(PKG)
include $(GNU_BUILD_MK)

View File

@ -1,10 +1,6 @@
build { core init drivers/timer noux/minimal server/log_terminal
lib/libc_noux noux-pkg/coreutils }
# strip coreutils binaries and create tar archive
exec sh -c "[cross_dev_prefix]strip bin/coreutils/bin/*"
exec tar cfv bin/coreutils.tar -h -C bin/coreutils .
create_boot_directory
install_config {
@ -56,5 +52,3 @@ if {[have_spec x86_64]} {
}
run_genode_until {child "noux" exited with exit value 0.*\n} 30
exec rm bin/coreutils.tar

View File

@ -1,9 +1,3 @@
#
# Uncomment the following line when working on the VIM source code. Otherwise,
# the package may get recompiled, yet it does not get reinstalled into 'bin/'.
#
#exec rm -rf noux-pkg/bash bin/bash
set build_components {
core init drivers/timer noux/minimal lib/libc_noux
drivers/framebuffer drivers/input
@ -31,8 +25,10 @@ append_platform_drv_build_components
build $build_components
create_boot_directory
# write default vimrc file
set vimrc_fd [open "bin/vim/share/vim/vimrc" w]
set vimrc_fd [open bin/vimrc w]
puts $vimrc_fd {
set noloadplugins
set hls
@ -42,17 +38,6 @@ set noswapfile
set viminfo=}
close $vimrc_fd
# strip all binaries prior archiving
exec sh -c "find bin/bash/ bin/vim/ bin/coreutils/ -type f | (xargs [cross_dev_prefix]strip || true) 2>/dev/null"
exec tar cfv bin/bash.tar -h -C bin/bash .
exec tar cfv bin/coreutils.tar -h -C bin/coreutils .
exec tar cfv bin/vim.tar -h -C bin/vim .
exec tar cfv bin/diffutils.tar -h -C bin/diffutils .
exec tar cfv bin/less.tar -h -C bin/less .
create_boot_directory
append config {
<config verbose="yes">
<parent-provides>
@ -88,6 +73,7 @@ append_if [have_spec sdl] config {
<service name="Input"/>
<service name="Framebuffer"/>
</provides>
<config width="640" height="480"/>
</start>}
append_platform_drv_config
@ -96,6 +82,7 @@ append_if [have_spec framebuffer] config {
<start name="fb_drv">
<resource name="RAM" quantum="4M"/>
<provides><service name="Framebuffer"/></provides>
<config width="640" height="480"/>
</start>}
append_if [have_spec ps2] config {
@ -170,6 +157,7 @@ Hello world !!
as a key to select the policy of 'ram_fs' -->
<dir name="home"> <fs label="home" /> </dir>
<dir name="share"> <dir name="vim"> <rom name="vimrc"/> </dir> </dir>
<!-- The entirety of ram_fs is mounted within the '/ram'
directory. -->
@ -204,7 +192,7 @@ install_config $config
set boot_modules {
core init timer ld.lib.so noux terminal ram_fs
libc.lib.so libm.lib.so libc_noux.lib.so ncurses.lib.so posix.lib.so
bash.tar coreutils.tar diffutils.tar less.tar vim.tar
bash.tar coreutils.tar diffutils.tar less.tar vim.tar vimrc
}
# platform-specific modules
@ -225,9 +213,3 @@ if {[have_spec x86_64]} {
}
run_genode_until forever
exec rm bin/bash.tar
exec rm bin/coreutils.tar
exec rm bin/diffutils.tar
exec rm bin/less.tar
exec rm bin/vim.tar

View File

@ -15,15 +15,6 @@ proc noux_gdb_pkg_name { } {
}
#
# Create a tar archive for GDB (stripped)
#
proc create_gdb_tar { } {
exec sh -c "find bin/[noux_gdb_pkg_name]/ -type f | (xargs [cross_dev_prefix]strip || true) 2>/dev/null"
exec tar cfhv bin/gdb.tar -C bin/[noux_gdb_pkg_name] .
}
#
# Create a tar archive for a Noux application and its shared libraries (unstripped)
#

View File

@ -66,7 +66,6 @@ set gdb_target_binaries {
}
lappend gdb_target_binaries ${gdb_target_binary_name}
create_gdb_tar
create_binary_and_source_tars ${gdb_target_binary_name} ${gdb_target_binaries}
create_boot_directory
@ -250,4 +249,3 @@ append qemu_args " -m 256 "
run_genode_until forever
exec rm bin/gdb.tar

View File

@ -29,7 +29,7 @@ append_platform_drv_build_components
build $build_components
set vimrc_fd [open "bin/vim/share/vim/vimrc" w]
set vimrc_fd [open "bin/vimrc" w]
puts $vimrc_fd {
set noloadplugins
set hls
@ -39,17 +39,6 @@ set noswapfile
set viminfo=}
close $vimrc_fd
# strip all binaries prior archiving
set find_args ""
foreach pkg $noux_pkgs { append find_args " bin/$pkg/" }
exec sh -c "find $find_args -type f | (xargs [cross_dev_prefix]strip || true) 2>/dev/null"
# add bash as sh
exec cp bin/bash/bin/bash bin/bash/bin/sh
foreach pkg $noux_pkgs {
exec tar cf bin/$pkg.tar -h -C bin/$pkg . }
# generate configuration for lighttpd
proc lighttpd_config_path { } {
return "[genode_dir]/repos/ports/contrib/lighttpd-1.4.31/doc/config" }
@ -169,10 +158,12 @@ foreach pkg $noux_pkgs {
append config {
<dir name="bin">
<tar name="lighttpd.tar" />
<symlink name="sh" target="bash"/>
</dir>
<dir name="home">
<fs label="home" />
</dir>
<dir name="share"> <dir name="vim"> <rom name="vimrc"/> </dir> </dir>
<dir name="ram"> <fs label="root" /> </dir>
<dir name="tmp"> <fs label="tmp" /> </dir>
<dir name="srv">
@ -207,7 +198,7 @@ set boot_modules {
libc.lib.so libm.lib.so libc_noux.lib.so posix.lib.so
lwip.lib.so ncurses.lib.so
readline.lib.so zlib.lib.so libcrypto.lib.so libssl.lib.so
lighttpd.tar
lighttpd.tar vimrc
}
foreach pkg $noux_pkgs {
@ -222,10 +213,8 @@ append_platform_drv_boot_modules
build_boot_image $boot_modules
if {[have_spec x86_64]} {
# bash.tar is really huge when built for x86_64
append qemu_args " -m 320 "
}
# bash.tar is really huge when built for x86_64
if {[have_spec x86_64]} { append qemu_args " -m 320 " }
append_if [have_spec x86] qemu_args " -net nic,model=e1000 "
append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 "
@ -234,5 +223,4 @@ append qemu_args " -net user -redir tcp:5555::80 "
run_genode_until forever
#exec rm bin/bash.tar
exec rm -rf bin/aux

View File

@ -27,8 +27,6 @@ append_platform_drv_build_components
build $build_components
exec tar cfv bin/noux_netcat.tar -h -C bin/netcat .
#
# The '<build-dir>/bin/etc/' directory is expected to contain the
# files 'services', 'protocols', 'hosts', and 'resolv.conf'.
@ -41,7 +39,7 @@ foreach etc_file { services protocols hosts } {
catch { exec wget -c -P bin/etc $freebsd_url/$etc_file } } }
exec touch bin/etc/resolv.conf
exec tar rfv bin/noux_netcat.tar -h -C bin/ etc
exec tar rfv bin/netcat.tar -h -C bin/ etc
create_boot_directory
@ -138,7 +136,7 @@ append config {
<start name="noux_net" caps="500">
<resource name="RAM" quantum="1G"/>
<config>
<fstab> <tar name="noux_netcat.tar" at="/"/> </fstab>
<fstab> <tar name="netcat.tar" at="/"/> </fstab>
<start name="/bin/netcat">
<arg value="-l"/>
<arg value="-p 5555"/>
@ -166,7 +164,7 @@ install_config $config
set boot_modules {
core init timer tcp_terminal nic_bridge
ld.lib.so noux_net libc.lib.so libm.lib.so libc_pipe.lib.so pthread.lib.so
libc_resolv.lib.so libc_noux.lib.so lwip.lib.so noux_netcat.tar posix.lib.so
libc_resolv.lib.so libc_noux.lib.so lwip.lib.so netcat.tar posix.lib.so
}
# platform-specific modules
@ -233,7 +231,6 @@ set output [exec cat $noux_output_file]
puts "\noutput:\n$output\n"
exec rm $noux_output_file
exec rm bin/noux_netcat.tar
exec rm -r bin/etc
if {![regexp {Hello Genode} $output dummy]} {

View File

@ -21,17 +21,6 @@ append_platform_drv_build_components
build $build_components
# strip all binaries prior archiving
set find_args ""
foreach pkg $noux_pkgs { append find_args " bin/$pkg/" }
exec sh -c "find $find_args -type f | (xargs [cross_dev_prefix]strip || true) 2>/dev/null"
# create '/bin/sh' symlink
exec sh -c "ln -sf bash bin/bash/bin/sh"
foreach pkg $noux_pkgs {
exec tar cfv bin/$pkg.tar -h -C bin/$pkg . }
create_boot_directory
append config {
@ -134,6 +123,7 @@ foreach pkg $noux_pkgs {
append config " <tar name=\"$pkg.tar\" />" }
append config {
<dir name="bin"> <symlink name="sh" target="bash"/> </dir>
<dir name="home"> <fs label="home" /> </dir>
<dir name="ram"> <fs label="root" /> </dir>
@ -160,8 +150,7 @@ set boot_modules {
core init timer ld.lib.so noux terminal ram_fs posix.lib.so
libc.lib.so libm.lib.so libc_noux.lib.so ncurses.lib.so }
foreach pkg $noux_pkgs {
lappend boot_modules "$pkg.tar" }
foreach pkg $noux_pkgs { lappend boot_modules "$pkg.tar" }
# platform-specific modules
lappend_if [have_spec linux] boot_modules fb_sdl
@ -176,5 +165,3 @@ build_boot_image $boot_modules
append qemu_args " -m 300 "
run_genode_until forever
exec rm bin/bash.tar

View File

@ -31,12 +31,6 @@ append_platform_drv_build_components
build $build_components
# strip all binaries prior archiving
exec sh -c "find bin/bash/ bin/coreutils/ -type f | (xargs strip || true) 2>/dev/null"
exec tar cfv bin/bash.tar -h -C bin/bash .
exec tar cfv bin/coreutils.tar -h -C bin/coreutils .
create_boot_directory
append config {
@ -208,11 +202,7 @@ append_platform_drv_boot_modules
build_boot_image $boot_modules
if {[have_spec x86_64]} {
# bash.tar is really huge when built for x86_64
append qemu_args " -m 300 "
}
# bash.tar is really huge when built for x86_64
if {[have_spec x86_64]} { append qemu_args " -m 300 " }
run_genode_until forever
exec rm bin/bash.tar

View File

@ -67,7 +67,7 @@ foreach pkg $noux_pkgs {
build $build_components
# write default vimrc file
set vimrc_fd [open "bin/vim/share/vim/vimrc" w]
set vimrc_fd [open "bin/vimrc" w]
puts $vimrc_fd {
set noloadplugins
set hls
@ -77,16 +77,6 @@ set noswapfile
set viminfo=}
close $vimrc_fd
# strip all binaries prior archiving
set find_args ""
foreach pkg $noux_pkgs { append find_args " bin/$pkg" }
exec sh -c "find $find_args -type f | (xargs [cross_dev_prefix]strip -g || true) 2>/dev/null"
exec ln -sf bash bin/bash/bin/sh
foreach pkg $noux_pkgs {
exec tar cfv bin/$pkg.tar -h -C bin/$pkg . }
exec tar cvf bin/genode.tar -C $genode_dir tool repos/base repos/$platform_base_dir repos/os repos/demo
create_boot_directory
@ -217,6 +207,10 @@ append config { </dir>
<tar name="genode.tar" />
</dir>
<dir name="bin"> <symlink name="sh" target="bash"/> </dir>
<dir name="share"> <dir name="vim"> <rom name="vimrc"/> </dir> </dir>
<dir name="dev">
<null />
</dir>

View File

@ -69,7 +69,6 @@ run_genode_until {child /bin/bash exited with exit value 234} $tool_chain_timeou
set time_end [ clock seconds ]
# cleanup created tars
foreach pkg $noux_pkgs { exec rm -f bin/$pkg.tar }
exec rm -f bin/genode.tar
# print infos about run

View File

@ -46,8 +46,10 @@ append_platform_drv_build_components
build $build_components
create_boot_directory
# write default vimrc file
set vimrc_fd [open "bin/vim/share/vim/vimrc" w]
set vimrc_fd [open "bin/vimrc" w]
puts $vimrc_fd {
set noloadplugins
set hls
@ -57,13 +59,6 @@ set noswapfile
set viminfo=}
close $vimrc_fd
# strip all binaries prior archiving
foreach pkg $noux_pkgs {
exec sh -c "find bin/$pkg -type f | (xargs [cross_dev_prefix]strip || true) 2>/dev/null"
exec tar cfv bin/$pkg.tar -h -C bin/$pkg . }
create_boot_directory
append config {
<config verbose="yes">
<parent-provides>
@ -177,6 +172,8 @@ append config {
<dir name="dev">
<null /> <zero />
</dir>
<dir name="share"> <dir name="vim"> <rom name="vimrc"/> </dir> </dir>
</fstab>
<start name="/bin/bash">
<env name="TERM" value="linux" />

View File

@ -31,12 +31,6 @@ append_platform_drv_build_components
build $build_components
# strip all binaries prior archiving
exec sh -c "find bin/bash/ bin/coreutils/ -type f | (xargs strip || true) 2>/dev/null"
exec tar cfv bin/bash.tar -h -C bin/bash .
exec tar cfv bin/coreutils.tar -h -C bin/coreutils .
create_boot_directory
append config {
@ -230,7 +224,7 @@ install_config $config
set boot_modules {
core init timer ld.lib.so noux terminal ram_fs nitpicker nit_fb pointer
libc.lib.so libm.lib.so libc_noux.lib.so posix.lib.so
bash.tar coreutils.tar
bash.tar coreutils.tar vimrc
}
# platform-specific modules
@ -242,11 +236,7 @@ append_platform_drv_boot_modules
build_boot_image $boot_modules
if {[have_spec x86_64]} {
# bash.tar is really huge when built for x86_64
append qemu_args " -m 300 "
}
# bash.tar is really huge when built for x86_64
if {[have_spec x86_64]} { append qemu_args " -m 300 " }
run_genode_until forever
exec rm bin/bash.tar

View File

@ -1,10 +1,6 @@
build { core init drivers/timer noux/minimal
lib/libc_noux noux-pkg/coreutils }
# strip coreutils binaries and create tar archive
exec sh -c "[cross_dev_prefix]strip bin/coreutils/bin/*"
exec tar cfv bin/coreutils.tar -h -C bin/coreutils .
create_boot_directory
install_config {
@ -64,11 +60,7 @@ build_boot_image {
append qemu_args " -nographic -serial mon:stdio "
if {[have_spec x86_64]} {
# coreutils.tar is really huge when built for x86_64
append qemu_args " -m 300 "
}
# coreutils.tar is really huge when built for x86_64
if {[have_spec x86_64]} { append qemu_args " -m 300 " }
run_genode_until {child "noux" exited with exit value 0.*\n} 30
exec rm bin/coreutils.tar

View File

@ -17,8 +17,6 @@ append_platform_drv_build_components
build $build_components
exec tar cfv bin/vim.tar -h -C bin/vim .
create_boot_directory
append config {
@ -131,5 +129,3 @@ append_platform_drv_boot_modules
build_boot_image $boot_modules
run_genode_until forever
exec rm bin/vim.tar

View File

@ -266,8 +266,6 @@ append config_of_app {
source ${genode_dir}/repos/ports/run/virtualbox_auto.inc
exec tar cfv bin/bash.tar -h -C bin/bash .
exec tar cfv bin/coreutils.tar -h -C bin/coreutils .
exec cp ${genode_dir}/repos/ports/run/$vbox_file bin/.
build_boot_image $boot_modules
@ -331,9 +329,7 @@ puts $noux_id "sha1sum to/test.bin"
# Wait for output of bash shell until last SHA1 sum is calculated
run_genode_until {[[:xdigit:]]+ to/test\.bin} 50 $spawn_id_list
# cleanup created files
foreach pkg {bash coreutils} { exec rm -f bin/$pkg.tar }
exec rm -f bin/test.bin
exec rm -f bin/template.bat
exec rm -f bin/$vbox_file