From f9db3810db48156bdb5fa727073c535cd3a9ae7c Mon Sep 17 00:00:00 2001 From: Pedro Lamas Date: Fri, 25 Feb 2022 15:20:57 +0000 Subject: [PATCH] fix: image build (#25) Signed-off-by: Pedro Lamas Co-authored-by: Mathis Mensing --- .github/workflows/BuildRaspiOS.yml | 14 +++++++------- .github/workflows/ReleaseRaspiOS.yml | 10 +++++----- Makefile | 12 ++++++------ README.md | 6 ++---- src/README.md | 4 ++-- src/config | 2 +- src/image/README | 2 +- src/modules/klipper/config | 2 +- src/modules/klipper/start_chroot_script | 4 ++-- src/modules/mjpgstreamer/start_chroot_script | 6 +++--- src/modules/releaseinfochange/start_chroot_script | 9 +++++++++ 11 files changed, 39 insertions(+), 32 deletions(-) create mode 100644 src/modules/releaseinfochange/start_chroot_script diff --git a/.github/workflows/BuildRaspiOS.yml b/.github/workflows/BuildRaspiOS.yml index 217a51a..2badc7b 100644 --- a/.github/workflows/BuildRaspiOS.yml +++ b/.github/workflows/BuildRaspiOS.yml @@ -3,7 +3,7 @@ on: push: branches: - '**' - tags-ignore: + tags-ignore: - '**' pull_request: types: [ opened, edited ] @@ -17,14 +17,14 @@ jobs: steps: - name: Install Dependencies - run: sudo apt update; sudo apt install coreutils p7zip-full qemu-user-static zip + run: sudo apt update; sudo apt install coreutils p7zip-full qemu-user-static zip - name: Checkout CustomPiOS uses: actions/checkout@v2 with: repository: 'guysoft/CustomPiOS' path: CustomPiOS - + - name: Checkout FluiddPI Project uses: actions/checkout@v2 with: @@ -32,9 +32,9 @@ jobs: path: repository submodules: true - - name: Download Raspbian Source Image + - name: Download Raspberry Pi OS Source Image run: aria2c -d repository/src/image/ --seed-time=0 https://downloads.raspberrypi.org/raspios_lite_armhf_latest.torrent - + - name: Update CustomPiOS Paths run: cd repository/src && ../../CustomPiOS/src/update-custompios-paths @@ -43,11 +43,11 @@ jobs: - name: Copy output image run: cp ${{ github.workspace }}/repository/src/workspace/*-raspios-*-lite.img fluiddpi-raspios-lite-latest.img - + - name: Compress the image run: zip fluiddpi-raspios-lite-latest.zip fluiddpi-raspios-lite-latest.img - uses: actions/upload-artifact@v1 with: name: fluiddpi-raspios-lite-latest.zip - path: fluiddpi-raspios-lite-latest.zip \ No newline at end of file + path: fluiddpi-raspios-lite-latest.zip diff --git a/.github/workflows/ReleaseRaspiOS.yml b/.github/workflows/ReleaseRaspiOS.yml index 58f173f..9146d98 100644 --- a/.github/workflows/ReleaseRaspiOS.yml +++ b/.github/workflows/ReleaseRaspiOS.yml @@ -16,7 +16,7 @@ jobs: with: repository: 'guysoft/CustomPiOS' path: CustomPiOS - + - name: Checkout FluiddPI Project uses: actions/checkout@v2 with: @@ -24,9 +24,9 @@ jobs: path: repository submodules: true - - name: Download Raspbian Source Image + - name: Download Raspberry Pi OS Source Image run: aria2c -d repository/src/image/ --seed-time=0 https://downloads.raspberrypi.org/raspios_lite_armhf_latest.torrent - + - name: Update CustomPiOS Paths run: cd repository/src && ../../CustomPiOS/src/update-custompios-paths @@ -35,7 +35,7 @@ jobs: - name: Copy output image run: cp ${{ github.workspace }}/repository/src/workspace/*-raspios-*-lite.img fluiddpi-raspios-lite-latest.img - + - name: Compress the image run: zip fluiddpi-raspios-lite-latest.zip fluiddpi-raspios-lite-latest.img @@ -52,4 +52,4 @@ jobs: upload_url: ${{ github.event.release.upload_url }} asset_path: fluiddpi-raspios-lite-latest.zip asset_name: fluiddpi-rpi-lite-${{ github.event.release.tag_name }}.zip - asset_content_type: application/zip \ No newline at end of file + asset_content_type: application/zip diff --git a/Makefile b/Makefile index e2802b0..51d6eca 100644 --- a/Makefile +++ b/Makefile @@ -6,16 +6,16 @@ build: verifyimage docker-compose down verifyimage: - @if [ ! -f "src/image/raspbian_latest-raspbian.zip" ]; then echo "Raspbian image does not exist. Starting Download..."; curl -J -L https://downloads.raspberrypi.org/raspios_lite_armhf_latest > src/image/raspbian_latest-raspbian.zip; else \ - echo "Raspbian image found. Starting checksum verification"; curl -J -L https://downloads.raspberrypi.org/raspios_lite_armhf_latest.sha1 > src/image/raspbian_latest-raspbian.zip.sha1; \ - IMAGE_SHA1=`sha1sum src/image/raspbian_latest-raspbian.zip | awk '{print $$1}'`; \ - DL_SHA1=`awk '{print $$1}' src/image/raspbian_latest-raspbian.zip.sha1`; \ - if [ "$$IMAGE_SHA1" != "$$DL_SHA1" ]; then echo "SHAs do not match."; echo "Got $$IMAGE_SHA1"; echo "Expected $$DL_SHA1"; echo "Starting image download"; curl -J -L https://downloads.raspberrypi.org/raspios_lite_armhf_latest > src/image/raspbian_latest-raspbian.zip; else echo "SHAs Matched"; fi; fi + @if [ ! -f "src/image/raspberry_pi_os-latest.zip" ]; then echo "Raspbian image does not exist. Starting Download..."; curl -J -L https://downloads.raspberrypi.org/raspios_lite_armhf_latest > src/image/raspberry_pi_os.zip; else \ + echo "Raspberry Pi OS image found. Starting checksum verification"; curl -J -L https://downloads.raspberrypi.org/raspios_lite_armhf_latest.sha1 > src/image/raspberry_pi_os-latest.zip.sha1; \ + IMAGE_SHA1=`sha1sum src/image/raspberry_pi_os-latest.zip | awk '{print $$1}'`; \ + DL_SHA1=`awk '{print $$1}' src/image/raspberry_pi_os-latest.zip.sha1`; \ + if [ "$$IMAGE_SHA1" != "$$DL_SHA1" ]; then echo "SHAs do not match."; echo "Got $$IMAGE_SHA1"; echo "Expected $$DL_SHA1"; echo "Starting image download"; curl -J -L https://downloads.raspberrypi.org/raspios_lite_armhf_latest > src/image/raspberry_pi_os-latest.zip; else echo "SHAs Matched"; fi; fi clean: rm -rf src/workspace rm -f src/build.log - rm -f src/image/raspbian_latest-raspbian.zip.sha1 + rm -f src/image/raspberry_pi_os-latest.zip.sha1 distclean: rm -rf src/image/*.zip diff --git a/README.md b/README.md index 3058c48..04b57d5 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A pi image with Klipper, Moonraker and Fluidd pre-installed. -This repository contains the necessary code to generate the distribution from an existing Raspbian lite distro image. +This repository contains the necessary code to generate the distribution from an existing Raspberry Pi OS lite distro image. ## Where to download? @@ -44,8 +44,6 @@ Recommended environment is Ubuntu or similar, with docker and docker-compose ins - [docker](https://docs.docker.com/engine/install/ubuntu/) - [docker-compose](https://docs.docker.com/compose/install/) - [qemu-arm-static](http://packages.debian.org/sid/qemu-user-static) -- [CustomPiOS](https://github.com/guysoft/CustomPiOS) -- [Downloaded Raspbian Image](http://www.raspbian.org/) - QEMU for emulation - around ~5gb free space @@ -86,7 +84,7 @@ make distclean ```bash fluiddpi/ /emulation - Contains dependencies for emulation testing - /src/image - Contains our base raspbian image + /src/image - Contains our base Raspberry Pi OS image /src/workspace - Created during build, and output for compiled images ``` diff --git a/src/README.md b/src/README.md index ee71332..6773d5f 100644 --- a/src/README.md +++ b/src/README.md @@ -1,5 +1,5 @@ -Build FluiddPI From within FluiddPI / OctoPi / Raspbian / Debian / Ubuntu -FluiddPI can be built from Debian, Ubuntu, Raspbian, OctoPi, or even FluiddPI. Build requires about 5 GB of free space available. You can build it by issuing the following commands: +Build FluiddPI From within FluiddPI / OctoPi / Raspberry Pi OS / Debian / Ubuntu +FluiddPI can be built from Debian, Ubuntu, Raspberry Pi OS, OctoPi, or even FluiddPI. Build requires about 5 GB of free space available. You can build it by issuing the following commands: sudo apt-get install gawk util-linux qemu-user-static git p7zip-full python3 diff --git a/src/config b/src/config index 58f26b9..7cec3af 100644 --- a/src/config +++ b/src/config @@ -2,4 +2,4 @@ export DIST_NAME=FluiddPI export DIST_VERSION=0.4.0 export BASE_IMAGE_ENLARGEROOT=2500 export BASE_IMAGE_RESIZEROOT=500 -export MODULES="base(network,raspicam,klipper,moonraker,fluidd,mjpgstreamer,password-for-sudo)" +export MODULES="base,releaseinfochange(network,raspicam,klipper,moonraker,fluidd,mjpgstreamer,password-for-sudo)" diff --git a/src/image/README b/src/image/README index 8c07825..c130c59 100644 --- a/src/image/README +++ b/src/image/README @@ -1,5 +1,5 @@ Place zipped Rasbian image here. If not otherwise specified, the build script will always use the most -recent zip file matching the file name pattern "*-raspbian.zip" located +recent zip file matching the file name pattern "*.zip" located here. diff --git a/src/modules/klipper/config b/src/modules/klipper/config index 757243b..7e6c43a 100644 --- a/src/modules/klipper/config +++ b/src/modules/klipper/config @@ -1,5 +1,5 @@ [ -n "$KLIPPER_SRC_DIR" ] || KLIPPER_SRC_DIR=/home/pi/klipper [ -n "$KLIPPER_PYTHON_DIR" ] || KLIPPER_PYTHON_DIR=/home/pi/klippy-env -[ -n "$KLIPPER_REPO_SHIP" ] || KLIPPER_REPO_SHIP=https://github.com/KevinOConnor/klipper.git +[ -n "$KLIPPER_REPO_SHIP" ] || KLIPPER_REPO_SHIP=https://github.com/Klipper3d/klipper.git [ -n "$KLIPPER_REPO_BRANCH" ] || KLIPPER_REPO_BRANCH=master diff --git a/src/modules/klipper/start_chroot_script b/src/modules/klipper/start_chroot_script index 0fb3f6a..332f3c1 100644 --- a/src/modules/klipper/start_chroot_script +++ b/src/modules/klipper/start_chroot_script @@ -22,7 +22,7 @@ apt update apt install wget git gpiod -y # Packages for python cffi -apt install python-virtualenv virtualenv python-dev libffi-dev build-essential -y +apt install virtualenv python-dev libffi-dev build-essential -y # kconfig requirements apt install libncurses-dev -y @@ -33,7 +33,7 @@ apt install libusb-dev -y # AVR chip installation and building apt install avrdude gcc-avr binutils-avr avr-libc -y apt install stm32flash dfu-util libnewlib-arm-none-eabi -y -apt install gcc-arm-none-eabi binutils-arm-none-eabi libusb-1.0 -y +apt install gcc-arm-none-eabi binutils-arm-none-eabi libusb-1.0-0 -y #Make sure user pi has access to serial ports usermod -a -G tty pi diff --git a/src/modules/mjpgstreamer/start_chroot_script b/src/modules/mjpgstreamer/start_chroot_script index eb12839..749784c 100644 --- a/src/modules/mjpgstreamer/start_chroot_script +++ b/src/modules/mjpgstreamer/start_chroot_script @@ -16,7 +16,7 @@ install_cleanup_trap unpack /filesystem/home/pi /home/pi pi apt update -apt install -y --allow-downgrades git cmake=3.13.4-1 cmake-data=3.13.4-1 +apt install -y --allow-downgrades git cmake cmake-data cd /home/pi #mjpg-streamer if [ "$MJPGSTREAMER_INCLUDE_MJPGSTREAMER" == "yes" ] @@ -24,10 +24,10 @@ cd /home/pi echo "--- Installing mjpg-streamer" if [ $( is_in_apt libjpeg62-turbo-dev ) -eq 1 ]; then apt-get -y --force-yes install libjpeg62-turbo-dev - elif [ $( is_in_apt libjpeg8-dev ) -eq 1 ]; then + elif [ $( is_in_apt libjpeg8-dev ) -eq 1 ]; then apt-get -y --force-yes install libjpeg8-dev fi - + apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages --no-install-recommends install imagemagick ffmpeg libv4l-dev gitclone MJPGSTREAMER_MJPGSTREAMER_REPO mjpg-streamer pushd mjpg-streamer diff --git a/src/modules/releaseinfochange/start_chroot_script b/src/modules/releaseinfochange/start_chroot_script new file mode 100644 index 0000000..ee6431e --- /dev/null +++ b/src/modules/releaseinfochange/start_chroot_script @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -xe + +source /common.sh +install_cleanup_trap + +apt update --allow-releaseinfo-change +apt full-upgrade --yes \ No newline at end of file