# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: target/early/build-initramfs.in # Copyright (C) 2007 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 --- INITRD_POSTFLIST_HOOK='early_adjust_initrd' # flatten ln -s . ${initrddir}/usr # don't break /tmp when flattening INITRD_FLIST_PATTERN="$INITRD_FLIST_PATTERN -e '/ usr\/tmp/d;'" INITRD_FLIST_PATTERN="$INITRD_FLIST_PATTERN -e '/ lib\/udev\/devices/d;'" INITRD_EMPTY_PATTERN="-e '/\.\/rootfs/d;'" initrd_flist_install_filter() { local root="build/${SDECFG_ID}/" 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,-std}.in; do cp "$root/$x" "$initrddir/$x" done for x in etc/{fstab,hosts,resolv.conf}; do touch "$initrddir/$x" done ;; *) return 0 ;; esac return 1 } early_adjust_initrd() { echo_status "Tweaking initrd ..." for x in var/state/pkgtool var/spool/{locks,mail} \ usr/{doc,info,man,opt,spool} etc/{rc.d/,}init.d usr do rm ${initrddir}/$x done mkdir "${initrddir}/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 ${initrddir}/sbin/modprobe for x in $( ls -1 target/$target/initrd/*.exec 2> /dev/null ); do y="${x##*/}"; y="$( echo ${y%.exec} | tr '_%' '/_' )" echo_status "injecting $y*" cp -f "$x" "${initrddir}/$y" chmod +x "${initrddir}/$y" done for x in $( ls -1 target/$target/initrd/*.txt 2> /dev/null ); do y="${x##*/}"; y="$( echo ${y%.txt} | tr '_%' '/_' )" echo_status "injecting $y" cp -f "$x" "${initrddir}/$y" done for x in $( ls -1 target/$target/initrd/*.patch 2> /dev/null ); do echo_status "$(patch -p1 -d "${initrddir}" 2>&1 < $x )" done }