From 6372530837387454c9837901c51748d0ae96cbeb Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 26 Apr 2016 15:00:55 +0200 Subject: mkimage: get rid of parted; use sfdisk(8). --- README.md | 1 - mkimage.sh.in | 24 +++++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 7498034..aa22405 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@ This repository contains utilities for Void Linux: #### Dependencies * xbps>=0.45 - * parted (for mkimage) * qemu-user-static binaries (for mkrootfs) #### Usage diff --git a/mkimage.sh.in b/mkimage.sh.in index 86bf45e..ef30c5f 100644 --- a/mkimage.sh.in +++ b/mkimage.sh.in @@ -1,6 +1,6 @@ #!/bin/sh #- -# Copyright (c) 2013-2015 Juan Romero Pardines. +# Copyright (c) 2013-2016 Juan Romero Pardines. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -56,11 +56,11 @@ Usage: $PROGNAME [options] The argument expects a tarball generated by void-mkrootfs. The platform is guessed automatically by its name. -Accepted sizes suffixes: K, M, G, T, E. +Accepted sizes suffixes: KiB, MiB, GiB, TiB, EiB. OPTIONS -b Set /boot filesystem type (defaults to FAT) - -B Set /boot filesystem size (defaults to 64MB) + -B Set /boot filesystem size (defaults to 64MiB) -r Set / filesystem type (defaults to EXT4) -s Set total image size (defaults to 2GB) -o Set image filename (guessed automatically) @@ -104,7 +104,7 @@ fi : ${IMGSIZE:=2G} : ${BOOT_FSTYPE:=vfat} -: ${BOOT_FSSIZE:=64M} +: ${BOOT_FSSIZE:=64MiB} : ${ROOT_FSTYPE:=ext4} if [ -z "$FILENAME" ]; then @@ -117,7 +117,7 @@ case "$PLATFORM" in *) die "The $PLATFORM is not supported, exiting..." esac -for f in parted partx losetup mount mkfs.${BOOT_FSTYPE} mkfs.${ROOT_FSTYPE}; do +for f in sfdisk partx losetup mount mkfs.${BOOT_FSTYPE} mkfs.${ROOT_FSTYPE}; do if ! which ${f} >/dev/null; then die "Cannot find ${f}, exiting." fi @@ -143,17 +143,19 @@ if [ "$BOOT_FSTYPE" = "vfat" ]; then fi case "$PLATFORM" in cubieboard2|cubietruck|ci20*) - parted $FILENAME mkpart primary ext2 2048s ${ROOT_FSSIZE} 100% - parted $FILENAME toggle 1 boot + sfdisk ${FILENAME} <<_EOF +2048,,L +_EOF LOOPDEV=$(losetup --show --find --partscan $FILENAME) mkfs.${ROOT_FSTYPE} $disable_journal ${LOOPDEV}p1 >/dev/null 2>&1 mount ${LOOPDEV}p1 $ROOTFSDIR ROOT_UUID=$(blkid -o value -s UUID ${LOOPDEV}p1) ;; *) - parted $FILENAME mkpart primary ${_btype} 2048s ${BOOT_FSSIZE} - parted $FILENAME mkpart primary ext2 ${BOOT_FSSIZE} 100% - parted $FILENAME toggle 1 boot + sfdisk ${FILENAME} <<_EOF +2048,${BOOT_FSSIZE},b +${BOOT_SIZE},+,L,* +_EOF LOOPDEV=$(losetup --show --find --partscan $FILENAME) mkfs.${BOOT_FSTYPE} $_args ${LOOPDEV}p1 >/dev/null case "$ROOT_FSTYPE" in @@ -201,7 +203,7 @@ usbarmory) dd if=${ROOTFSDIR}/boot/u-boot.imx of=${LOOPDEV} bs=512 seek=2 conv=fsync >/dev/null 2>&1 ;; ci20) - ln -sf /boot/uImage ${ROOTFSDIR}/vmlinux.img + cp -f ${ROOTFSDIR}/boot/uImage ${ROOTFSDIR}/boot/vmlinux.img dd if=${ROOTFSDIR}/boot/u-boot-spl.bin of=${LOOPDEV} obs=512 seek=1 >/dev/null 2>&1 dd if=${ROOTFSDIR}/boot/u-boot.img of=${LOOPDEV} obs=1K seek=14 >/dev/null 2>&1 ;; -- cgit 1.4.1