# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
#
|
|
# Filename: target/early/build-initramfs.in
|
|
# Copyright (C) 2007 - 2009 The OpenSDE Project
|
|
#
|
|
# More information can be found in the files COPYING and README.
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; version 2 of the License. A copy of the
|
|
# GNU General Public License can be found in the file COPYING.
|
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
|
|
INITRAMFS_POSTINSTALL_HOOK='early_adjust_initrd'
|
|
|
|
# flatten
|
|
ln -s . ${rootfs}/usr
|
|
|
|
# don't break /tmp when flattening
|
|
INITRAMFS_INSTALL_PATTERN="$INITRAMFS_INSTALL_PATTERN -e '/ usr\/tmp/d;'"
|
|
|
|
INITRAMFS_EMPTY_PATTERN="-e '/\.\/rootfs/d;'"
|
|
|
|
# initramfs_install <pkg_name> <sandbox> <rootfs>
|
|
initramfs_install() {
|
|
local root="$2" initrddir="$3"
|
|
case "$1" in
|
|
udev) cp -a "$root/lib/udev/devices"/* "$initrddir/dev/"
|
|
return 0 ;;
|
|
hotplug2)
|
|
cp "$root/sbin/hotplug2-modwrap" "$initrddir/sbin/"
|
|
;;
|
|
strace)
|
|
cp "$root/usr/bin/strace" "$initrddir/bin/"
|
|
;;
|
|
sysfiles)
|
|
for x in etc/{,SDE-}VERSION etc/{passwd,group} etc/rc.d/functions{,-ansi}.in; do
|
|
cp "$root/$x" "$initrddir/$x"
|
|
done
|
|
for x in etc/{fstab,hosts,resolv.conf}; do
|
|
touch "$initrddir/$x"
|
|
done
|
|
;;
|
|
dietlibc)
|
|
# skip
|
|
;;
|
|
*) return 0 ;;
|
|
esac
|
|
return 1
|
|
}
|
|
|
|
early_adjust_initrd() {
|
|
echo_status "Tweaking initrd ..."
|
|
for x in var/spool/{locks,mail} \
|
|
usr/{doc,info,man,opt,spool} etc/{rc.d/,}init.d usr
|
|
do
|
|
rm ${rootfs}/$x
|
|
done
|
|
|
|
mkdir "${rootfs}/rootfs"
|
|
|
|
# HACK: bb's modprobe needs insmod on PATH, but udev clears it
|
|
# HACK: additionaly bb's modprobe doesn't handle MODALIAS properly
|
|
# HACK: so we use our own wrapper on top of bb's
|
|
rm ${rootfs}/sbin/modprobe
|
|
}
|
|
|
|
initramfs_install_pattern() {
|
|
local pkg_name="$1"; shift
|
|
|
|
case "$pkg_name" in
|
|
udev)
|
|
echo -n "-n -e '/etc\/udev\//p;' -e '/lib.*\/udev\/devices\//p;' -e '/lib\/udev\/.*_id$/p;' "
|
|
echo "-e '/sbin\/\(udevd\|udevadm\)$/P'"
|
|
;;
|
|
lvm2)
|
|
echo "$@ -e '/sbin\/lvmdump$/d;'"
|
|
;;
|
|
fhs)
|
|
echo "-e '/\/local\(\|\/.*\)$/d;' $@"
|
|
;;
|
|
*)
|
|
echo "$@"
|
|
;;
|
|
esac
|
|
}
|