Initial commit
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Pünkösd Marcell 2021-07-19 15:09:34 +02:00
parent e28b2640fb
commit 9d6868f20c
2 changed files with 64 additions and 0 deletions

8
build.sh Executable file
View File

@ -0,0 +1,8 @@
docker run --rm -it \
-v $PWD/output:/output -v $PWD/input:/input \
-e "DEFAULT_KERNEL_MODULES=*" \
-e "SIZE_ROOT_PART=750M" \
-e "SIZE_ROOT_FS=700M" \
-e "DEFAULT_TIMEZONE=Europe/Budapest" \
builder # <- don't forgetti to build this

56
input/image.sh Executable file
View File

@ -0,0 +1,56 @@
#!/bin/sh
VERSION="1"
RUNTIME_PACKAGES="python3 udev alsa-utils alsa-utils-doc alsa-lib alsaconf py3-rpigpio"
BUILD_PACKAGES="alsa-lib-dev gcc g++ python3-dev musl-dev"
# put back the resolv.conf to keep apk working
rm ${ROOTFS_PATH}/etc/resolv.conf # remove symlink
cp /etc/resolv.conf ${ROOTFS_PATH}/etc/resolv.conf
# install things
chroot_exec apk add $RUNTIME_PACKAGES $BUILD_PACKAGES
# setup udev
chroot_exec rc-update add udev sysinit
chroot_exec rc-update add udev-trigger default
chroot_exec rc-update add udev-settle default
# udev_postmount's purpose is to write stuff to / which is not possible now
# make audio work
echo "snd_bcm2835" >> ${ROOTFS_PATH}/etc/modules # Actually this is also loaded by udev, but it wouldn't hurt
echo "dtparam=audio=on" >> ${BOOTFS_PATH}/config.txt
echo "hdmi_drive=1" >> ${BOOTFS_PATH}/config.txt # disable HDMI audio
chroot_exec addgroup root audio
sed -i -e "s/^defaults.ctl.card [0-9]*$/defaults.ctl.card 0/" ${ROOTFS_PATH}/usr/share/alsa/alsa.conf
sed -i -e "s/^defaults.pcm.card [0-9]*$/defaults.pcm.card 0/" ${ROOTFS_PATH}/usr/share/alsa/alsa.conf
chroot_exec rc-update add alsa default
sed -i -e "s%alsastatedir=/var/lib/alsa%alsastatedir=/data/var/lib/alsa%" ${ROOTFS_PATH}/etc/init.d/alsa
mkdir -p ${DATAFS_PATH}/var/lib/alsa
# make serial work
sed -i -e 's%#ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100%ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100%' ${ROOTFS_PATH}/etc/inittab
# mark this version
echo "Version: ${VERSION}\nBuild: $(date)\nUpdate: " > ${ROOTFS_PATH}/version
# install things
mkdir -p ${ROOTFS_PATH}/opt/
for repo in iot-platform-raspberry iot-logic; do
archive="${repo}.tar.gz"
wget https://git.kmlabz.com/birbnetes/$repo/archive/master.tar.gz -O "${archive}"
tar xvf "${archive}" -C ${ROOTFS_PATH}/opt/
done
chroot_exec pip3 install /opt/iot-platform-raspberry/
chroot_exec pip3 install -r /opt/iot-logic/requirements.txt
# clean build dependencies
chroot_exec apk del $BUILD_PACKAGES
# Put back resolv.conf where it was
rm ${ROOTFS_PATH}/etc/resolv.conf
ln -fs /data/etc/resolv.conf ${ROOTFS_PATH}/etc/resolv.conf