Skip to content

Wombat OS Automatic Library Build

erinharrington-12 edited this page Apr 17, 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
sudo chown -R kipr:kipr /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 --branch autoLibraryBuild
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 -e PI_PASSWORD=botball -e WOMBAT_IP_ADDRESS=<your_raspberry_pi_IP> qtpi/qtpi:1.0    

The terminal will prompt your for your Wombat password. Enter here.

Library Installation (Docker Container)

Copy Qt6 files to Raspberry Pi

~/copyQtToRPi.sh kipr <RPI IP address> 

Unpackage and Install Deb Files (Wombat)

ls *.deb | sudo xargs dpkg -i

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