From 43197303576a4205cf8606956551b6e7b0a95eee Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Wed, 16 Jul 2014 18:59:49 +1200 Subject: [PATCH] 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 --- README.md | 4 ++++ elements/ramdisk/post-install.d/99-build-ramdisk | 6 ++++-- lib/common-functions | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1eb3c3982..17e3ac140 100644 --- a/README.md +++ b/README.md @@ -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 ### diff --git a/elements/ramdisk/post-install.d/99-build-ramdisk b/elements/ramdisk/post-install.d/99-build-ramdisk index 61a373791..9826fbe69 100755 --- a/elements/ramdisk/post-install.d/99-build-ramdisk +++ b/elements/ramdisk/post-install.d/99-build-ramdisk @@ -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 diff --git a/lib/common-functions b/lib/common-functions index ab4801d0d..f00ae0777 100644 --- a/lib/common-functions +++ b/lib/common-functions @@ -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