Skip to content

Commit

Permalink
Use commit SHA for partition UUIDs
Browse files Browse the repository at this point in the history
Signed-off-by: Pawel Langowski <pawel.langowski@3mdeb.com>
  • Loading branch information
PLangowski committed Feb 24, 2025
1 parent 378ab27 commit 6e7a12c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions meta-dts-distro/recipes-dts/images/dts-base-image.inc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ IMAGE_INSTALL:append = " \
lshw \
"

LAYER_COMMIT_SHA := "$(cd ${LAYERDIR} && git rev-parse HEAD)"

BOOT_UUID="${@get_uuid('boot' + d.getVar('LAYER_COMMIT_SHA'))}"
ROOT_UUID="${@get_uuid('root' + d.getVar('LAYER_COMMIT_SHA'))}"

def get_uuid(string):
import hashlib, uuid
return str(uuid.UUID(hashlib.md5(string.encode()).hexdigest()))

WICVARS:append = "ROOT_UUID BOOT_UUID"

# Enable local auto-login of the root user (local = serial port and
# virtual console)
DTS_LOCAL_GETTY ?= " \
Expand Down
4 changes: 2 additions & 2 deletions meta-dts-distro/wic/usb-stick-dts.wks.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bootloader --timeout=0 --append=" rootwait"

part /boot --source bootimg-biosplusefi --sourceparams="loader=grub-efi" --ondisk sda --label dts-boot --align 1024 --use-uuid --active --system-id 0xef
part / --source rootfs --fstype=ext4 --ondisk sda --label dts-root --align 1024 --use-uuid --fixed-size 1024
part /boot --source bootimg-biosplusefi --sourceparams="loader=grub-efi" --ondisk sda --label dts-boot --align 1024 --uuid ${BOOT_UUID} --active --system-id 0xef
part / --source rootfs --fstype=ext4 --ondisk sda --label dts-root --align 1024 --uuid ${ROOT_UUID} --fixed-size 1024

0 comments on commit 6e7a12c

Please sign in to comment.