Use container to build ARM binaries
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Tue, 13 Apr 2021 22:58:11 +0000 (15:58 -0700)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Wed, 14 Apr 2021 01:34:01 +0000 (18:34 -0700)
scripts/container-init [new file with mode: 0755]
scripts/container-make [new file with mode: 0755]
scripts/container-make-camotics [new file with mode: 0755]
scripts/container-make-kbd [new file with mode: 0755]
scripts/container-run [new file with mode: 0755]
scripts/container-update [new file with mode: 0755]
scripts/install.sh
scripts/kbd-hide [new file with mode: 0755]
scripts/kbd-show [new file with mode: 0755]
scripts/ratpoisonrc
scripts/xinitrc

diff --git a/scripts/container-init b/scripts/container-init
new file mode 100755 (executable)
index 0000000..5f05071
--- /dev/null
@@ -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 (executable)
index 0000000..dc866d4
--- /dev/null
@@ -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 (executable)
index 0000000..726404d
--- /dev/null
@@ -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 (executable)
index 0000000..eb1ffa6
--- /dev/null
@@ -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 (executable)
index 0000000..0705807
--- /dev/null
@@ -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 (executable)
index 0000000..de121ea
--- /dev/null
@@ -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)
index 9fc6cd5a885a89467b693238c40ce44ff552cf5f..a5d3a3fc9f0d7b7ffbd343c6651ba5ec8a49c3d5 100755 (executable)
@@ -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 (executable)
index 0000000..52614da
--- /dev/null
@@ -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 (executable)
index 0000000..6edfcda
--- /dev/null
@@ -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"
index 33376745b508e7f09e3cd57a11151f909dd0be89..d51e773ee7cc66c6601c6467b8754d0fa07bf69b 100755 (executable)
@@ -1 +1,2 @@
 startup_message off
+set framemsgwait -1
index fd7b841be9b1f293d77ad02cec58cb281d50af65..4ae3cc67687376e648c05cf42ed29599f2579633 100755 (executable)
@@ -1,4 +1,5 @@
 ratpoison &
+(sleep 10; bbkbd -b 0.5 0 -S kbd-show -H kbd-hide) &
 
 xset -dpms
 xset s off