From 96cb3c82a722af3402964382a78b860eb391a66d Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Fri, 30 Mar 2018 16:30:49 +0800 Subject: [PATCH] mkinitrd(8): improve the man page and styles Suggested-by: swildner --- etc/defaults/mkinitrd.conf | 2 +- sbin/mkinitrd/mkinitrd.8 | 15 +++++++-------- sbin/mkinitrd/mkinitrd.sh | 20 ++++++++++---------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/etc/defaults/mkinitrd.conf b/etc/defaults/mkinitrd.conf index ae3ac1e74f..824b313787 100644 --- a/etc/defaults/mkinitrd.conf +++ b/etc/defaults/mkinitrd.conf @@ -3,5 +3,5 @@ BOOT_DIR="/boot" CONTENT_DIRS="/usr/share/initrd" INITRD_DIRS="bin dev etc sbin tmp var new_root" -INITRD_SIZE_MAX="15" # [MiB] +INITRD_SIZE_MAX="15" # MB TMP_DIR="/tmp" diff --git a/sbin/mkinitrd/mkinitrd.8 b/sbin/mkinitrd/mkinitrd.8 index eb28a48780..295359c1bc 100644 --- a/sbin/mkinitrd/mkinitrd.8 +++ b/sbin/mkinitrd/mkinitrd.8 @@ -1,5 +1,6 @@ .\" -.\" Copyright (c) 2010,2018 The DragonFly Project. All rights reserved. +.\" Copyright (c) 2010, 2018 +.\" The DragonFly Project. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -69,7 +70,7 @@ By default will calculate the contents size and create a ramdisk just big enough. The .Fl s -option accepting an integer (number of MiB) can specify the required +option accepting an integer (number of MB) can specify the required size of the ramdisk. The special value of .Pa 0 @@ -78,7 +79,7 @@ can be given to ignore the setting from the configuration file as described below. The .Fl S -option also accepts an integer (number of MiB) and constrains the maximum +option also accepts an integer (number of MB) and constrains the maximum allowed size of the ramdisk. Specifying a value of .Pa 0 @@ -169,12 +170,10 @@ vfs.root.realroot="tcplay:::[:]" .Sh EXAMPLES .Bd -literal -offset indent vfs.root.realroot="local:ufs:/dev/vg00/lv0[:OPTIONS]" -.Ed -.Bd -literal -offset indent + vfs.root.realroot="crypt:ufs:/dev/ad0s0a:secvolume[:OPTIONS]" -.Ed -.Bd -literal -offset indent -vfs.root.realroot="crypt:hammer2:serno/XXXXXX.s1d:root[:OPTIONS]" + +vfs.root.realroot="crypt:hammer2:/dev/serno/XXXXXX.s1d:root[:OPTIONS]" .Ed .Sh SEE ALSO .Xr md 4 , diff --git a/sbin/mkinitrd/mkinitrd.sh b/sbin/mkinitrd/mkinitrd.sh index 714573fd3d..0f41069fef 100644 --- a/sbin/mkinitrd/mkinitrd.sh +++ b/sbin/mkinitrd/mkinitrd.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2010,2018 +# Copyright (c) 2010, 2018 # The DragonFly Project. All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -48,7 +48,7 @@ calc_size() awk '{ print $7,$1 }' | \ sort -n -k 2 | \ uniq -f 1 | \ - awk '{ sum+=$1 } END { print sum }' # [byte] + awk '{ sum+=$1 } END { print sum }' # byte } calc_initrd_size() @@ -60,7 +60,7 @@ calc_initrd_size() echo "* ${dir}: ${csize} bytes" >&2 isize=$((${isize} + ${csize})) done - # Round initrd size up by MiB + # Round initrd size up by MB isize_mb=$(echo "${isize}" | awk ' function ceil(x) { y = int(x); @@ -70,7 +70,7 @@ calc_initrd_size() mb = $1/1024/1024; print ceil(mb); }') - # Add additional 1 MiB + # Add additional 1 MB echo $((${isize_mb} + 1)) } @@ -156,24 +156,24 @@ test ! -d ${TMP_DIR} && usage test ! -z "$1" && usage BUILD_DIR="${TMP_DIR}/initrd" -INITRD_SIZE=${INITRD_SIZE%[mM]} # [MiB] -INITRD_SIZE_MAX=${INITRD_SIZE_MAX%[mM]} # [MiB] +INITRD_SIZE=${INITRD_SIZE%[mM]} # MB +INITRD_SIZE_MAX=${INITRD_SIZE_MAX%[mM]} # MB CSIZE=$(calc_initrd_size) -echo "Required initrd image size: ${CSIZE} MiB" +echo "Required initrd image size: ${CSIZE} MB" if [ -n "${INITRD_SIZE}" -a "${INITRD_SIZE}" != "0" ]; then if [ ${CSIZE} -gt ${INITRD_SIZE} ]; then - echo "Specified initrd size (${INITRD_SIZE} MiB) too small" + echo "Specified initrd size (${INITRD_SIZE} MB) too small" exit 1 fi else INITRD_SIZE=${CSIZE} fi -echo "Initrd size: ${INITRD_SIZE} MiB" +echo "Initrd size: ${INITRD_SIZE} MB" if [ -n "${INITRD_SIZE_MAX}" -a "${INITRD_SIZE_MAX}" != "0" ] && \ [ ${INITRD_SIZE} -gt ${INITRD_SIZE_MAX} ]; then - echo "Exceeded the specified maximum size (${INITRD_SIZE_MAX} MiB)" + echo "Exceeded the specified maximum size (${INITRD_SIZE_MAX} MB)" exit 1 fi -- 2.41.0