Browse Source

mkinitramfs: Enhanced to try to install the template from $SDECFG_PKG_MKINITRAMFS_TPL config if possible

early
Alejandro Mery 16 years ago
parent
commit
71b7b710bf
  1. 44
      base/mkinitramfs/find_template.in
  2. 18
      base/mkinitramfs/mkinitramfs.conf

44
base/mkinitramfs/find_template.in

@ -0,0 +1,44 @@
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../mkinitramfs/find_template.in
# Copyright (C) 2008 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 ---
# find the image
#
initrd_img="$base/config/$config/initrd.img"
if [ -s "$initrd_img" ]; then
# explicit overwrite
echo_status "mkinitramfs: Using given ${mkinitramfs_tpl#$base/}."
elif [ -z "$SDECFG_PKG_MKINITRAMFS_TPL" ]; then
initrd_img=
else
# wanted initramfs config
x="$base/config/$SDECFG_PKG_MKINITRAMFS_TPL/config"
if [ ! -s "$x" ]; then
echo_error "mkinitramfs: '$SDECFG_PKG_MKINITRAMFS_TPL' config not found."
initrd_img=
else
x=$(grep SDECFG_ID= "$x" | cut -d"'" -f2)
if [ -d "$base/loop/build" ]; then
initrd_img="$base/loop/build/$x/TOOLCHAIN/initrd.img"
else
initrd_img="$base/build/$x/TOOLCHAIN/initrd.img"
fi
if [ -s "$initrd_img" ]; then
echo_status "mkinitramfs: Using $SDECFG_PKG_MKINITRAMFS_TPL's initrd.img"
else
echo_error "mkinitramfs: '$SDECFG_PKG_MKINITRAMFS_TPL' doesn't contain an initrd.img"
initrd_img=
fi
fi
fi

18
base/mkinitramfs/mkinitramfs.conf

@ -18,8 +18,14 @@ libdir=$libdir/mkinitrd
makeopt= makeopt=
makeinstopt= makeinstopt=
. $confdir/find_template.in
hook_add postmake 5 'mkinitrd_install' hook_add postmake 5 'mkinitrd_install'
hook_add postmake 7 'mkinitrd_install_img' if [ -s "$initrd_img" ]; then
hook_add postmake 7 "cp -vf '$initrd_img' '$root/boot/initrd.img'"
else
echo_warning "No initrd.img found."
fi
mkinitrd_install() { mkinitrd_install() {
install -v -m 755 "$confdir/mkinitramfs.sh" "$root$sbindir/mkinitramfs" install -v -m 755 "$confdir/mkinitramfs.sh" "$root$sbindir/mkinitramfs"
@ -27,13 +33,3 @@ mkinitrd_install() {
cp -vf "$x" "$root$libdir/" cp -vf "$x" "$root$libdir/"
done done
} }
mkinitrd_install_img() {
local image=initrd.img
if [ -r "$base/config/$config/$image" ]; then
echo_status "Injecting $image file from config/$config"
cp -vf "$base/config/$config"/$image "$root/boot/"
else
echo_warning "No $image file found in config/$config"
fi
}

Loading…
Cancel
Save