Switch to PARTUUID
This commit is contained in:
parent
8e74b4f15c
commit
718a4e8c21
9 changed files with 20 additions and 8 deletions
12
export-image/03-set-partuuid/00-run.sh
Executable file
12
export-image/03-set-partuuid/00-run.sh
Executable file
|
@ -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
|
|
@ -12,7 +12,7 @@ mkdir -p /tmp/1 /tmp/2
|
||||||
mount "$part1" /tmp/1
|
mount "$part1" /tmp/1
|
||||||
mount "$part2" /tmp/2
|
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|^.* / |${part2} / |"
|
||||||
sed /tmp/2/etc/fstab -i -e "s|^.* /boot |${part1} /boot |"
|
sed /tmp/2/etc/fstab -i -e "s|^.* /boot |${part1} /boot |"
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
UNRELEASED:
|
UNRELEASED:
|
||||||
*
|
* Use PARTUUID to support USB boot
|
||||||
2017-03-02:
|
2017-03-02:
|
||||||
* Updated kernel and firmware (final Pi Zero W support)
|
* Updated kernel and firmware (final Pi Zero W support)
|
||||||
* Wolfram Mathematica updated to version 11
|
* Wolfram Mathematica updated to version 11
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
proc /proc proc defaults 0 0
|
proc /proc proc defaults 0 0
|
||||||
/dev/mmcblk0p1 /boot vfat defaults 0 2
|
BOOTDEV /boot vfat defaults 0 2
|
||||||
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
|
ROOTDEV / ext4 defaults,noatime 0 1
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
--- a/rootfs/boot/cmdline.txt
|
--- a/rootfs/boot/cmdline.txt
|
||||||
+++ b/rootfs/boot/cmdline.txt
|
+++ b/rootfs/boot/cmdline.txt
|
||||||
@@ -1 +1 @@
|
@@ -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
|
||||||
+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 quiet init=/usr/lib/raspi-config/init_resize.sh
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
log_daemon_msg "Starting resize2fs_once"
|
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 &&
|
resize2fs $ROOT_DEV &&
|
||||||
update-rc.d resize2fs_once remove &&
|
update-rc.d resize2fs_once remove &&
|
||||||
rm /etc/init.d/resize2fs_once &&
|
rm /etc/init.d/resize2fs_once &&
|
||||||
|
|
Loading…
Reference in a new issue