Skip to content

Wombat OS Automatic Library Build

erinharrington-12 edited this page Apr 16, 2024 · 23 revisions

Wombat OS Build

Follow the instructions below to build a Wombat-OS image from scratch. Steps will be marked Host Machine or Wombat to indicate where they should be performed

Setup Fresh Raspberry Pi Image on micro SD Card (Host Machine)

  1. Download latest raspberry pi imager and open https://www.raspberrypi.com/software/
  2. Choose Raspberry Pi Device
    • RASPBERRY PI 3
  3. Choose operating system and storage for SD
    • OS - RASPBERRY PI OS (LEGACY, 64-BIT)
    • Storage - SD Card (will fit on 8 GB or larger)
  4. Click Next
  5. OS Customisation
    • Choose "EDIT SETTINGS"
    • Set local host to wombat.local
    • Enable SSH
    • Set username kipr and password botball
    • Wireless LAN: US
    • Set local settings
  6. Write
  7. Plug into pi and give it ~5 minutes to do first boot steps

Build Linux Kernel (Host Machine)

Make sure to have your SD card plugged in to your host machine with a reader or other device.

Requirements

sudo apt install git bc bison flex libssl-dev make libc6-dev libncurses5-dev -y
sudo apt install crossbuild-essential-arm64 -y

Clone Repositories

The Raspberry Pi Linux repository is fairly large and may take some time to download

git clone --depth=1 https://github.com/raspberrypi/linux
git clone https://github.com/kipr/wombat-os

Build Kernel

cd linux
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcm2711_defconfig

Add Config Files

sed -i 's/# CONFIG_TOUCHSCREEN_TSC2007 is not set/CONFIG_TOUCHSCREEN_TSC2007=m/' .config
sudo cp ~/wombat-os/configFiles/tsc2007-overlay.dts ~/linux/arch/arm64/boot/dts/overlays/tsc2007-overlay.dts
sudo cp ~/wombat-os/configFiles/Makefile ~/linux/arch/arm64/boot/dts/overlays/Makefile

Copy Files to Boot and Root

Give permissions to mnt directory

sudo chmod 777 mnt

Make sure your mount directories are actually sda and not something else

lsblk
mkdir mnt && mkdir mnt/boot && mkdir mnt/root
sudo mount /dev/sda1 mnt/boot
sudo mount /dev/sda2 mnt/root
sudo cp ~/wombat-os/splash.png ~/linux/mnt/root/usr/share/plymouth/themes/pix/splash.png
sudo cp ~/wombat-os/wombat.jpg ~/linux/mnt/root/usr/share/rpd-wallpaper
sudo scp -r ~/wombat-os/Backup ~/linux/mnt/root/home/kipr
sudo cp ~/wombat-os/configFiles/config.txt ~/linux/mnt/boot/config.txt
sudo chmod 777 mnt/root/etc/modules
sudo echo 'tsc2007' >> mnt/root/etc/modules

Note: Depending on your machine, you may want to up this to higher than j8 for this build

KERNEL=kernel8
sudo make -j8 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image modules dtbs
sudo env PATH=$PATH make -j8 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_MOD_PATH=mnt/root modules_install
sudo cp mnt/boot/$KERNEL.img mnt/boot/$KERNEL-backup.img
sudo cp arch/arm64/boot/Image mnt/boot/$KERNEL.img
sudo cp arch/arm64/boot/dts/broadcom/*.dtb mnt/boot/
sudo cp arch/arm64/boot/dts/overlays/*.dtb* mnt/boot/overlays/
sudo cp arch/arm/boot/dts/overlays/README mnt/boot/overlays/

Unmount boot and root then unplug micro SD card.

sudo umount mnt/boot
sudo umount mnt/root

Install Basic Packages and Configurations (Wombat)

  1. Plug linux SD into the Raspberry Pi and turn on
  2. Enter Username and Password if needed
    • Username: kipr, Password: botball
  3. Get IP address under for wlan0
    • ifconfig
  4. Remote ssh into Raspberry Pi from HOST MACHINE
    • ssh kipr@<RPI IP address>

Requirements

sudo apt-get update -y && sudo apt-get full-upgrade -y
sudo apt install xinit git
sudo reboot

Wait for Raspberry Pi to reboot

sudo apt-get install libboost-all-dev libudev-dev libinput-dev libts-dev libmtdev-dev libjpeg-dev libfontconfig1-dev libssl-dev libdbus-1-dev libglib2.0-dev libxkbcommon-dev libegl1-mesa-dev libgbm-dev libgles2-mesa-dev mesa-common-dev libasound2-dev libpulse-dev gstreamer1.0-omx libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev  gstreamer1.0-alsa libvpx-dev libsrtp2-dev libsnappy-dev libnss3-dev "^libxcb.*" flex bison libxslt-dev ruby gperf libbz2-dev libcups2-dev libatkmm-1.6-dev libxi6 libxcomposite1 libfreetype6-dev libicu-dev libsqlite3-dev libxslt1-dev xinput-calibrator stm32flash -y
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libx11-dev freetds-dev libsqlite3-dev libpq-dev libiodbc2-dev firebird-dev libgst-dev libxext-dev libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync1 libxcb-sync-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-glx0-dev libxi-dev libdrm-dev libxcb-xinerama0 libxcb-xinerama0-dev libatspi2.0-dev libxcursor-dev libxcomposite-dev libxdamage-dev libxss-dev libxtst-dev libpci-dev libcap-dev libxrandr-dev libdirectfb-dev libaudio-dev libxkbcommon-x11-dev -y

Clone Repository

git clone https://github.com/kipr/wombat-os

Create Directories

sudo mkdir ~/Documents/KISS
sudo mkdir /usr/local/qt6

Serial Port Configuration

Move Stm32flash

sudo scp /usr/bin/stm32flash ~/wombat-os/flashFiles/stm32flash
  1. Enable Serial Ports
    • sudo raspi-config -> Interface Options -> Serial Port
    • login shell accessible over serial? -> NO
    • serial port hardware to be enabled? -> YES
  2. Reboot now? -> YES

Enabling Network Manager

  1. Enable Network Manager through raspi-config
    • sudo raspi-config -> Advanced Options -> Network Config -> Network Manager
    • sudo reboot

Add UI Crash Icon

In case of a crash, add an icon to restart UI

cd wombat-os/configFiles
sudo scp botuiIcon.desktop /home/kipr/.local/share/applications
sed -i '62 r taskBarIcon.txt' ~/.config/lxpanel/LXDE-pi/panels/panel
sudo sed -i '195i <Filename>botuiIcon.desktop</Filename>' /etc/xdg/menus/lxde-pi-applications.menu 

Docker Container Generation - qt6pi3b (Host Machine)

SSH into your Wombat in one terminal

ssh kipr@<RPI IP address>

Clone Repository

Clone into KIPR's cross-building repository in a separate terminal

git clone https://github.com/kipr/qt6pi3b
cd qt6pi3b

Prepare Docker Container

Copy Raspberry Pi's sysroot to computer; Raspberry Pi's password will need to be entered 3 times

sudo ./prepareSysroot.sh kipr <RPI IP address> 

Create 3 Install (Host Machine)

Clone into arm64 Docker repository

git clone https://github.com/kipr/arm64_docker
cd arm64_docker
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
sudo python3 build.py --dockerfile Dockerfile.aarch64 --tag local/arm64
sudo docker run -it --rm local/arm64
apt-get update
apt-get install build-essential openssh-client libzbar-dev libssl-dev

Clone into KIPR's Create 3 repository inside arm64_docker container

git clone -c http.sslVerify=false https://github.com/kipr/create3.git
cd create3
cmake -Bbuild -Dserver=OFF
cd build
make -j16
cmake --install . --prefix prefix
cpack
scp create3-0.1.0-Linux.deb kipr@$WOMBAT_IP:~/create3-0.1.0-Linux.deb

Open a new terminal within arm64_docker repository, not container. Record arm64 container name

sudo docker ps -a

Move arm64_docker include and lib folders to qt6pi3b directory

sudo docker cp <arm64_docker name>:/create3/build/prefix/lib ~/qt6pi3b/
sudo docker cp <arm64_docker name>:/create3/build/prefix/include ~/qt6pi3b/

Generate docker image; this takes a long time and depending on your machine you may want to set a higher PARALLELIZATION

sudo docker build --tag qtpi/qtpi:1.0 .

Run docker container

sudo docker run -it qtpi/qtpi:1.0    

Library Installation (Docker Container)

Copy Qt6 files to Raspberry Pi

~/copyQtToRPi.sh kipr <RPI IP address> 

Libkar Install (Docker Container)

Clone into Libkar's repository and install library

git clone https://github.com/kipr/libkar
cd libkar
mkdir build && cd build
/home/qtpi/qt-raspi/bin/qt-cmake ..
make -j8
sudo make install
cd ../..

Pcompiler Install (Docker Container)

Clone into Pcompiler's repository and install library

git clone https://github.com/kipr/pcompiler  
cd pcompiler
mkdir build && cd build
/home/qtpi/qt-raspi/bin/qt-cmake -Ddocker_cross=ON .. 
make -j8
sudo make install
cd ..
sudo cp lib/libpcompiler.so /usr/lib
cd ..

Libwallaby Install (Docker Container)

Clone into Libwallaby's repository and install library

git clone https://github.com/kipr/libwallaby
sudo apt-get update
sudo apt-get install libzbar-dev libopencv-dev libjpeg-dev python-dev doxygen swig yasm -y 
cd libwallaby
/home/qtpi/qt-raspi/bin/qt-cmake -Bbuild -DCMAKE_TOOLCHAIN_FILE=$(pwd)/toolchain/aarch64-linux-gnu.cmake -DCMAKE_C_COMPILER=/usr/bin/aarch64-linux-gnu-gcc-9 -DCMAKE_CXX_COMPILER=/usr/bin/aarch64-linux-gnu-g++-9 -DCMAKE_SYSROOT=/home/qtpi/rpi-sysroot -Dcreate3_build_local=OFF .
cd build
make -j8
sudo make install
cd ../..

Botui Install (Docker Container)

Clone into Botui's repository and install library

git clone https://github.com/kipr/botui
cd botui
mkdir build && cd build
/home/qtpi/qt-raspi/bin/qt-cmake -Ddocker_cross=ON .. 
make -j8
sudo make install
cd ../..

Cpack Libraries and Copy (Docker Container)

Package each library and send deb files to Raspberry Pi

WOMBAT_IP=<RPI IP address>
cd libkar/build/ && sudo cpack  &&  cd ../..
cd pcompiler/build/ && sudo cpack  &&  cd ../..
cd libwallaby/build/ && sudo cpack  &&  cd ../..
cd botui/build/ && sudo cpack  &&  cd ../..
scp libkar/build/libkar-0.1.1-Linux.deb kipr@${WOMBAT_IP}:~/libkar-0.1.1-Linux.deb
scp pcompiler/build/pcompiler-0.1.1-Linux.deb kipr@${WOMBAT_IP}:~/pcompiler-0.1.1-Linux.deb
scp libwallaby/build/kipr-1.0.0-Linux.deb kipr@${WOMBAT_IP}:~/kipr-1.0.0-Linux.deb
scp botui/build/botui-0.1.1-Linux.deb kipr@${WOMBAT_IP}:~/botui-0.1.1-Linux.deb

Unpackage and Install Deb Files (Wombat)

sudo dpkg -i libkar-0.1.1-Linux.deb
sudo dpkg -i pcompiler-0.1.1-Linux.deb
sudo dpkg -i kipr-1.0.0-Linux.deb
sudo dpkg -i botui-0.1.1-Linux.deb

Harrogate IDE (Wombat)

git clone https://github.com/kipr/harrogate
sudo apt-get install npm gulp -y
cd harrogate
npm install browserfy
npm install
sudo npm install -g gulp@4 gulp-cli
sudo mkdir /var/local/KIPR\ Software\ Suite
sudo chmod 777 /var/local/KIPR\ Software\ Suite
gulp

Running gulp sets up the IDE server, you can hit Ctrl + c to terminate process

Autoboot IDE (Wombat)

sudo chmod 777 /etc/ld.so.conf
sudo echo '/usr/local/qt6/lib' >> /etc/ld.so.conf
sudo ldconfig
cd wombat-os/configFiles
sudo chmod +x wombat_launcher.sh
sudo chmod +x firstTimeScreen.sh
sudo chmod +x screen_settings/find.sh
sudo cp wombat_launcher.sh /home/kipr
sudo cp botui.desktop /etc/xdg/autostart/
sudo cp screen_settings/Default/99-calibration.conf /etc/X11/xorg.conf.d

Calibration Setup (Wombat)

sudo apt-get update
sudo apt-get install xserver-xorg-input-evdev
sudo cp -rf /usr/share/X11/xorg.conf.d/10-evdev.conf /usr/share/X11/xorg.conf.d/45-evdev.conf
sudo cp wombat-os/configFiles/screen_settings/Default/99-calibration.conf /etc/X11/xorg.conf.d/99-calibration.conf
sudo chmod +x wombat-os/configFiles/screen_settings/find.sh
sudo reboot

Run Botui (Wombat)

You can run Botui through the Wombat's terminal

/usr/local/bin/botui

If you get something similiar to the following error:

botui: error while loading shared libraries: libQt6QuickWidgets.so.6: cannot open shared object file: No such file or directory

You can add the following export

export LD_LIBRARY_PATH=/usr/local/qt6/lib:/usr/local/lib

Then run

/usr/local/bin/botui
Clone this wiki locally