Skip to content

Commit

Permalink
Add a ramdisk-install.d hook path.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rbtcollins committed Jul 16, 2014
1 parent 6f7af6f commit 4319730
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -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 ###
Expand Down
6 changes: 4 additions & 2 deletions elements/ramdisk/post-install.d/99-build-ramdisk
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/common-functions
Expand Up @@ -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
Expand Down

0 comments on commit 4319730

Please sign in to comment.