linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
To: jes@trained-monkey.org
Cc: linux-raid@vger.kernel.org,
	Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Subject: [PATCH 5/6] mdadm: remove mkinitramfs stuff
Date: Fri, 23 Feb 2024 15:51:45 +0100	[thread overview]
Message-ID: <20240223145146.3822-6-mariusz.tkaczyk@linux.intel.com> (raw)
In-Reply-To: <20240223145146.3822-1-mariusz.tkaczyk@linux.intel.com>

This script uses mdadm.static which is known to not be abandoned
(probably not working) from years. Mdadm is integrated with dracut
and mkinitramfs these days.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
---
 README.initramfs | 122 -----------------------------------------------
 mkinitramfs      |  55 ---------------------
 2 files changed, 177 deletions(-)
 delete mode 100644 README.initramfs
 delete mode 100644 mkinitramfs

diff --git a/README.initramfs b/README.initramfs
deleted file mode 100644
index c5fa6680d187..000000000000
--- a/README.initramfs
+++ /dev/null
@@ -1,122 +0,0 @@
-Assembling md arrays at boot time.
----------------------------------
-December 2005
-
-These notes apply to 2.6 kernels only and, in some cases,
-to 2.6.15 or later.
-
-Md arrays can be assembled at boot time using the 'autodetect' functionality
-which is triggered by storing components of an array in partitions of type
-'fd' - Linux Raid Autodetect.
-They can also be assembled by specifying the component devices in a
-kernel parameter such as
-  md=0,/dev/sda,/dev/sdb
-In this case, /dev/md0 will be assembled (because of the 0) from the listed
-devices.
-
-These mechanisms, while useful, do not provide complete functionality
-and are unlikely to be extended.  The preferred way to assemble md
-arrays at boot time is using 'mdadm'.  To assemble an array which
-contains the root filesystem, mdadm needs to be run before that
-filesystem is mounted, and so needs to be run from an initial-ram-fs.
-It is how this can work that is the primary focus of this document.
-
-It should be noted up front that only the array containing the root
-filesystem should be assembled from the initramfs.  Any other arrays
-should be assembled under the control of files on the main filesystem
-as this enhanced flexibility and maintainability.
-
-A minimal initramfs for assembling md arrays can be created using 3
-files and one directory.  These are:
-
-/bin           Directory
-/bin/mdadm     statically linked mdadm binary
-/bin/busybox   statically linked busybox binary
-/bin/sh        hard link to /bin/busybox
-/init          a shell script which call mdadm appropriately.
-
-An example init script is:
-
-==============================================
-#!/bin/sh
-
-echo 'Auto-assembling boot md array'
-mkdir /proc
-mount -t proc proc /proc
-if [ -n "$rootuuid" ]
-then arg=--uuid=$rootuuid
-elif [ -n "$mdminor" ]
-then arg=--super-minor=$mdminor
-else arg=--super-minor=0
-fi
-echo "Using $arg"
-mdadm -Acpartitions $arg --auto=part /dev/mda
-cd /
-mount /dev/mda1 /root ||  mount /dev/mda /root
-umount /proc
-cd /root
-exec chroot . /sbin/init < /dev/console > /dev/console 2>&1
-=============================================
-
-This could certainly be extended, or merged into a larger init script.
-Though tested and in production use, it is not presented here as
-"The Right Way" to do it, but as a useful example.
-Some key points are:
-
-  /proc needs to be mounted so that /proc/partitions can be accessed
-  by mdadm, and so that /proc/filesystems can be accessed by mount.
-
-  The uuid of the array can be passed in as a kernel parameter
-  (rootuuid).  As the kernel doesn't use this value, it is made available
-  in the environment for /init
-
-  If no uuid is given, we default to md0, (--super-minor=0) which is a
-  commonly used to store the root filesystem.  This may not work in
-  all situations.
-
-  We assemble the array as a partitionable array (/dev/mda) even if we
-  end up using the whole array.  There is no cost in using the partitionable
-  interface, and in this context it is simpler.
-
-  We try mounting both /dev/mda1 and /dev/mda as they are the most like
-  part of the array to contain the root filesystem.
-
-  The --auto flag is given to mdadm so that it will create /dev/md*
-  files automatically.  This is needed as /dev will not contain
-  and md files, and udev will not create them (as udev only created device
-  files after the device exists, and mdadm need the device file to create
-  the device).  Note that the created md files may not exist in /dev
-  of the mounted root filesystem.  This needs to be deal with separately
-  from mdadm - possibly using udev.
-
-  We do not need to create device files for the components which will
-  be assembled into /dev/mda.  mdadm finds the major/minor numbers from
-  /proc/partitions and creates a temporary /dev file if one doesn't already
-  exist.
-
-The script "mkinitramfs" which is included with the mdadm distribution
-can be used to create a minimal initramfs.  It creates a file called
-'init.cpio.gz' which can be specified as an 'initrd' to lilo or grub
-(or whatever boot loader is being used).
-
-
-
-
-Resume from an md array
------------------------
-
-If you want to make use of the suspend-to-disk/resume functionality in Linux,
-and want to have swap on an md array, you will need to assemble the array
-before resume is possible.
-However, because the array is active in the resumed image, you do not want
-anything written to any drives during the resume process, such as superblock
-updates or array resync.
-
-This can be achieved in 2.6.15-rc1 and later kernels using the
-'start_readonly' module parameter.
-Simply include the command
-  echo 1 > /sys/module/md_mod/parameters/start_ro
-before assembling the array with 'mdadm'.
-You can then echo
-  9:0
-or whatever is appropriate to /sys/power/resume to trigger the resume.
diff --git a/mkinitramfs b/mkinitramfs
deleted file mode 100644
index c6275ddb45d0..000000000000
--- a/mkinitramfs
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/sh
-
-# make sure we are being run in the right directory...
-if [ -f mkinitramfs ]
-then :
-else
-  echo >&2 mkinitramfs must be run from the mdadm source directory.
-  exit 1
-fi
-if [ -f /bin/busybox ]
-then : good, it exists
-  case `file /bin/busybox` in
-   *statically* ) : good ;;
-   * ) echo >&2 mkinitramfs: /bin/busybox is not statically linked: cannot proceed.
-       exit 1
-  esac
-else
-  echo >&2 "mkinitramfs: /bin/busybox doesn't exist - please install it statically linked."
-    exit 1
-fi
-
-rm -rf initramfs
-mkdir initramfs
-mkdir initramfs/bin
-make mdadm.static
-cp mdadm.static initramfs/bin/mdadm
-cp /bin/busybox initramfs/bin/busybox
-ln initramfs/bin/busybox initramfs/bin/sh
-cat <<- END > initramfs/init
-	#!/bin/sh
-
-	echo 'Auto-assembling boot md array'
-	mkdir /proc
-	mount -t proc proc /proc
-	if [ -n "$rootuuid" ]
-	then arg=--uuid=$rootuuid
-	elif [ -n "$mdminor" ]
-	then arg=--super-minor=$mdminor
-	else arg=--super-minor=0
-	fi
-	echo "Using $arg"
-	mdadm -Acpartitions $arg --auto=part /dev/mda
-	cd /
-	mount /dev/mda1 /root ||  mount /dev/mda /root
-	umount /proc
-	cd /root
-	exec chroot . /sbin/init < /dev/console > /dev/console 2>&1
-END
-chmod +x initramfs/init
-
-(cd initramfs
- find init bin | cpio -o -H newc | gzip --best
-) > init.cpio.gz
-rm -rf initramfs
-ls -l init.cpio.gz
-- 
2.35.3


  parent reply	other threads:[~2024-02-23 14:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-23 14:51 [PATCH 0/6] Repository cleanup Mariusz Tkaczyk
2024-02-23 14:51 ` [PATCH 1/6] mdadm: remove ANNOUNCEs Mariusz Tkaczyk
2024-02-28 14:40   ` Nix
2024-02-28 15:40     ` Mariusz Tkaczyk
2024-03-07 13:03       ` Nix
2024-03-08  7:35         ` Mariusz Tkaczyk
2024-02-23 14:51 ` [PATCH 2/6] mdadm: remove TODO Mariusz Tkaczyk
2024-02-23 14:51 ` [PATCH 3/6] mdadm: remove makedist Mariusz Tkaczyk
2024-02-23 14:51 ` [PATCH 4/6] mdadm: remove mdadm.spec Mariusz Tkaczyk
2024-02-23 14:51 ` Mariusz Tkaczyk [this message]
2024-02-23 14:51 ` [PATCH 6/6] mdadm: move documentation to folder Mariusz Tkaczyk
2024-02-29 14:11 ` [PATCH 0/6] Repository cleanup Mariusz Tkaczyk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240223145146.3822-6-mariusz.tkaczyk@linux.intel.com \
    --to=mariusz.tkaczyk@linux.intel.com \
    --cc=jes@trained-monkey.org \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).