Various updates, start including rpiConfigServer

* Provide shell script to copy in external dependencies
* Install Python 3 and build-essential
* Install OpenCV libraries including Python 3 bindings
* Install rpiConfigServer as service
* Improve service scripts with exec, netconsoleServer
* Don't include JDK debug info (shrinks zip size a lot)
* Include libraries, headers, and jars for wpiutil, cscore, ntcore
This commit is contained in:
Peter Johnson 2018-11-30 02:40:39 -08:00
parent d687acb744
commit dd04f57093
No known key found for this signature in database
GPG Key ID: D39DD4DA7D41E329
10 changed files with 105 additions and 17 deletions

50
copyextfiles.sh Executable file
View File

@ -0,0 +1,50 @@
#!/bin/sh
mkdir -p stage2/01-sys-tweaks/extfiles
#
# openjdk
#
cp ../raspbian-openjdk/jdk_11.0.1-strip.tar.gz stage2/01-sys-tweaks/extfiles/
#
# thirdparty-opencv
#
sh -c 'cd ../thirdparty-opencv/buildShared/linux-raspbian/lib && tar czf - libopencv*' > stage2/01-sys-tweaks/extfiles/libopencv.tar.gz
# the opencv build names the python .so with the build platform name instead
# of the target platform, so rename it
cp ../thirdparty-opencv/buildShared/linux-raspbian/lib/python3/cv2.*.so stage2/01-sys-tweaks/extfiles/cv2.cpython-35m-arm-linux-gnueabihf.so
#
# allwpilib
#
cp \
../allwpilib/wpiutil/build/libs/wpiutil/shared/raspbian/release/libwpiutil.so* \
../allwpilib/wpiutil/build/libs/wpiutil/shared/raspbian/debug/libwpiutild.so* \
../allwpilib/wpiutil/build/libs/wpiutil.jar \
../allwpilib/cscore/build/libs/cscore/shared/raspbian/release/libcscore.so* \
../allwpilib/cscore/build/libs/cscore/shared/raspbian/debug/libcscored.so* \
../allwpilib/cscore/build/libs/cscoreJNIShared/shared/raspbian/release/libcscorejni.so* \
../allwpilib/cscore/build/libs/cscore.jar \
../allwpilib/ntcore/build/libs/ntcore/shared/raspbian/release/libntcore.so* \
../allwpilib/ntcore/build/libs/ntcore/shared/raspbian/debug/libntcored.so* \
../allwpilib/ntcore/build/libs/ntcoreJNIShared/shared/raspbian/release/libntcorejni.so* \
../allwpilib/ntcore/build/libs/ntcore.jar \
../allwpilib/cameraserver/build/libs/cameraserver/shared/raspbian/release/libcameraserver.so* \
../allwpilib/cameraserver/build/libs/cameraserver/shared/raspbian/debug/libcameraserverd.so* \
../allwpilib/cameraserver/build/libs/cameraserver.jar \
stage2/01-sys-tweaks/extfiles/
sh -c 'cd ../allwpilib/wpiutil/src/main/native/include && tar czf - uv.h uv wpi' > stage2/01-sys-tweaks/extfiles/wpiutil-include.tar.gz
sh -c 'cd ../allwpilib/cscore/src/main/native/include && tar czf - .' > stage2/01-sys-tweaks/extfiles/cscore-include.tar.gz
sh -c 'cd ../allwpilib/ntcore/src/main/native/include && tar czf - .' > stage2/01-sys-tweaks/extfiles/ntcore-include.tar.gz
sh -c 'cd ../allwpilib/cameraserver/src/main/native/include && tar czf - cameraserver vision' > stage2/01-sys-tweaks/extfiles/cameraserver-include.tar.gz
cp \
../allwpilib/cameraserver/build/exe/multiCameraServer/raspbian/multiCameraServer \
../allwpilib/wpiutil/build/exe/netconsoleServer/raspbian/netconsoleServer \
../allwpilib/wpiutil/build/exe/rpiConfigServer/raspbian/rpiConfigServer \
stage2/01-sys-tweaks/extfiles/

View File

@ -1,11 +1,13 @@
java-common java-common
ntp ntp
daemontools daemontools-run daemontools daemontools-run
build-essential
busybox-syslogd busybox-syslogd
ssh less fbset sudo psmisc strace ed ncdu crda ssh less fbset sudo psmisc strace ed ncdu crda
console-setup keyboard-configuration debconf-utils parted unzip console-setup keyboard-configuration debconf-utils parted unzip
python gdbserver pkg-config python python3 gdbserver pkg-config
python-rpi.gpio v4l-utils python3-numpy
python-rpi.gpio python3-rpi.gpio v4l-utils
avahi-daemon avahi-daemon
lua5.1 lua5.1
luajit luajit

View File

@ -16,9 +16,9 @@ install -m 644 files/raspi-blacklist.conf "${ROOTFS_DIR}/etc/modprobe.d/"
install -m 644 files/frc.json "${ROOTFS_DIR}/boot/" install -m 644 files/frc.json "${ROOTFS_DIR}/boot/"
install -m 755 -o 1000 -g 1000 files/multiCameraServer "${ROOTFS_DIR}/home/pi/" install -m 755 -o 1000 -g 1000 extfiles/multiCameraServer "${ROOTFS_DIR}/home/pi/"
cat files/jdk_11.0.1-strip.tar.gz | sh -c "mkdir -p ${ROOTFS_DIR}/usr/lib/jvm && cd ${ROOTFS_DIR}/usr/lib/jvm/ && tar xzf - --transform=s/^jdk/jdk-11.0.1/" cat extfiles/jdk_11.0.1-strip.tar.gz | sh -c "mkdir -p ${ROOTFS_DIR}/usr/lib/jvm && cd ${ROOTFS_DIR}/usr/lib/jvm/ && tar xzf - --exclude=\*.diz --exclude=src.zip --transform=s/^jdk/jdk-11.0.1/"
cp files/jdk-11.0.1.jinfo "${ROOTFS_DIR}/usr/lib/jvm/.jdk-11.0.1.jinfo" cp files/jdk-11.0.1.jinfo "${ROOTFS_DIR}/usr/lib/jvm/.jdk-11.0.1.jinfo"
on_chroot << EOF on_chroot << EOF
@ -33,7 +33,7 @@ ln -s /tmp /var/lib/dhcp
ln -s /run /var/run ln -s /run /var/run
ln -s /tmp /var/spool ln -s /tmp /var/spool
ln -s /tmp /var/lock ln -s /tmp /var/lock
sed -i -e 's/d \/var\/spool/#d \/var\/spool/' /usr/lib/tmpfiles/var.conf sed -i -e 's/d \/var\/spool/#d \/var\/spool/' /usr/lib/tmpfiles.d/var.conf
sed -i -e 's/\/var\/lib\/ntp/\/var\/tmp/' /etc/ntp.conf sed -i -e 's/\/var\/lib\/ntp/\/var\/tmp/' /etc/ntp.conf
EOF EOF
@ -42,8 +42,6 @@ cat files/bash.bashrc >> "${ROOTFS_DIR}/etc/bash.bashrc"
cat files/bash.logout >> "${ROOTFS_DIR}/etc/bash.bash_logout" cat files/bash.logout >> "${ROOTFS_DIR}/etc/bash.bash_logout"
on_chroot << EOF on_chroot << EOF
systemctl disable hwclock.sh
systemctl disable rpcbind
systemctl enable ssh systemctl enable ssh
systemctl enable regenerate_ssh_host_keys systemctl enable regenerate_ssh_host_keys
EOF EOF
@ -78,6 +76,41 @@ on_chroot << EOF
usermod --pass='*' root usermod --pass='*' root
EOF EOF
install -m 644 files/ld.so.conf.d/*.conf "${ROOTFS_DIR}/etc/ld.so.conf.d/"
install -v -d "${ROOTFS_DIR}/usr/local/frc/lib"
cat extfiles/libopencv.tar.gz | sh -c "cd ${ROOTFS_DIR}/usr/local/frc/lib/ && tar xzf -"
install -m 755 extfiles/cv2.*.so "${ROOTFS_DIR}/usr/local/lib/python3.5/dist-packages/"
install -m 755 extfiles/libwpiutil*.so* "${ROOTFS_DIR}/usr/local/frc/lib/"
install -m 755 extfiles/libcscore*.so* "${ROOTFS_DIR}/usr/local/frc/lib/"
install -m 755 extfiles/libntcore*.so* "${ROOTFS_DIR}/usr/local/frc/lib/"
install -m 755 extfiles/libcameraserver*.so* "${ROOTFS_DIR}/usr/local/frc/lib/"
install -v -d "${ROOTFS_DIR}/usr/local/frc/include"
cat extfiles/wpiutil-include.tar.gz | sh -c "cd ${ROOTFS_DIR}/usr/local/frc/include/ && tar xzf -"
cat extfiles/cscore-include.tar.gz | sh -c "cd ${ROOTFS_DIR}/usr/local/frc/include/ && tar xzf -"
cat extfiles/ntcore-include.tar.gz | sh -c "cd ${ROOTFS_DIR}/usr/local/frc/include/ && tar xzf -"
cat extfiles/cameraserver-include.tar.gz | sh -c "cd ${ROOTFS_DIR}/usr/local/frc/include/ && tar xzf -"
install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/pi/java-example/"
install -m 644 -o 1000 -g 1000 extfiles/*.jar "${ROOTFS_DIR}/home/pi/java-example/"
on_chroot << EOF
ldconfig
EOF
install -v -d "${ROOTFS_DIR}/service/configServer"
install -m 755 files/configServer_run "${ROOTFS_DIR}/service/configServer/run"
install -m 755 extfiles/rpiConfigServer "${ROOTFS_DIR}/usr/local/sbin/configServer"
install -m 755 extfiles/netconsoleServer "${ROOTFS_DIR}/usr/local/bin/"
install -v -d "${ROOTFS_DIR}/service/camera" install -v -d "${ROOTFS_DIR}/service/camera"
install -m 755 files/camera_run "${ROOTFS_DIR}/service/camera/run" install -m 755 files/camera_run "${ROOTFS_DIR}/service/camera/run"
@ -85,6 +118,7 @@ install -m 755 files/camera_run "${ROOTFS_DIR}/service/camera/run"
on_chroot << EOF on_chroot << EOF
cd /service/camera && rm -f supervise && ln -s /tmp/camera-supervise supervise cd /service/camera && rm -f supervise && ln -s /tmp/camera-supervise supervise
cd /etc/service && rm -f camera && ln -s /service/camera . cd /etc/service && rm -f camera && ln -s /service/camera .
cd /etc/service && rm -f configServer && ln -s /service/configServer .
EOF EOF
install -m 755 -o 1000 -g 1000 files/runCamera "${ROOTFS_DIR}/home/pi/" install -m 755 -o 1000 -g 1000 files/runCamera "${ROOTFS_DIR}/home/pi/"

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
sleep 1 sleep 1
cd /home/pi cd /home/pi
exec ./runCamera exec pgrphack setuidgid pi /usr/local/bin/netconsoleServer -u ./runCamera

View File

@ -0,0 +1,2 @@
#!/bin/sh
exec /usr/local/sbin/configServer

View File

@ -0,0 +1,2 @@
/usr/local/frc/lib
/usr/local/frc/third-party/lib

View File

@ -0,0 +1,3 @@
/usr/lib/jvm/jdk-11.0.1/lib/jli
/usr/lib/jvm/jdk-11.0.1/lib/minimal
/usr/lib/jvm/jdk-11.0.1/lib

View File

@ -1,3 +1,4 @@
#!/bin/sh #!/bin/sh
echo "Waiting 5 seconds..."
sleep 5 sleep 5
./multiCameraServer exec ./multiCameraServer

View File

@ -1,10 +1,4 @@
#!/bin/bash #!/bin/bash
SVCPID=`ps ax | grep runCamera | grep -v grep | cut -c -6 | sed -e 's/ *//g'`
sudo svc -d /service/camera sudo svc -d /service/camera
if [[ ! -z $SVCPID ]]; then sleep 1
sudo kill $SVCPID
sleep 1
sudo kill -9 $SVCPID
sleep 1
fi
exec ./runCamera exec ./runCamera

View File

@ -10,7 +10,7 @@ on_chroot << EOF
rm -f /etc/resolv.conf rm -f /etc/resolv.conf
touch /tmp/dhcpcd.resolv.conf touch /tmp/dhcpcd.resolv.conf
ln -s /tmp/dhcpcd.resolve.conf /etc/resolv.conf ln -s /tmp/dhcpcd.resolve.conf /etc/resolv.conf
sed -i -e 's/\/run\//\/var\/run\//' /etc/systemd/system/dhcpcd5.control sed -i -e 's/\/run\//\/var\/run\//' /etc/systemd/system/dhcpcd5.service
mv /etc/dhcpcd.conf /boot/ mv /etc/dhcpcd.conf /boot/
chown root:root /boot/dhcpcd.conf chown root:root /boot/dhcpcd.conf
ln -s /boot/dhcpcd.conf /etc/dhcpcd.conf ln -s /boot/dhcpcd.conf /etc/dhcpcd.conf