Add a ramdisk-install.d hook path.

We need to be able to do install.d like things for ramdisks
themselves, but install.d runs outside the ramdisk context - and its
likely to break peoples brains if we mangle the two together - so this
adds a new hook point, ramdisk-install, specifically for installing
things into the ramdisk.

Change-Id: I37d1660309cda6e28bd0b316b08f61db4e080613
This commit is contained in:
Robert Collins 2014-07-16 18:59:49 +12:00
parent 6f7af6f5a2
commit 4319730357
3 changed files with 9 additions and 3 deletions

View File

@ -382,6 +382,10 @@ Ramdisk elements support the following files in their element directories:
* init.d : POSIX shell script fragments that will be appended to the default
script executed as the ramdisk is booted (/init).
* ramdisk-install.d : called to copy files into the ramdisk. The variable
TMP\_MOUNT\_PATH points to the root of the tree that will be packed into
the ramdisk.
* udev.d : udev rules files that will be copied into the ramdisk.
### Element coding standard ###

View File

@ -26,15 +26,17 @@ IMAGE_ELEMENT=
mk_build_dir
mkdir -p $TMP_BUILD_DIR/mnt
TMP_MOUNT_PATH=$TMP_BUILD_DIR/mnt
export TMP_HOOKS_PATH=/tmp
export TMP_MOUNT_PATH=$TMP_BUILD_DIR/mnt
echo "working in $TMP_MOUNT_PATH"
echo "building ramdisk in $TMP_MOUNT_PATH"
create_ramdisk_base
populate_lib
populate_busybox
populate_init
populate_udev
SCRIPT_HOME=/tmp/in_target.d/bin TMP_HOOKS_PATH=/tmp/in_target.d run_d ramdisk-install
finalise_image
save_image /tmp/ramdisk
cp /boot/vmlinuz-${KERNEL_VERSION} /tmp/kernel

View File

@ -192,7 +192,7 @@ function cleanup_dirs () {
rm -rf $TMP_BUILD_DIR $TMP_IMAGE_DIR
}
# Run a directory of hooks outside the target.
# Run a directory of hooks outside the target (that is, no chrooting).
function run_d() {
check_element
check_break before-$1 bash