From de9c780f57ae626f05ec1c971c56648250cba03c Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Wed, 8 Jun 2005 21:13:41 +0000 Subject: Initial checkin --- debian/README | 12 +++ debian/TODO | 8 ++ debian/changelog | 64 ++++++++++++++ debian/compat | 1 + debian/control | 12 +++ debian/copyright | 10 +++ debian/files | 1 + debian/initramfs-tools.examples | 1 + debian/initramfs-tools.install | 4 + debian/initramfs-tools.postinst | 10 +++ debian/initramfs-tools.postrm | 8 ++ debian/initramfs-tools/DEBIAN/conffiles | 1 + debian/initramfs-tools/DEBIAN/control | 10 +++ debian/initramfs-tools/DEBIAN/md5sums | 9 ++ debian/initramfs-tools/DEBIAN/postinst | 10 +++ debian/initramfs-tools/DEBIAN/postrm | 8 ++ .../initramfs-tools/etc/mkinitramfs/initramfs.conf | 50 +++++++++++ debian/initramfs-tools/usr/sbin/mkinitramfs | 93 +++++++++++++++++++++ .../usr/share/doc/initramfs-tools/TODO | 8 ++ .../usr/share/doc/initramfs-tools/changelog.gz | Bin 0 -> 784 bytes .../usr/share/doc/initramfs-tools/copyright | 10 +++ .../usr/share/doc/initramfs-tools/examples/modules | 7 ++ .../initramfs-tools/usr/share/initramfs-tools/init | 64 ++++++++++++++ .../usr/share/initramfs-tools/scripts/functions | 9 ++ .../usr/share/initramfs-tools/scripts/local | 15 ++++ .../usr/share/initramfs-tools/scripts/nfs | 11 +++ debian/rules | 6 ++ 27 files changed, 442 insertions(+) create mode 100644 debian/README create mode 100644 debian/TODO create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/files create mode 100644 debian/initramfs-tools.examples create mode 100644 debian/initramfs-tools.install create mode 100644 debian/initramfs-tools.postinst create mode 100644 debian/initramfs-tools.postrm create mode 100644 debian/initramfs-tools/DEBIAN/conffiles create mode 100644 debian/initramfs-tools/DEBIAN/control create mode 100644 debian/initramfs-tools/DEBIAN/md5sums create mode 100644 debian/initramfs-tools/DEBIAN/postinst create mode 100644 debian/initramfs-tools/DEBIAN/postrm create mode 100644 debian/initramfs-tools/etc/mkinitramfs/initramfs.conf create mode 100644 debian/initramfs-tools/usr/sbin/mkinitramfs create mode 100644 debian/initramfs-tools/usr/share/doc/initramfs-tools/TODO create mode 100644 debian/initramfs-tools/usr/share/doc/initramfs-tools/changelog.gz create mode 100644 debian/initramfs-tools/usr/share/doc/initramfs-tools/copyright create mode 100644 debian/initramfs-tools/usr/share/doc/initramfs-tools/examples/modules create mode 100644 debian/initramfs-tools/usr/share/initramfs-tools/init create mode 100644 debian/initramfs-tools/usr/share/initramfs-tools/scripts/functions create mode 100644 debian/initramfs-tools/usr/share/initramfs-tools/scripts/local create mode 100644 debian/initramfs-tools/usr/share/initramfs-tools/scripts/nfs create mode 100644 debian/rules (limited to 'debian') diff --git a/debian/README b/debian/README new file mode 100644 index 0000000..dc85c9b --- /dev/null +++ b/debian/README @@ -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 diff --git a/debian/TODO b/debian/TODO new file mode 100644 index 0000000..bf7e07d --- /dev/null +++ b/debian/TODO @@ -0,0 +1,8 @@ +TODO +==== + + o Get udev compiled against klibc + + o Integrate hotplug-ng + + o Add option to make-kpkg to use mkinitramfs diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..8a999a1 --- /dev/null +++ b/debian/changelog @@ -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 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 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 Tue, 24 May 2005 14:30:07 +0000 + +initramfs-tools (0.3) unstable; urgency=low + + * Fix init and root variables + + -- Jeff Bailey 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 Fri, 28 Jan 2005 16:50:53 -0500 + +initramfs-tools (0.1) unstable; urgency=low + + * Initial Release. + + -- Jeff Bailey Thu, 27 Jan 2005 15:23:52 -0500 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +4 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..fe8d332 --- /dev/null +++ b/debian/control @@ -0,0 +1,12 @@ +Source: initramfs-tools +Section: utils +Priority: optional +Maintainer: Jeff Bailey +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. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..cdc2919 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,10 @@ +This package was debianized by Jeff Bailey on +Thu, 27 Jan 2005 15:23:52 -0500. + +Copyright: + +Author: Jeff Bailey, with some pieces for initrd-tools + +License: + +PUBLIC DOMAIN diff --git a/debian/files b/debian/files new file mode 100644 index 0000000..b9277fc --- /dev/null +++ b/debian/files @@ -0,0 +1 @@ +initramfs-tools_0.6_all.deb utils optional diff --git a/debian/initramfs-tools.examples b/debian/initramfs-tools.examples new file mode 100644 index 0000000..35ca94c --- /dev/null +++ b/debian/initramfs-tools.examples @@ -0,0 +1 @@ +conf/modules diff --git a/debian/initramfs-tools.install b/debian/initramfs-tools.install new file mode 100644 index 0000000..e76186f --- /dev/null +++ b/debian/initramfs-tools.install @@ -0,0 +1,4 @@ +mkinitramfs usr/sbin +init usr/share/initramfs-tools +scripts usr/share/initramfs-tools +conf/initramfs.conf etc/mkinitramfs diff --git a/debian/initramfs-tools.postinst b/debian/initramfs-tools.postinst new file mode 100644 index 0000000..70be9f6 --- /dev/null +++ b/debian/initramfs-tools.postinst @@ -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# + diff --git a/debian/initramfs-tools.postrm b/debian/initramfs-tools.postrm new file mode 100644 index 0000000..7bea06f --- /dev/null +++ b/debian/initramfs-tools.postrm @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ "x${1}" = "xpurge" ]; then + rm /etc/mkinitramfs/modules +fi + +#DEBHELPER# + diff --git a/debian/initramfs-tools/DEBIAN/conffiles b/debian/initramfs-tools/DEBIAN/conffiles new file mode 100644 index 0000000..cd2afc0 --- /dev/null +++ b/debian/initramfs-tools/DEBIAN/conffiles @@ -0,0 +1 @@ +/etc/mkinitramfs/initramfs.conf diff --git a/debian/initramfs-tools/DEBIAN/control b/debian/initramfs-tools/DEBIAN/control new file mode 100644 index 0000000..9192ae1 --- /dev/null +++ b/debian/initramfs-tools/DEBIAN/control @@ -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 +Description: tools for generting an Ubuntu-style initramfs + This package generates an initramfs for an Ubuntu system. diff --git a/debian/initramfs-tools/DEBIAN/md5sums b/debian/initramfs-tools/DEBIAN/md5sums new file mode 100644 index 0000000..420e544 --- /dev/null +++ b/debian/initramfs-tools/DEBIAN/md5sums @@ -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 diff --git a/debian/initramfs-tools/DEBIAN/postinst b/debian/initramfs-tools/DEBIAN/postinst new file mode 100644 index 0000000..36f508d --- /dev/null +++ b/debian/initramfs-tools/DEBIAN/postinst @@ -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 + + + diff --git a/debian/initramfs-tools/DEBIAN/postrm b/debian/initramfs-tools/DEBIAN/postrm new file mode 100644 index 0000000..84bff36 --- /dev/null +++ b/debian/initramfs-tools/DEBIAN/postrm @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ "x${1}" = "xpurge" ]; then + rm /etc/mkinitramfs/modules +fi + + + diff --git a/debian/initramfs-tools/etc/mkinitramfs/initramfs.conf b/debian/initramfs-tools/etc/mkinitramfs/initramfs.conf new file mode 100644 index 0000000..a056469 --- /dev/null +++ b/debian/initramfs-tools/etc/mkinitramfs/initramfs.conf @@ -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 + diff --git a/debian/initramfs-tools/usr/sbin/mkinitramfs b/debian/initramfs-tools/usr/sbin/mkinitramfs new file mode 100644 index 0000000..593c69e --- /dev/null +++ b/debian/initramfs-tools/usr/sbin/mkinitramfs @@ -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 diff --git a/debian/initramfs-tools/usr/share/doc/initramfs-tools/TODO b/debian/initramfs-tools/usr/share/doc/initramfs-tools/TODO new file mode 100644 index 0000000..bf7e07d --- /dev/null +++ b/debian/initramfs-tools/usr/share/doc/initramfs-tools/TODO @@ -0,0 +1,8 @@ +TODO +==== + + o Get udev compiled against klibc + + o Integrate hotplug-ng + + o Add option to make-kpkg to use mkinitramfs diff --git a/debian/initramfs-tools/usr/share/doc/initramfs-tools/changelog.gz b/debian/initramfs-tools/usr/share/doc/initramfs-tools/changelog.gz new file mode 100644 index 0000000..c89e14f Binary files /dev/null and b/debian/initramfs-tools/usr/share/doc/initramfs-tools/changelog.gz differ diff --git a/debian/initramfs-tools/usr/share/doc/initramfs-tools/copyright b/debian/initramfs-tools/usr/share/doc/initramfs-tools/copyright new file mode 100644 index 0000000..cdc2919 --- /dev/null +++ b/debian/initramfs-tools/usr/share/doc/initramfs-tools/copyright @@ -0,0 +1,10 @@ +This package was debianized by Jeff Bailey on +Thu, 27 Jan 2005 15:23:52 -0500. + +Copyright: + +Author: Jeff Bailey, with some pieces for initrd-tools + +License: + +PUBLIC DOMAIN diff --git a/debian/initramfs-tools/usr/share/doc/initramfs-tools/examples/modules b/debian/initramfs-tools/usr/share/doc/initramfs-tools/examples/modules new file mode 100644 index 0000000..ee1310a --- /dev/null +++ b/debian/initramfs-tools/usr/share/doc/initramfs-tools/examples/modules @@ -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 diff --git a/debian/initramfs-tools/usr/share/initramfs-tools/init b/debian/initramfs-tools/usr/share/initramfs-tools/init new file mode 100644 index 0000000..c3e4887 --- /dev/null +++ b/debian/initramfs-tools/usr/share/initramfs-tools/init @@ -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} "$@" diff --git a/debian/initramfs-tools/usr/share/initramfs-tools/scripts/functions b/debian/initramfs-tools/usr/share/initramfs-tools/scripts/functions new file mode 100644 index 0000000..19560ba --- /dev/null +++ b/debian/initramfs-tools/usr/share/initramfs-tools/scripts/functions @@ -0,0 +1,9 @@ +panic() +{ + echo $@ + if [ -e /bin/busybox ]; then + FS1='(initramfs) ' exec /bin/busybox sh + else + FS1='(initramfs) ' exec /bin/sh + fi +} diff --git a/debian/initramfs-tools/usr/share/initramfs-tools/scripts/local b/debian/initramfs-tools/usr/share/initramfs-tools/scripts/local new file mode 100644 index 0000000..572f185 --- /dev/null +++ b/debian/initramfs-tools/usr/share/initramfs-tools/scripts/local @@ -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} +} diff --git a/debian/initramfs-tools/usr/share/initramfs-tools/scripts/nfs b/debian/initramfs-tools/usr/share/initramfs-tools/scripts/nfs new file mode 100644 index 0000000..1225c4d --- /dev/null +++ b/debian/initramfs-tools/usr/share/initramfs-tools/scripts/nfs @@ -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} +} diff --git a/debian/rules b/debian/rules new file mode 100644 index 0000000..0a1575f --- /dev/null +++ b/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/rules/debhelper.mk + +common-build-arch:: + chmod +x init -- cgit v1.2.3