From 718a4e8c21289f99ad542faf11bc2e4d769291cc Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Tue, 7 Mar 2017 15:13:22 +0000 Subject: [PATCH] Switch to PARTUUID --- export-image/03-set-partuuid/00-run.sh | 12 ++++++++++++ export-image/{03-finalise => 04-finalise}/01-run.sh | 0 .../files/LICENSE.oracle | 0 export-noobs/00-release/files/partition_setup.sh | 2 +- export-noobs/00-release/files/release_notes.txt | 2 +- stage1/00-boot-files/files/cmdline.txt | 2 +- stage1/01-sys-tweaks/files/fstab | 4 ++-- stage2/01-sys-tweaks/00-patches/07-resize-init.diff | 4 ++-- stage2/01-sys-tweaks/files/resize2fs_once | 2 +- 9 files changed, 20 insertions(+), 8 deletions(-) create mode 100755 export-image/03-set-partuuid/00-run.sh rename export-image/{03-finalise => 04-finalise}/01-run.sh (100%) rename export-image/{03-finalise => 04-finalise}/files/LICENSE.oracle (100%) diff --git a/export-image/03-set-partuuid/00-run.sh b/export-image/03-set-partuuid/00-run.sh new file mode 100755 index 0000000..f19884e --- /dev/null +++ b/export-image/03-set-partuuid/00-run.sh @@ -0,0 +1,12 @@ +#!/bin/bash -e +IMG_FILE="${STAGE_WORK_DIR}/${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.img" + +IMGID="$(fdisk -l ${IMG_FILE} | sed -n 's/Disk identifier: 0x\([^ ]*\)/\1/p')" + +BOOT_PARTUUID="${IMGID}-01" +ROOT_PARTUUID="${IMGID}-02" + +sed -i "s/BOOTDEV/PARTUUID=${BOOT_PARTUUID}/" ${ROOTFS_DIR}/etc/fstab +sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" ${ROOTFS_DIR}/etc/fstab + +sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" ${ROOTFS_DIR}/boot/cmdline.txt diff --git a/export-image/03-finalise/01-run.sh b/export-image/04-finalise/01-run.sh similarity index 100% rename from export-image/03-finalise/01-run.sh rename to export-image/04-finalise/01-run.sh diff --git a/export-image/03-finalise/files/LICENSE.oracle b/export-image/04-finalise/files/LICENSE.oracle similarity index 100% rename from export-image/03-finalise/files/LICENSE.oracle rename to export-image/04-finalise/files/LICENSE.oracle diff --git a/export-noobs/00-release/files/partition_setup.sh b/export-noobs/00-release/files/partition_setup.sh index 3a99342..81cef4d 100644 --- a/export-noobs/00-release/files/partition_setup.sh +++ b/export-noobs/00-release/files/partition_setup.sh @@ -12,7 +12,7 @@ mkdir -p /tmp/1 /tmp/2 mount "$part1" /tmp/1 mount "$part2" /tmp/2 -sed /tmp/1/cmdline.txt -i -e "s|root=/dev/[^ ]*|root=${part2}|" +sed /tmp/1/cmdline.txt -i -e "s|root=[^ ]*|root=${part2}|" sed /tmp/2/etc/fstab -i -e "s|^.* / |${part2} / |" sed /tmp/2/etc/fstab -i -e "s|^.* /boot |${part1} /boot |" diff --git a/export-noobs/00-release/files/release_notes.txt b/export-noobs/00-release/files/release_notes.txt index 2b0ae31..223bcca 100644 --- a/export-noobs/00-release/files/release_notes.txt +++ b/export-noobs/00-release/files/release_notes.txt @@ -1,5 +1,5 @@ UNRELEASED: - * + * Use PARTUUID to support USB boot 2017-03-02: * Updated kernel and firmware (final Pi Zero W support) * Wolfram Mathematica updated to version 11 diff --git a/stage1/00-boot-files/files/cmdline.txt b/stage1/00-boot-files/files/cmdline.txt index 45c7f58..2b0634b 100644 --- a/stage1/00-boot-files/files/cmdline.txt +++ b/stage1/00-boot-files/files/cmdline.txt @@ -1 +1 @@ -dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait +dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=ROOTDEV rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait diff --git a/stage1/01-sys-tweaks/files/fstab b/stage1/01-sys-tweaks/files/fstab index 68e5816..f16e3fb 100644 --- a/stage1/01-sys-tweaks/files/fstab +++ b/stage1/01-sys-tweaks/files/fstab @@ -1,3 +1,3 @@ proc /proc proc defaults 0 0 -/dev/mmcblk0p1 /boot vfat defaults 0 2 -/dev/mmcblk0p2 / ext4 defaults,noatime 0 1 +BOOTDEV /boot vfat defaults 0 2 +ROOTDEV / ext4 defaults,noatime 0 1 diff --git a/stage2/01-sys-tweaks/00-patches/07-resize-init.diff b/stage2/01-sys-tweaks/00-patches/07-resize-init.diff index 97f7c19..0701641 100644 --- a/stage2/01-sys-tweaks/00-patches/07-resize-init.diff +++ b/stage2/01-sys-tweaks/00-patches/07-resize-init.diff @@ -1,5 +1,5 @@ --- a/rootfs/boot/cmdline.txt +++ b/rootfs/boot/cmdline.txt @@ -1 +1 @@ --dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait -+dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh +-dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=ROOTDEV rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait ++dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=ROOTDEV rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh diff --git a/stage2/01-sys-tweaks/files/resize2fs_once b/stage2/01-sys-tweaks/files/resize2fs_once index 7236921..38a4d47 100644 --- a/stage2/01-sys-tweaks/files/resize2fs_once +++ b/stage2/01-sys-tweaks/files/resize2fs_once @@ -12,7 +12,7 @@ case "$1" in start) log_daemon_msg "Starting resize2fs_once" - ROOT_DEV=`grep -Eo 'root=[[:graph:]]+' /proc/cmdline | cut -d '=' -f 2-` && + ROOT_DEV=$(findmnt / -o source -n) && resize2fs $ROOT_DEV && update-rc.d resize2fs_once remove && rm /etc/init.d/resize2fs_once &&