Skip to content

Commit

Permalink
added "disk-signature" to genimage.cfg so that we can boot using PART…
Browse files Browse the repository at this point in the history
…UUID= specifiers in the kernel command-line. In addition, S00eQ3SystemStart will query the new disk identifier after using parted to resize the /usr/local partition. This refs #103.
  • Loading branch information
jens-maus committed Jun 12, 2017
1 parent 0887921 commit 64f3c3b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion buildroot-external/board/raspberrypi0/cmdline.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dwc_otg.lpm_enable=0 console=tty2 root=/dev/mmcblk0p2 ro noswap rootfstype=ext4 elevator=deadline fsck.repair=yes lapic sdhci_bcm2708.enable_llm=0 rootwait rootdelay=5 consoleblank=0 logo.nologo quiet
dwc_otg.lpm_enable=0 console=tty2 root=PARTUUID=deedbeef-02 ro noswap rootfstype=ext4 elevator=deadline fsck.repair=yes lapic sdhci_bcm2708.enable_llm=0 rootwait rootdelay=5 consoleblank=0 logo.nologo quiet
1 change: 1 addition & 0 deletions buildroot-external/board/raspberrypi0/genimage.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ image boot.vfat {

image sdcard.img {
hdimage {
disk-signature = 0xDEEDBEEF
}

partition boot {
Expand Down
2 changes: 1 addition & 1 deletion buildroot-external/board/raspberrypi3/cmdline.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dwc_otg.lpm_enable=0 console=tty2 root=/dev/mmcblk0p2 ro noswap rootfstype=ext4 elevator=deadline fsck.repair=yes lapic sdhci_bcm2708.enable_llm=0 rootwait rootdelay=5 consoleblank=0 logo.nologo quiet
dwc_otg.lpm_enable=0 console=tty2 root=PARTUUID=deedbeef-02 ro noswap rootfstype=ext4 elevator=deadline fsck.repair=yes lapic sdhci_bcm2708.enable_llm=0 rootwait rootdelay=5 consoleblank=0 logo.nologo quiet
1 change: 1 addition & 0 deletions buildroot-external/board/raspberrypi3/genimage.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ image boot.vfat {

image sdcard.img {
hdimage {
disk-signature = 0xDEEDBEEF
}

partition boot {
Expand Down
10 changes: 10 additions & 0 deletions buildroot-external/overlay/base/etc/init.d/S00eQ3SystemStart
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ checkFactoryReset() {
# MAX_CHS
parted -s ${DEV} rm ${PARTNUM}
parted -s ${DEV} mkpart primary ${START_CHS} ${MAX_CHS}

# we have to find out the new disk identifier after having modified
# the partition table because this modifies the identifier
disk_identifier=$(dd if=${DEV} bs=1 count=4 conv=notrunc skip=$((0x1B8)) 2>/dev/null | hexdump -e '"%08x"')
if [[ -n ${disk_identifier} && -f /boot/cmdline.txt ]]; then
mount -o rw,remount /boot
ROOTPARTNUM=$(mountpoint -d / | cut -d':' -f2)
sed -i "s/ root=[^[:space:]]*/ root=PARTUUID=${disk_identifier}-$(printf '%02d' ${ROOTPARTNUM})/" /boot/cmdline.txt
mount -o ro,remount /boot
fi
fi

# we create a clean ext4 partition now
Expand Down

0 comments on commit 64f3c3b

Please sign in to comment.