Skip to content

Commit

Permalink
Add support for native debos (#161)
Browse files Browse the repository at this point in the history
* Replace hard-coded `/image_build` with `RECIPE_DIR` envvar

* Fix relative path error in `base-rootfs.yml`

* Fix relative path error in `base-rootfs.yml`

* Troubleshoot md5 handling

* Fix typo in envvar `RECIPE_DIR` vs `RECIPEDIR`

* Add keep file to prevent build-time exception

* Fix `RECIPE_DIR` relative path errors

* Troubleshoot squashfs finalization

* Troubleshoot squashfs finalization

* Fix `env` debug log

* Update squashFS finalization to use built-in envvars
Update `$RECIPEDIR/../output` to `$ARTIFACTDIR/output` for consistency

* Spec stable debos Docker image instead of latest

* Reduce diff

---------

Co-authored-by: Daniel McKnight <daniel@neon.ai>
  • Loading branch information
NeonDaniel and NeonDaniel authored Jun 26, 2024
1 parent 15da178 commit dcb32ca
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion base-rootfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,6 @@ actions:
description: Update md5 base image references
chroot: false
command: |
cd /image_build/base_images
cd "${RECIPEDIR}/base_images"
md5sum *.tar.gz > base_images.md5
chmod 777 ./*
Empty file.
4 changes: 2 additions & 2 deletions recipes/00-build-kernel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ actions:
description: Copy output patch to host
chroot: false
command: |
mv "${ROOTDIR}/var/linux"*.deb "/image_build/overlays/02-rpi4/var/tmp/"
chmod 777 "/image_build/overlays/02-rpi4/var/tmp/"*.deb
mv "${ROOTDIR}/var/linux"*.deb "${RECIPEDIR}/../overlays/02-rpi4/var/tmp/"
chmod 777 "${RECIPEDIR}/../overlays/02-rpi4/var/tmp/"*.deb
4 changes: 2 additions & 2 deletions recipes/00-build-qt-keyboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ actions:
description: Copy output patch to host
chroot: false
command: |
mv "${ROOTDIR}/var/qtvirtualkeyboard_"*.deb "/image_build/overlays/29-ovos-shell/var/tmp/"
chmod 777 "/image_build/overlays/29-ovos-shell/var/tmp/"*.deb
mv "${ROOTDIR}/var/qtvirtualkeyboard_"*.deb "${RECIPEDIR}/../overlays/29-ovos-shell/var/tmp/"
chmod 777 "${RECIPEDIR}/../overlays/29-ovos-shell/var/tmp/"*.deb
2 changes: 1 addition & 1 deletion recipes/95-add_metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ actions:
- action: run
description: Copy metadata to outputs
chroot: false
command: cp "${ROOTDIR}/opt/neon/build_info.json" "/image_build/output/{{ $image }}.json"
command: cp "${ROOTDIR}/opt/neon/build_info.json" "${ARTIFACTDIR}/output/{{ $image }}.json"
2 changes: 1 addition & 1 deletion recipes/98-backup-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ actions:
description: Copy squashFS to host
chroot: false
command: |
mv "${ROOTDIR}/backup.squashfs" "/image_build/output/{{ $image }}.squashfs"
mv "${ROOTDIR}/backup.squashfs" "${ARTIFACTDIR}/output/{{ $image }}.squashfs"
4 changes: 2 additions & 2 deletions recipes/99-finalize_squashfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ actions:
- action: run
description: Copy squashFS to image
chroot: false
script: ../scripts/99-prepare-squashfs.sh "{{ $image }}" "${ROOTDIR}"
script: ../scripts/99-prepare-squashfs.sh "{{ $image }}"

- action: filesystem-deploy
description: Deploying filesystem into image
Expand All @@ -94,5 +94,5 @@ actions:
- action: run
description: Fix Output Ownership
chroot: false
command: chown {{ $uid }}:{{ $uid }} /image_build/output/{{ $image }}.*
command: chown {{ $uid }}:{{ $uid }} "${ARTIFACTDIR}/output/{{ $image }}."*
{{ end }}
2 changes: 1 addition & 1 deletion run_docker_debos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ docker run --rm -d \
--group-add=108 \
--security-opt label=disable \
--name neon_debos \
godebos/debos "${image}" \
godebos/debos:main "${image}" \
-t device:"${device}" \
-t architecture:arm64 \
-t platform:"${platform}" \
Expand Down
18 changes: 9 additions & 9 deletions scripts/99-prepare-squashfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

image=${1}
root_dir=${2}

# Determine directory mounted to `boot` partition
boot_part_dir=""
if [ -d "${root_dir}/boot/firmware" ]; then
if [ -d "${ROOTDIR}/boot/firmware" ]; then
boot_part_dir="/boot/firmware"
else
boot_part_dir="/boot"
fi

mv "${root_dir}${boot_part_dir}" "/image_build/output/boot_part"
rm -rf "${root_dir:?}"/*
mkdir "${root_dir}/root"
cp "/image_build/output/${image}.squashfs" "${root_dir}/root/neon.squashfs" && echo "added ${image} as ${root_dir}/root/neon.squashfs"
mkdir -p "${root_dir}${boot_part_dir}"
mv "/image_build/output/boot_part"/* "${root_dir}${boot_part_dir}" && echo "restored boot partition to ${root_dir}${boot_part_dir}"
rm -r "/image_build/output/boot_part"

mv "${ROOTDIR}${boot_part_dir}" "${ARTIFACTDIR}/output/boot_part"
rm -rf "${ROOTDIR:?}"/*
mkdir "${ROOTDIR}/root"
cp "${ARTIFACTDIR}/output/${image}.squashfs" "${ROOTDIR}/root/neon.squashfs" && echo "added ${image} as ${ROOTDIR}/root/neon.squashfs"
mkdir -p "${ROOTDIR}${boot_part_dir}"
mv "${ARTIFACTDIR}/output/boot_part"/* "${ROOTDIR}${boot_part_dir}" && echo "restored boot partition to ${ROOTDIR}${boot_part_dir}"
rm -r "${ARTIFACTDIR}/output/boot_part"

0 comments on commit dcb32ca

Please sign in to comment.