recovery-initramfs-init: remove parted dependency

Turns out that the busybox' fdisk applet is also able to parse the GPT
partition tables. This saves around 0.5 MiB of space.

https://jira.digi.com/browse/DEL-4565

Signed-off-by: Jose Diaz de Grenu <Jose.DiazdeGrenu@digi.com>
This commit is contained in:
Jose Diaz de Grenu 2017-08-28 17:21:08 +02:00
parent e6beba4cb0
commit 270f890494
4 changed files with 5 additions and 6 deletions

View File

@ -5,7 +5,6 @@ LICENSE = "MIT"
PACKAGE_INSTALL = " \ PACKAGE_INSTALL = " \
busybox \ busybox \
parted \
psplash \ psplash \
recovery-initramfs \ recovery-initramfs \
swupdate \ swupdate \

View File

@ -23,12 +23,12 @@ PARTITION="$(echo "${MDEV}" | sed -n -e '/^mmc/{s,^[^p]\+p\([0-9]\+\)$,\1,g;T;p}
# This will detect if the block device has a update partition # This will detect if the block device has a update partition
is_update_device() { is_update_device() {
parted -s "/dev/${DEVICE}" print | grep -qs update fdisk -l "/dev/${DEVICE}" | grep -qs update
} }
# This will verify that the requested partition is the update partition # This will verify that the requested partition is the update partition
is_update_partition() { is_update_partition() {
parted -s "/dev/${DEVICE}" print | sed -ne "s,^[^0-9]*\([0-9]\+\).*\<update\>.*,\1,g;T;p" | grep -qs "${PARTITION}" fdisk -l "/dev/${DEVICE}" | sed -ne "s,^[^0-9]*\([0-9]\+\).*\<update\>.*,\1,g;T;p" | grep -qs "${PARTITION}"
} }
if is_update_device; then if is_update_device; then

View File

@ -230,7 +230,7 @@ format_ubi_volume() {
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
format_emmc_block() { format_emmc_block() {
# Find partition block number. # Find partition block number.
local partition_block="/dev/mmcblk0p$(parted -s /dev/mmcblk0 print | sed -ne "s,^[^0-9]*\([0-9]\+\).*\<${1}\>.*,\1,g;T;p")" local partition_block="/dev/mmcblk0p$(fdisk -l /dev/mmcblk0 | sed -ne "s,^[^0-9]*\([0-9]\+\).*\<${1}\>.*,\1,g;T;p")"
if [ -b "${partition_block}" ]; then if [ -b "${partition_block}" ]; then
# Umount in case partition is mounted, ignore errors. # Umount in case partition is mounted, ignore errors.
if grep -qs "${partition_block}" /proc/mounts; then if grep -qs "${partition_block}" /proc/mounts; then
@ -458,7 +458,7 @@ if [ -n "${encryption_key_bool}" ]; then
# Format partition. # Format partition.
if [ "$(is_nand)" = "no" ]; then if [ "$(is_nand)" = "no" ]; then
psplash_message "Formatting rootfs partition..." psplash_message "Formatting rootfs partition..."
rootfs_block="/dev/mmcblk0p$(parted -s /dev/mmcblk0 print | sed -ne "s,^[^0-9]*\([0-9]\+\).*\<rootfs\>.*,\1,g;T;p")" rootfs_block="/dev/mmcblk0p$(fdisk -l /dev/mmcblk0 | sed -ne "s,^[^0-9]*\([0-9]\+\).*\<rootfs\>.*,\1,g;T;p")"
trustfence-tool --format ${rootfs_block} cryptroot trustfence-tool --format ${rootfs_block} cryptroot
fi fi
psplash_progress "100" psplash_progress "100"

View File

@ -72,7 +72,7 @@ if [ -b /dev/mapper/cryptroot ]; then
exit 0 exit 0
fi fi
rootfs_block="/dev/mmcblk0p$(parted -s /dev/mmcblk0 print | sed -ne "s,^[^0-9]*\([0-9]\+\).*\<rootfs\>.*,\1,g;T;p")" rootfs_block="/dev/mmcblk0p$(fdisk -l /dev/mmcblk0 | sed -ne "s,^[^0-9]*\([0-9]\+\).*\<rootfs\>.*,\1,g;T;p")"
# Open LUKS encrypted device # Open LUKS encrypted device
trustfence-tool ${rootfs_block} cryptroot trustfence-tool ${rootfs_block} cryptroot