From 04264905f16b5b73e18ea8ec6590365c6ebed6b6 Mon Sep 17 00:00:00 2001 From: Joseph Coffland Date: Tue, 13 Apr 2021 15:58:11 -0700 Subject: [PATCH] Use container to build ARM binaries --- scripts/container-init | 23 +++++++++++++++++ scripts/container-make | 16 ++++++++++++ scripts/container-make-camotics | 6 +++++ scripts/container-make-kbd | 6 +++++ scripts/container-run | 3 +++ scripts/container-update | 45 +++++++++++++++++++++++++++++++++ scripts/install.sh | 8 ++++++ scripts/kbd-hide | 4 +++ scripts/kbd-show | 6 +++++ scripts/ratpoisonrc | 1 + scripts/xinitrc | 1 + 11 files changed, 119 insertions(+) create mode 100755 scripts/container-init create mode 100755 scripts/container-make create mode 100755 scripts/container-make-camotics create mode 100755 scripts/container-make-kbd create mode 100755 scripts/container-run create mode 100755 scripts/container-update create mode 100755 scripts/kbd-hide create mode 100755 scripts/kbd-show diff --git a/scripts/container-init b/scripts/container-init new file mode 100755 index 0000000..5f05071 --- /dev/null +++ b/scripts/container-init @@ -0,0 +1,23 @@ +#!/bin/bash -e + +export LC_ALL=C + +# Update the system +apt-get update +#apt-get dist-upgrade -y + +# Install packages +apt-get install -y scons build-essential libssl-dev python3-dev libx11-dev \ + libxcursor-dev libxinerama-dev libxtst-dev libxft-dev pkg-config ninja-build \ + vim bash-completion + +# libv8 +if [ ! -e /opt/embedded-v8 ]; then + cd /opt + git clone https://github.com/CauldronDevelopmentLLC/embedded-v8 + cd embedded-v8 + python gn/build/gen.py + ninja -C gn/out + ./gn/out/gn gen --args='is_debug=false use_custom_libcxx=false is_clang=false v8_enable_i18n_support=false v8_monolithic=true v8_use_external_startup_data=false disable_libfuzzer=true use_aura=false use_dbus=false use_ozone=false use_sysroot=false use_udev=false use_x11=false use_gio=false use_glib=false v8_has_valgrind=true' out + ninja -C out v8_monolith +fi diff --git a/scripts/container-make b/scripts/container-make new file mode 100755 index 0000000..dc866d4 --- /dev/null +++ b/scripts/container-make @@ -0,0 +1,16 @@ +#!/bin/bash -ex + +cd /mnt/host + +# C! +export V8_INCLUDE=/opt/embedded-v8/include/ +export V8_LIBPATH=/opt/embedded-v8/out/obj/ +export V8_LIBNAME=v8_monolith +scons -C cbang disable_local="re2 libevent" + +# CAMotics +export CBANG_HOME="/mnt/host/cbang" +scons -C camotics build/camotics.so with_gui=0 + +## bbkbd +make -C bbctrl-firmware/src/kbd diff --git a/scripts/container-make-camotics b/scripts/container-make-camotics new file mode 100755 index 0000000..726404d --- /dev/null +++ b/scripts/container-make-camotics @@ -0,0 +1,6 @@ +#!/bin/bash -ex + +cd /mnt/host + +## bbkbd +make -C bbctrl-firmware/src/kbd diff --git a/scripts/container-make-kbd b/scripts/container-make-kbd new file mode 100755 index 0000000..eb1ffa6 --- /dev/null +++ b/scripts/container-make-kbd @@ -0,0 +1,6 @@ +#!/bin/bash -ex + +cd /mnt/host + +# bbkbd +make -C bbctrl-firmware/src/kbd diff --git a/scripts/container-run b/scripts/container-run new file mode 100755 index 0000000..0705807 --- /dev/null +++ b/scripts/container-run @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo lxc-attach -n bbctrl -- /bin/sh -c "cd /mnt/host; $@" diff --git a/scripts/container-update b/scripts/container-update new file mode 100755 index 0000000..de121ea --- /dev/null +++ b/scripts/container-update @@ -0,0 +1,45 @@ +#!/bin/bash -ex + +SHARE=share + + +function update_repo() { + if [ ! -e $SHARE/$1 ]; then + if [[ "$2" == http* ]]; then + git clone "$2" $SHARE/$1 -b $3 + else + mkdir -p $SHARE/$1 + git -C $SHARE/$1 init + fi + fi + + if [[ "$2" == http* ]]; then + git -C $SHARE/$1 fetch + else + git -C $SHARE/$1 fetch -t "$2" $3 + fi + + git -C $SHARE/$1 reset --hard FETCH_HEAD +} + + +mkdir -p $SHARE || true + + +# C! +if [ "$CBANG_HOME" != "" ]; then + update_repo cbang "$CBANG_HOME" master +else + update_repo cbang https://github.com/CauldronDevelopmentLLC/cbang master +fi + +# CAMotics +if [ "$CAMOTICS_HOME" != "" ]; then + update_repo camotics "$CAMOTICS_HOME" master +else + update_repo camotics https://github.com/CauldronDevelopmentLLC/camotics master +fi + + +# bbctrl-firmware +update_repo bbctrl-firmware $PWD $(git branch --show-current) diff --git a/scripts/install.sh b/scripts/install.sh index 9fc6cd5..a5d3a3f 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -90,6 +90,10 @@ cp scripts/xinitrc ~pi/.xinitrc chmod +x ~pi/.xinitrc chown pi:pi ~pi/.xinitrc +# Install ratpoisionrc +cp scripts/ratpoisonrc ~pi/.ratpoisonrc +chown pi:pi ~pi/.ratpoisonrc + # Install bbserial MODSRC=src/bbserial/bbserial.ko MODDST=/lib/modules/$(uname -r)/kernel/drivers/tty/serial/bbserial.ko @@ -106,6 +110,10 @@ cp src/splash/* /usr/share/plymouth/themes/buildbotics/ # Install rc.local cp scripts/rc.local /etc/ +# Install bbkbd +if [ ! -e /usr/local/bin/bbkbd ]; then REBOOT=true; fi +cp src/kbd/bbkbd-arm /usr/local/bin/bbkbd + # Install bbctrl if $UPDATE_PY; then rm -rf /usr/local/lib/python*/dist-packages/bbctrl-* diff --git a/scripts/kbd-hide b/scripts/kbd-hide new file mode 100755 index 0000000..52614da --- /dev/null +++ b/scripts/kbd-hide @@ -0,0 +1,4 @@ +#!/bin/bash + +ratpoison -c "fselect 0" +ratpoison -c "only" diff --git a/scripts/kbd-show b/scripts/kbd-show new file mode 100755 index 0000000..6edfcda --- /dev/null +++ b/scripts/kbd-show @@ -0,0 +1,6 @@ +#!/bin/bash + +FRAME=$(ratpoison -c curframe) +if [ $FRAME -eq 0 ]; then FRAME=1; else FRAME=0;fi +ratpoison -c "split 2/3" +ratpoison -c "fselect $FRAME" diff --git a/scripts/ratpoisonrc b/scripts/ratpoisonrc index 3337674..d51e773 100755 --- a/scripts/ratpoisonrc +++ b/scripts/ratpoisonrc @@ -1 +1,2 @@ startup_message off +set framemsgwait -1 diff --git a/scripts/xinitrc b/scripts/xinitrc index fd7b841..4ae3cc6 100755 --- a/scripts/xinitrc +++ b/scripts/xinitrc @@ -1,4 +1,5 @@ ratpoison & +(sleep 10; bbkbd -b 0.5 0 -S kbd-show -H kbd-hide) & xset -dpms xset s off -- 2.27.0