From 105eb52ba5aee50f12496f8c9f239175210538ec Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Tue, 31 May 2011 14:56:19 -0700 Subject: [PATCH] mount /dev and /proc while altering rootfs image Various members of /dev are used (such as /dev/random) in this script, and <() style redirection is used which requires a mounted /proc in the image. So bind-mount /dev and /proc while running so they work. BUG=chromiumos:15951 TEST=examined output before/after Change-Id: I3e8f0edef0da7e63b2af6736e8becfa1cd6d723d Reviewed-on: http://gerrit.chromium.org/gerrit/1846 Reviewed-by: Richard Barnette Tested-by: Scott James Remnant --- mod_for_test_scripts/710enableAuthTesting | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mod_for_test_scripts/710enableAuthTesting b/mod_for_test_scripts/710enableAuthTesting index 7d2aae8564..4003422dd8 100755 --- a/mod_for_test_scripts/710enableAuthTesting +++ b/mod_for_test_scripts/710enableAuthTesting @@ -28,6 +28,11 @@ TMP_CERT=$(mktemp -p /tmp "${CERT_NAME}.pem.XXXXX") mv -f "${TMP_KEY}" "${ROOT_FS_DIR}/${TMP_KEY}" mv -f "${TMP_CERT}" "${ROOT_FS_DIR}/${TMP_CERT}" +# We need access to /dev/random and /dev/self/fd (which is /proc/self/fd) +# within the chrooted image +sudo mount --bind /dev "${ROOT_FS_DIR}"/dev +sudo mount --bind /proc "${ROOT_FS_DIR}"/proc + # Generate testing root cert on the fly. sudo chroot "${ROOT_FS_DIR}" ${QEMU} /usr/bin/openssl req -x509 -days 21 \ -subj "/CN=www.google.com" \ @@ -53,3 +58,6 @@ if [ -n "${QEMU}" ] ; then fi rm -f "${ROOT_FS_DIR}/${TMP_KEY}" rm -f "${ROOT_FS_DIR}/${TMP_CERT}" + +sudo umount "${ROOT_FS_DIR}"/dev +sudo umount "${ROOT_FS_DIR}"/proc