mirror of
https://salsa.debian.org/kernel-team/initramfs-tools.git
synced 2026-01-26 15:39:08 +00:00
Initial checkin
This commit is contained in:
commit
de9c780f57
50
conf/initramfs.conf
Normal file
50
conf/initramfs.conf
Normal file
@ -0,0 +1,50 @@
|
||||
#
|
||||
# initramfs.conf
|
||||
#
|
||||
|
||||
# BUSYBOX: [ y | n ]
|
||||
#
|
||||
# Use busybox if available. You MUST use the -static version
|
||||
#
|
||||
|
||||
BUSYBOX=n
|
||||
|
||||
#
|
||||
# BOOT: [ local | nfs ]
|
||||
#
|
||||
# local - Boot off of local media (harddrive, USB stick).
|
||||
#
|
||||
# nfs - Boot using an NFS drive as the root of the drive.
|
||||
#
|
||||
|
||||
BOOT=local
|
||||
|
||||
#
|
||||
# MODULES: [ most | dep | list ]
|
||||
#
|
||||
# most - Add all framebuffer, acpi, filesystem, and harddrive drivers.
|
||||
#
|
||||
# dep - Try and guess which modules to load.
|
||||
#
|
||||
# list - Only include modules from the 'additional modules' list
|
||||
#
|
||||
MODULES=list
|
||||
|
||||
#
|
||||
# NFS Section of the config.
|
||||
#
|
||||
|
||||
#
|
||||
# DEVICE: ...
|
||||
#
|
||||
# Specify the network device, like eth0
|
||||
#
|
||||
|
||||
DEVICE=eth0
|
||||
|
||||
#
|
||||
# NFSROOT: [ auto | HOST:MOUNT ]
|
||||
#
|
||||
|
||||
NFSROOT=auto
|
||||
|
||||
7
conf/modules
Normal file
7
conf/modules
Normal file
@ -0,0 +1,7 @@
|
||||
# List of modules that you want to include in your initramfs.
|
||||
# This might be good choices:
|
||||
#
|
||||
#ide-disk
|
||||
#ide-generic
|
||||
#ext2
|
||||
#ext3
|
||||
12
debian/README
vendored
Normal file
12
debian/README
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
initramfs-tools
|
||||
===============
|
||||
|
||||
This package is a work in progress towards the replacement of the initrd
|
||||
system with an initramfs system.
|
||||
|
||||
The goals include using klibc for all earlyspace tools, an integrated udev
|
||||
and an integrated hotplug.
|
||||
|
||||
See the TODO file for a current status.
|
||||
|
||||
Jeff Bailey - 2005-04-24
|
||||
8
debian/TODO
vendored
Normal file
8
debian/TODO
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
TODO
|
||||
====
|
||||
|
||||
o Get udev compiled against klibc
|
||||
|
||||
o Integrate hotplug-ng
|
||||
|
||||
o Add option to make-kpkg to use mkinitramfs
|
||||
64
debian/changelog
vendored
Normal file
64
debian/changelog
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
initramfs-tools (0.6) breezy; urgency=low
|
||||
|
||||
The "Sweep! .... Off!" release.
|
||||
|
||||
* Source in the net-${DEVICE}.conf file to get IP address information.
|
||||
|
||||
* Add commandline parameters for NFSROOT and BOOT.
|
||||
|
||||
* Moving loading of boot functions to after commandline parsing.
|
||||
|
||||
* Allow NFSROOT variable to be set to auto to pick up value from DHCP
|
||||
Server.
|
||||
|
||||
-- Jeff Bailey <jbailey@ubuntu.com> Wed, 1 Jun 2005 12:02:40 -0400
|
||||
|
||||
initramfs-tools (0.5) breezy; urgency=low
|
||||
|
||||
The "Climbing to the horizons" release.
|
||||
|
||||
* Update for newer udev, call "udevstart" rather than "udev udevstart"
|
||||
|
||||
* /etc/mkinitramfs/modules should not be a conffile.
|
||||
|
||||
* Support busybox.
|
||||
|
||||
* Fix bug where -k would delete the tmp files, and otherwise it would keep
|
||||
them.
|
||||
|
||||
* Handle # for comments in the modules file.
|
||||
|
||||
* arch:all, not arch:any
|
||||
|
||||
-- Jeff Bailey <jbailey@ubuntu.com> Tue, 31 May 2005 15:17:56 -0400
|
||||
|
||||
initramfs-tools (0.4) breezy; urgency=low
|
||||
|
||||
* First upload to Ubuntu.
|
||||
|
||||
* Handle glibc compiled udev for now.
|
||||
|
||||
-- Jeff Bailey <jbailey@ubuntu.com> Tue, 24 May 2005 14:30:07 +0000
|
||||
|
||||
initramfs-tools (0.3) unstable; urgency=low
|
||||
|
||||
* Fix init and root variables
|
||||
|
||||
-- Jeff Bailey <jbailey@ubuntu.com> Sat, 29 Jan 2005 17:49:08 -0500
|
||||
|
||||
initramfs-tools (0.2) unstable; urgency=low
|
||||
|
||||
* Include the modules in the initrd
|
||||
* Drop the .ko ending from the module loads.
|
||||
* Actually chain to the sub scripts.
|
||||
* kilbc is now named properly
|
||||
* First cut of an NFS root implementation
|
||||
|
||||
-- Jeff Bailey <jbailey@ubuntu.com> Fri, 28 Jan 2005 16:50:53 -0500
|
||||
|
||||
initramfs-tools (0.1) unstable; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
-- Jeff Bailey <jbailey@ubuntu.com> Thu, 27 Jan 2005 15:23:52 -0500
|
||||
|
||||
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
@ -0,0 +1 @@
|
||||
4
|
||||
12
debian/control
vendored
Normal file
12
debian/control
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
Source: initramfs-tools
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Maintainer: Jeff Bailey <jbailey@ubuntu.com>
|
||||
Build-Depends-Indep: debhelper (>= 4.0.0), cdbs, busybox-cvs-static
|
||||
Standards-Version: 3.6.1
|
||||
|
||||
Package: initramfs-tools
|
||||
Architecture: all
|
||||
Depends: klibc-utils
|
||||
Description: tools for generting an Ubuntu-style initramfs
|
||||
This package generates an initramfs for an Ubuntu system.
|
||||
10
debian/copyright
vendored
Normal file
10
debian/copyright
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
This package was debianized by Jeff Bailey <jbailey@raspberryginger.com> on
|
||||
Thu, 27 Jan 2005 15:23:52 -0500.
|
||||
|
||||
Copyright:
|
||||
|
||||
Author: Jeff Bailey, with some pieces for initrd-tools
|
||||
|
||||
License:
|
||||
|
||||
PUBLIC DOMAIN
|
||||
1
debian/files
vendored
Normal file
1
debian/files
vendored
Normal file
@ -0,0 +1 @@
|
||||
initramfs-tools_0.6_all.deb utils optional
|
||||
1
debian/initramfs-tools.examples
vendored
Normal file
1
debian/initramfs-tools.examples
vendored
Normal file
@ -0,0 +1 @@
|
||||
conf/modules
|
||||
4
debian/initramfs-tools.install
vendored
Normal file
4
debian/initramfs-tools.install
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
mkinitramfs usr/sbin
|
||||
init usr/share/initramfs-tools
|
||||
scripts usr/share/initramfs-tools
|
||||
conf/initramfs.conf etc/mkinitramfs
|
||||
10
debian/initramfs-tools.postinst
vendored
Normal file
10
debian/initramfs-tools.postinst
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ ! -e /etc/mkinitramfs/modules ]; then
|
||||
cp /usr/share/doc/initramfs-tools/examples/modules /etc/mkinitramfs/
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
8
debian/initramfs-tools.postrm
vendored
Normal file
8
debian/initramfs-tools.postrm
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x${1}" = "xpurge" ]; then
|
||||
rm /etc/mkinitramfs/modules
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
1
debian/initramfs-tools/DEBIAN/conffiles
vendored
Normal file
1
debian/initramfs-tools/DEBIAN/conffiles
vendored
Normal file
@ -0,0 +1 @@
|
||||
/etc/mkinitramfs/initramfs.conf
|
||||
10
debian/initramfs-tools/DEBIAN/control
vendored
Normal file
10
debian/initramfs-tools/DEBIAN/control
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
Package: initramfs-tools
|
||||
Version: 0.6
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Architecture: all
|
||||
Depends: klibc-utils
|
||||
Installed-Size: 100
|
||||
Maintainer: Jeff Bailey <jbailey@ubuntu.com>
|
||||
Description: tools for generting an Ubuntu-style initramfs
|
||||
This package generates an initramfs for an Ubuntu system.
|
||||
9
debian/initramfs-tools/DEBIAN/md5sums
vendored
Normal file
9
debian/initramfs-tools/DEBIAN/md5sums
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
741626a7104d48b15ee4f7f0f8973deb usr/share/doc/initramfs-tools/TODO
|
||||
ed79de81154495c4c23a93b32471cb19 usr/share/doc/initramfs-tools/copyright
|
||||
12933b9f50570c11cf0f384eee619ee9 usr/share/doc/initramfs-tools/examples/modules
|
||||
35c556b7165396ffbb9daf1e33f75e80 usr/share/doc/initramfs-tools/changelog.gz
|
||||
614dec8a64e5f9798d4e0eb42219d96d usr/share/initramfs-tools/init
|
||||
f18121fe1135572dbbea347371e8d730 usr/share/initramfs-tools/scripts/nfs
|
||||
9d5014b1fbc092a32526ffa52549193c usr/share/initramfs-tools/scripts/local
|
||||
6ebc6e800720aab93d022fe8ef5063d5 usr/share/initramfs-tools/scripts/functions
|
||||
fd7c4a390d50d181203e0ca2007254e2 usr/sbin/mkinitramfs
|
||||
10
debian/initramfs-tools/DEBIAN/postinst
vendored
Normal file
10
debian/initramfs-tools/DEBIAN/postinst
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ ! -e /etc/mkinitramfs/modules ]; then
|
||||
cp /usr/share/doc/initramfs-tools/examples/modules /etc/mkinitramfs/
|
||||
fi
|
||||
|
||||
|
||||
|
||||
8
debian/initramfs-tools/DEBIAN/postrm
vendored
Normal file
8
debian/initramfs-tools/DEBIAN/postrm
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x${1}" = "xpurge" ]; then
|
||||
rm /etc/mkinitramfs/modules
|
||||
fi
|
||||
|
||||
|
||||
|
||||
50
debian/initramfs-tools/etc/mkinitramfs/initramfs.conf
vendored
Normal file
50
debian/initramfs-tools/etc/mkinitramfs/initramfs.conf
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
#
|
||||
# initramfs.conf
|
||||
#
|
||||
|
||||
# BUSYBOX: [ y | n ]
|
||||
#
|
||||
# Use busybox if available. You MUST use the -static version
|
||||
#
|
||||
|
||||
BUSYBOX=n
|
||||
|
||||
#
|
||||
# BOOT: [ local | nfs ]
|
||||
#
|
||||
# local - Boot off of local media (harddrive, USB stick).
|
||||
#
|
||||
# nfs - Boot using an NFS drive as the root of the drive.
|
||||
#
|
||||
|
||||
BOOT=local
|
||||
|
||||
#
|
||||
# MODULES: [ most | dep | list ]
|
||||
#
|
||||
# most - Add all framebuffer, acpi, filesystem, and harddrive drivers.
|
||||
#
|
||||
# dep - Try and guess which modules to load.
|
||||
#
|
||||
# list - Only include modules from the 'additional modules' list
|
||||
#
|
||||
MODULES=list
|
||||
|
||||
#
|
||||
# NFS Section of the config.
|
||||
#
|
||||
|
||||
#
|
||||
# DEVICE: ...
|
||||
#
|
||||
# Specify the network device, like eth0
|
||||
#
|
||||
|
||||
DEVICE=eth0
|
||||
|
||||
#
|
||||
# NFSROOT: [ auto | HOST:MOUNT ]
|
||||
#
|
||||
|
||||
NFSROOT=auto
|
||||
|
||||
93
debian/initramfs-tools/usr/sbin/mkinitramfs
vendored
Normal file
93
debian/initramfs-tools/usr/sbin/mkinitramfs
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /etc/mkinitramfs/initramfs.conf
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "-o Output"
|
||||
echo "-v version"
|
||||
echo "-k Keep temp files"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Defaults
|
||||
keep="n"
|
||||
|
||||
while getopts "ko:v:" flag; do
|
||||
case $flag in
|
||||
o)
|
||||
outfile="${OPTARG}"
|
||||
;;
|
||||
v)
|
||||
version="${OPTARG}"
|
||||
;;
|
||||
k)
|
||||
keep="y"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x${outfile} = x ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ -d ${outfile} ]; then
|
||||
echo "${outfile} is a directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e /lib/modules/${version} ]; then
|
||||
echo "Cannot find /lib/modules/${version}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TMPDIR=$(mktemp -d) || exit 1
|
||||
mkdir -p ${TMPDIR}/modules ${TMPDIR}/conf ${TMPDIR}/etc
|
||||
mkdir -p ${TMPDIR}/bin ${TMPDIR}/lib ${TMPDIR}/scripts
|
||||
|
||||
for x in $(sed -e '/^#/d' /etc/mkinitramfs/modules); do
|
||||
for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do
|
||||
# Prune duplicates
|
||||
if [ -e ${TMPDIR}/modules/$(basename ${y}) ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
ln -s ${y} ${TMPDIR}/modules
|
||||
echo $(basename ${y}) >>${TMPDIR}/conf/modules
|
||||
done
|
||||
done
|
||||
|
||||
# Have to do each file, because cpio --dereference doesn't recurse down
|
||||
# symlinks.
|
||||
|
||||
ln -s /usr/lib/klibc/bin/* ${TMPDIR}/bin
|
||||
ln -s /usr/lib/klibc/lib/* ${TMPDIR}/lib
|
||||
ln -s /usr/share/initramfs-tools/init ${TMPDIR}/init
|
||||
ln -s /usr/share/initramfs-tools/scripts/* ${TMPDIR}/scripts
|
||||
ln -s /etc/mkinitramfs/initramfs.conf ${TMPDIR}/conf
|
||||
ln -s /etc/udev ${TMPDIR}/etc
|
||||
|
||||
# Hack until udev is built with klibc
|
||||
ln -s /sbin/udev ${TMPDIR}/bin
|
||||
ln -s /sbin/udevstart ${TMPDIR}/bin
|
||||
ln -s /lib/libc.so.* ${TMPDIR}/lib
|
||||
ln -s /lib/ld*.so.* ${TMPDIR}/lib
|
||||
rm ${TMPDIR}/lib/*lsb*
|
||||
|
||||
# Busybox
|
||||
if [ "x${BUSYBOX}" = "xy" ]; then
|
||||
rm ${TMPDIR}/bin/sh
|
||||
ln -s /bin/busybox ${TMPDIR}/bin/sh
|
||||
fi
|
||||
|
||||
# Raid
|
||||
ln -s /sbin/mdadm ${TMPDIR}/bin
|
||||
ln -s /sbin/mdrun ${TMPDIR}/bin
|
||||
|
||||
(cd ${TMPDIR} && find . | cpio --quiet --dereference -o -H newc | gzip -9 >${outfile})
|
||||
|
||||
if [ "${keep}" = "y" ]; then
|
||||
echo "Working files in ${TMPDIR}"
|
||||
else
|
||||
rm -rf "${TMPDIR}"
|
||||
fi
|
||||
8
debian/initramfs-tools/usr/share/doc/initramfs-tools/TODO
vendored
Normal file
8
debian/initramfs-tools/usr/share/doc/initramfs-tools/TODO
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
TODO
|
||||
====
|
||||
|
||||
o Get udev compiled against klibc
|
||||
|
||||
o Integrate hotplug-ng
|
||||
|
||||
o Add option to make-kpkg to use mkinitramfs
|
||||
BIN
debian/initramfs-tools/usr/share/doc/initramfs-tools/changelog.gz
vendored
Normal file
BIN
debian/initramfs-tools/usr/share/doc/initramfs-tools/changelog.gz
vendored
Normal file
Binary file not shown.
10
debian/initramfs-tools/usr/share/doc/initramfs-tools/copyright
vendored
Normal file
10
debian/initramfs-tools/usr/share/doc/initramfs-tools/copyright
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
This package was debianized by Jeff Bailey <jbailey@raspberryginger.com> on
|
||||
Thu, 27 Jan 2005 15:23:52 -0500.
|
||||
|
||||
Copyright:
|
||||
|
||||
Author: Jeff Bailey, with some pieces for initrd-tools
|
||||
|
||||
License:
|
||||
|
||||
PUBLIC DOMAIN
|
||||
7
debian/initramfs-tools/usr/share/doc/initramfs-tools/examples/modules
vendored
Normal file
7
debian/initramfs-tools/usr/share/doc/initramfs-tools/examples/modules
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
# List of modules that you want to include in your initramfs.
|
||||
# This might be good choices:
|
||||
#
|
||||
#ide-disk
|
||||
#ide-generic
|
||||
#ext2
|
||||
#ext3
|
||||
64
debian/initramfs-tools/usr/share/initramfs-tools/init
vendored
Normal file
64
debian/initramfs-tools/usr/share/initramfs-tools/init
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
#!/bin/sh -x
|
||||
mkdir /sys
|
||||
mkdir /proc
|
||||
mkdir /tmp
|
||||
mount -t sysfs sysfs /sys
|
||||
mount -t proc proc /proc
|
||||
|
||||
. /conf/initramfs.conf
|
||||
. /scripts/functions
|
||||
|
||||
# Parse command line options
|
||||
init=/sbin/init
|
||||
root=
|
||||
ro=-r
|
||||
break=
|
||||
rootmnt=/root
|
||||
for x in $(cat /proc/cmdline); do
|
||||
case $x in
|
||||
init=*)
|
||||
INIT=${x#init=}
|
||||
;;
|
||||
root=*)
|
||||
ROOT=${x#root=}
|
||||
;;
|
||||
nfsroot=*)
|
||||
NFSROOT=${x#nfsroot=}
|
||||
;;
|
||||
boot=*)
|
||||
BOOT=${x#boot=}
|
||||
;;
|
||||
ro)
|
||||
ro=-r
|
||||
;;
|
||||
rw)
|
||||
ro=-w
|
||||
;;
|
||||
break)
|
||||
break=yes
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
. /scripts/${BOOT}
|
||||
|
||||
# Load the modules
|
||||
# FIXME - do module options here
|
||||
for x in $(cat /conf/modules); do
|
||||
insmod /modules/$x
|
||||
done
|
||||
|
||||
# Populate /dev tree
|
||||
udevstart
|
||||
|
||||
if [ x${break} = xyes ]; then
|
||||
panic "Spawning shell within the initramfs"
|
||||
fi
|
||||
|
||||
mountroot
|
||||
|
||||
umount /sys
|
||||
umount /proc
|
||||
|
||||
# Chain to real filesystem
|
||||
exec run-init ${rootmnt} ${init} "$@"
|
||||
9
debian/initramfs-tools/usr/share/initramfs-tools/scripts/functions
vendored
Normal file
9
debian/initramfs-tools/usr/share/initramfs-tools/scripts/functions
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
panic()
|
||||
{
|
||||
echo $@
|
||||
if [ -e /bin/busybox ]; then
|
||||
FS1='(initramfs) ' exec /bin/busybox sh
|
||||
else
|
||||
FS1='(initramfs) ' exec /bin/sh
|
||||
fi
|
||||
}
|
||||
15
debian/initramfs-tools/usr/share/initramfs-tools/scripts/local
vendored
Normal file
15
debian/initramfs-tools/usr/share/initramfs-tools/scripts/local
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
# Local filesystem mounting
|
||||
|
||||
# Parameter: Where to mount the filesystem
|
||||
mountroot ()
|
||||
{
|
||||
# Get the root filesystem type
|
||||
if [ ! -e ${ROOT} ]; then
|
||||
panic "ALERT! ${ROOT} does not exist. Dropping to a shell!"
|
||||
fi
|
||||
|
||||
eval $(fstype < ${ROOT})
|
||||
|
||||
# Mount root
|
||||
mount ${ro} -t ${FSTYPE} ${ROOT} ${rootmnt}
|
||||
}
|
||||
11
debian/initramfs-tools/usr/share/initramfs-tools/scripts/nfs
vendored
Normal file
11
debian/initramfs-tools/usr/share/initramfs-tools/scripts/nfs
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
# Paramter: Where the root should be mounted
|
||||
mountroot ()
|
||||
{
|
||||
ipconfig ${DEVICE}
|
||||
. /tmp/net-${DEVICE}.conf
|
||||
if [ "x${NFSROOT}" = "xauto" ]; then
|
||||
NFSROOT=${ROOTSERVER}:${ROOTPATH}
|
||||
fi
|
||||
nfsmount ${NFSROOT} ${rootmnt}
|
||||
}
|
||||
6
debian/rules
vendored
Normal file
6
debian/rules
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
include /usr/share/cdbs/1/rules/debhelper.mk
|
||||
|
||||
common-build-arch::
|
||||
chmod +x init
|
||||
64
init
Normal file
64
init
Normal file
@ -0,0 +1,64 @@
|
||||
#!/bin/sh -x
|
||||
mkdir /sys
|
||||
mkdir /proc
|
||||
mkdir /tmp
|
||||
mount -t sysfs sysfs /sys
|
||||
mount -t proc proc /proc
|
||||
|
||||
. /conf/initramfs.conf
|
||||
. /scripts/functions
|
||||
|
||||
# Parse command line options
|
||||
init=/sbin/init
|
||||
root=
|
||||
ro=-r
|
||||
break=
|
||||
rootmnt=/root
|
||||
for x in $(cat /proc/cmdline); do
|
||||
case $x in
|
||||
init=*)
|
||||
INIT=${x#init=}
|
||||
;;
|
||||
root=*)
|
||||
ROOT=${x#root=}
|
||||
;;
|
||||
nfsroot=*)
|
||||
NFSROOT=${x#nfsroot=}
|
||||
;;
|
||||
boot=*)
|
||||
BOOT=${x#boot=}
|
||||
;;
|
||||
ro)
|
||||
ro=-r
|
||||
;;
|
||||
rw)
|
||||
ro=-w
|
||||
;;
|
||||
break)
|
||||
break=yes
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
. /scripts/${BOOT}
|
||||
|
||||
# Load the modules
|
||||
# FIXME - do module options here
|
||||
for x in $(cat /conf/modules); do
|
||||
insmod /modules/$x
|
||||
done
|
||||
|
||||
# Populate /dev tree
|
||||
udevstart
|
||||
|
||||
if [ x${break} = xyes ]; then
|
||||
panic "Spawning shell within the initramfs"
|
||||
fi
|
||||
|
||||
mountroot
|
||||
|
||||
umount /sys
|
||||
umount /proc
|
||||
|
||||
# Chain to real filesystem
|
||||
exec run-init ${rootmnt} ${init} "$@"
|
||||
93
mkinitramfs
Normal file
93
mkinitramfs
Normal file
@ -0,0 +1,93 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /etc/mkinitramfs/initramfs.conf
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "-o Output"
|
||||
echo "-v version"
|
||||
echo "-k Keep temp files"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Defaults
|
||||
keep="n"
|
||||
|
||||
while getopts "ko:v:" flag; do
|
||||
case $flag in
|
||||
o)
|
||||
outfile="${OPTARG}"
|
||||
;;
|
||||
v)
|
||||
version="${OPTARG}"
|
||||
;;
|
||||
k)
|
||||
keep="y"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x${outfile} = x ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ -d ${outfile} ]; then
|
||||
echo "${outfile} is a directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e /lib/modules/${version} ]; then
|
||||
echo "Cannot find /lib/modules/${version}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TMPDIR=$(mktemp -d) || exit 1
|
||||
mkdir -p ${TMPDIR}/modules ${TMPDIR}/conf ${TMPDIR}/etc
|
||||
mkdir -p ${TMPDIR}/bin ${TMPDIR}/lib ${TMPDIR}/scripts
|
||||
|
||||
for x in $(sed -e '/^#/d' /etc/mkinitramfs/modules); do
|
||||
for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do
|
||||
# Prune duplicates
|
||||
if [ -e ${TMPDIR}/modules/$(basename ${y}) ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
ln -s ${y} ${TMPDIR}/modules
|
||||
echo $(basename ${y}) >>${TMPDIR}/conf/modules
|
||||
done
|
||||
done
|
||||
|
||||
# Have to do each file, because cpio --dereference doesn't recurse down
|
||||
# symlinks.
|
||||
|
||||
ln -s /usr/lib/klibc/bin/* ${TMPDIR}/bin
|
||||
ln -s /usr/lib/klibc/lib/* ${TMPDIR}/lib
|
||||
ln -s /usr/share/initramfs-tools/init ${TMPDIR}/init
|
||||
ln -s /usr/share/initramfs-tools/scripts/* ${TMPDIR}/scripts
|
||||
ln -s /etc/mkinitramfs/initramfs.conf ${TMPDIR}/conf
|
||||
ln -s /etc/udev ${TMPDIR}/etc
|
||||
|
||||
# Hack until udev is built with klibc
|
||||
ln -s /sbin/udev ${TMPDIR}/bin
|
||||
ln -s /sbin/udevstart ${TMPDIR}/bin
|
||||
ln -s /lib/libc.so.* ${TMPDIR}/lib
|
||||
ln -s /lib/ld*.so.* ${TMPDIR}/lib
|
||||
rm ${TMPDIR}/lib/*lsb*
|
||||
|
||||
# Busybox
|
||||
if [ "x${BUSYBOX}" = "xy" ]; then
|
||||
rm ${TMPDIR}/bin/sh
|
||||
ln -s /bin/busybox ${TMPDIR}/bin/sh
|
||||
fi
|
||||
|
||||
# Raid
|
||||
ln -s /sbin/mdadm ${TMPDIR}/bin
|
||||
ln -s /sbin/mdrun ${TMPDIR}/bin
|
||||
|
||||
(cd ${TMPDIR} && find . | cpio --quiet --dereference -o -H newc | gzip -9 >${outfile})
|
||||
|
||||
if [ "${keep}" = "y" ]; then
|
||||
echo "Working files in ${TMPDIR}"
|
||||
else
|
||||
rm -rf "${TMPDIR}"
|
||||
fi
|
||||
9
scripts/functions
Normal file
9
scripts/functions
Normal file
@ -0,0 +1,9 @@
|
||||
panic()
|
||||
{
|
||||
echo $@
|
||||
if [ -e /bin/busybox ]; then
|
||||
FS1='(initramfs) ' exec /bin/busybox sh
|
||||
else
|
||||
FS1='(initramfs) ' exec /bin/sh
|
||||
fi
|
||||
}
|
||||
15
scripts/local
Normal file
15
scripts/local
Normal file
@ -0,0 +1,15 @@
|
||||
# Local filesystem mounting
|
||||
|
||||
# Parameter: Where to mount the filesystem
|
||||
mountroot ()
|
||||
{
|
||||
# Get the root filesystem type
|
||||
if [ ! -e ${ROOT} ]; then
|
||||
panic "ALERT! ${ROOT} does not exist. Dropping to a shell!"
|
||||
fi
|
||||
|
||||
eval $(fstype < ${ROOT})
|
||||
|
||||
# Mount root
|
||||
mount ${ro} -t ${FSTYPE} ${ROOT} ${rootmnt}
|
||||
}
|
||||
11
scripts/nfs
Normal file
11
scripts/nfs
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
# Paramter: Where the root should be mounted
|
||||
mountroot ()
|
||||
{
|
||||
ipconfig ${DEVICE}
|
||||
. /tmp/net-${DEVICE}.conf
|
||||
if [ "x${NFSROOT}" = "xauto" ]; then
|
||||
NFSROOT=${ROOTSERVER}:${ROOTPATH}
|
||||
fi
|
||||
nfsmount ${NFSROOT} ${rootmnt}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user