Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial voidlinux changes #86

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion boot/axiom-beta/uEnv.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bootargs=console=ttyPS0,115200n8 root=PARTUUID=f37043ff-02 rw rootfstype=ext4 rootwait systemd.log_level=warning loglevel=7 systemd.log_target=console kernel.sysrq=1 init=/usr/lib/systemd/systemd sdhci.debug_quirks=64 kernel.sysrq=1
bootargs=console=ttyPS0,115200n8 root=PARTUUID=f37043ff-02 rw rootfstype=ext4 rootwait systemd.log_level=warning loglevel=7 systemd.log_target=console kernel.sysrq=1 init=/bin/init sdhci.debug_quirks=64 kernel.sysrq=1
uenvcmd=fatload mmc 0 0x3000000 zImage; fatload mmc 0 0x2A00000 devicetree.dtb;fdt addr 0x2A00000; fdt resize; fdt rsvmem add 0x18000000 0x08000000; fdt rsvmem print; fdt print /chosen bootargs; bootz 0x3000000 - 0x2A00000
ethaddr=00:0a:35:00:01:31
bootdelay=0
2 changes: 1 addition & 1 deletion boot/axiom-micro/uEnv.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bootargs=console=ttyPS0,115200n8 root=PARTUUID=f37043ff-02 rw rootfstype=ext4 rootwait systemd.log_level=warning loglevel=7 systemd.log_target=console kernel.sysrq=1 init=/usr/lib/systemd/systemd sdhci.debug_quirks=64 kernel.sysrq=1
bootargs=console=ttyPS0,115200n8 root=PARTUUID=f37043ff-02 rw rootfstype=ext4 rootwait systemd.log_level=warning loglevel=7 systemd.log_target=console kernel.sysrq=1 init=/bin/init sdhci.debug_quirks=64 kernel.sysrq=1
bootcmd=fatload mmc 0 0x4000000 bitstream.bit;fpga loadb 0 0x4000000 0x1FCC0C;fatload mmc 0 0x3000000 zImage;fatload mmc 0 0x2A00000 devicetree.dtb;fdt addr 0x2A00000; fdt resize; fdt rsvmem add 0xf800000 0x08000000; fdt rsvmem print; fdt print /chosen bootargs; bootz 0x3000000 - 0x2A00000
ethaddr=00:0a:35:00:01:39
bootdelay=0
2 changes: 1 addition & 1 deletion makefiles/docker-make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -eo pipefail

# initialize submodules if nescessary
# TODO(robin): breaks updating submodules without commiting the update
# (git submodule status --recursive | grep "^-") && git submodule update --init --recursive
# (git submodule status --recursive | grep "^-") && git submodule update --init --recursive && git submodule foreach git pull origin master

# check for the right privileges
docker ps > /dev/null
Expand Down
6 changes: 3 additions & 3 deletions makefiles/host/rootfs.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include bootfs.mk

LINUX_BASE_IMAGE=ArchLinuxARM-zedboard-latest.tar.gz
LINUX_BASE_IMAGE=void-armv7l-ROOTFS.tar.xz

build/root.fs/.install_stamp: $(shell find makefiles/in_chroot/) build/root.fs/opt/axiom-firmware/.install_stamp $(LINUX_SOURCE)/arch/arm/boot/zImage build/root.fs/.base_install
rsync -aK build/kernel_modules.fs/ $(@D)
Expand All @@ -18,11 +18,11 @@ build/root.fs/opt/axiom-firmware/.install_stamp: $(shell find -type f -not -path

build/root.fs/.base_install: build/$(LINUX_BASE_IMAGE)
mkdir -p $(@D)
tar --warning=no-unknown-keyword -x -C $(@D) -f $<
tar xpf $< -C $(@D) --xattrs-include='*.*' --numeric-owner

touch $@


build/$(LINUX_BASE_IMAGE):
mkdir -p $(@D)
wget -c -nv http://archlinuxarm.org/os/$(LINUX_BASE_IMAGE) -O $@
wget -q -O $@ "https://alpha.de.repo.voidlinux.org/live/current/$$(wget -q -O - https://alpha.de.repo.voidlinux.org/live/current/ | grep -o 'void-armv7l-ROOTFS[^"]*\.tar\.xz' | head -n1)"
11 changes: 1 addition & 10 deletions makefiles/host/run_in_chroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,15 @@ update-binfmts --enable qemu-aarch64
update-binfmts --enable qemu-arm

# change the resolv conf. systemd is not running in chroot.
[ -f build/root.fs/etc/resolv.conf.bak ] || readlink -v build/root.fs/etc/resolv.conf > build/root.fs/etc/resolv.conf.bak
unlink build/root.fs/etc/resolv.conf
echo "nameserver 185.121.177.177" > build/root.fs/etc/resolv.conf

# use local package cache
rm -rf build/root.fs/var/cache/pacman/*
mkdir -p build/pacman-cache/
mount -o bind build/pacman-cache/ build/root.fs/var/cache/pacman/


chroot build/root.fs $*

# undo the changes, and reset the image to work on hardware again.
ln -sf "$(cat build/root.fs/etc/resolv.conf.bak)" build/root.fs/etc/resolv.conf
rm -f build/root.fs/etc/resolv.conf
rm -f build/root.fs/usr/bin/qemu-arm-static build/root.fs/usr/bin/qemu-aarch64-static

# unmount (allow fail)
umount build/root.fs/var/cache/pacman/pkg/ || true
umount build/root.fs/sys || true
umount build/root.fs/dev/pts || true
umount build/root.fs/dev/ || true
Expand Down
48 changes: 21 additions & 27 deletions makefiles/in_chroot/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,10 @@ DEVICE=$(cat /etc/hostname)

cd /opt/axiom-firmware


# configure pacman & do sysupdate
sed -i 's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf
sed -i 's/#IgnorePkg =/IgnorePkg = linux linux-*/' /etc/pacman.conf
pacman-key --init
pacman-key --populate archlinuxarm
pacman --noconfirm --needed -Syu
pacman --noconfirm -R linux-zedboard || true

# install dependencies
# pacman -R pkgconf --noconfirm || true
pacman --noconfirm --needed -S $(grep -vE "^\s*#" makefiles/in_chroot/requirements_pacman.txt | tr "\n" " ")

# evil hack because archlinux-arm has fucked up packages
cat /etc/ca-certificates/extracted/cadir/* > /etc/ca-certificates/extracted/tls-ca-bundle.pem

xbps-install -ySu
xbps-install -ySu
xbps-install -yS $(grep -vE "^\s*#" makefiles/in_chroot/requirements_xbps.txt | tr "\n" " ") || [ $? -eq 6 ]
pip install -r makefiles/in_chroot/requirements_pip.txt

# setup users
Expand Down Expand Up @@ -58,24 +46,26 @@ for script in software/scripts/*.sh; do ln -sf $(pwd)/$script /usr/axiom/script/
for script in software/scripts/*.py; do ln -sf $(pwd)/$script /usr/axiom/script/axiom-$(basename $script | sed "s/_/-/g"); done

# build and install the control daemon
(cd software/axiom-control-daemon/
[ -d build ] || mkdir -p build
cd build
cmake -G Ninja ..
ninja
./install_daemon.sh
)
# (cd software/axiom-control-daemon/
# [ -d build ] || mkdir -p build
# cd build
# cmake -G Ninja ..
# ninja
# ./install_daemon.sh
# )

# configure lighttpd
cp -f software/configs/lighttpd.conf /etc/lighttpd/lighttpd.conf
systemctl enable lighttpd
# systemctl enable lighttpd
mkdir -p /srv/http/
cp -rf software/http/AXIOM-WebRemote/* /srv/http/

# TODO: build the misc tools from: https://github.com/apertus-open-source-cinema/misc-tools-utilities/tree/master/raw2dng
cdmake software/misc-tools-utilities/raw2dng

# download prebuilt fpga binaries & select the default binary
# also convert the bitstreams to the format expected by the linux kernel
mkdir -p /lib/firmware/
mkdir -p /opt/bitstreams/
BITSTREAMS="BETA/cmv_hdmi3_dual_60.bit BETA/cmv_hdmi3_dual_30.bit BETA/ICSP/icsp.bit check_pin10.bit check_pin20.bit"
for bit in $BITSTREAMS; do
Expand All @@ -86,18 +76,22 @@ for bit in $BITSTREAMS; do
done
ln -sf /opt/bitstreams/cmv_hdmi3_dual_60.bin /lib/firmware/axiom-fpga-main.bin

cp software/scripts/axiom-start.service /etc/systemd/system/
# cp software/scripts/axiom-start.service /etc/systemd/system/
if [[ $DEVICE == 'micro' ]]; then
systemctl disable axiom
true
# systemctl disable axiom
else
# TODO(robin): disable for now, as it hangs the camera
# systemctl enable axiom-start
true
fi

mkdir -p /etc/modules-load.d/
echo "i2c-dev" > /etc/modules-load.d/i2c-dev.conf
echo "ledtrig-heartbeat" > /etc/modules-load.d/ledtrig.conf

ln -sf /etc/sv/agetty-console /etc/runit/runsvdir/default/

# configure bash
cp software/configs/bashrc /etc/bash.bashrc

Expand All @@ -110,8 +104,8 @@ if [ -d overlay ]; then
fi

# install /etc/issue generating service
cp software/configs/gen_etc_issue.service /etc/systemd/system/
systemctl enable gen_etc_issue.service
# cp software/configs/gen_etc_issue.service /etc/systemd/system/
# systemctl enable gen_etc_issue.service

# generate the motd and indicate software version
echo -e "\033[38;5;15m$(tput bold)$(figlet "AXIOM ${DEVICE^}") $(tput sgr0)" > /etc/motd
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# This file contains a list of all the archlinuxarm packages, that are needed inside the image
# install them via: pacman --noconfirm $(grep -vE "^\s*#" dependencies.txt | tr "\n" " ")
# install them via: xbps-install -S $(grep -vE "^\s*#" dependencies.txt | tr "\n" " ")

# things needed for setup
base-devel
git
figlet
wget
hashdeep
pacman-contrib
rsync
libgomp-devel

# dependencies of tools
python
devmem
i2c-tools
cmake
bc
Expand All @@ -23,14 +22,15 @@ ninja
vim
nano
python-pip
python-numpy
python-devel
dtc

# webserver
lighttpd

# python-stuff
python-numpy
#python-numpy

# control daemon
clang
ninja