[molecules/*] move beaglebone dependent code to separate script files

This commit is contained in:
Fabio Erculiani 2012-01-26 13:19:09 +01:00
parent 4c67f10e33
commit 8a8e5e092d
7 changed files with 56 additions and 18 deletions

View File

@ -49,10 +49,6 @@ post_image_script: /sabayon/scripts/post_mmc_image_script.sh
# Destination directory for the image path (MANDATORY)
destination_image_directory: /sabayon/images
# External script that will generate the image file.
# The same can be copied onto a MMC by using dd
image_generator_script: /sabayon/scripts/mkloopcard.txt
# Path to source chroot (mandatory)
source_chroot: /sabayon/sources/armv7l_core-2012
@ -123,6 +119,7 @@ paths_to_remove:
/root/local,
/var/tmp/*,
/root/.ssh,
/root/.distcc,
/etc/distcc/.ssh
# Directories to empty (comma separated)

View File

@ -1,7 +1,7 @@
%import /sabayon/molecules/arm-base.common
# Release desc (the actual release description)
release_desc: armv7a Base
release_desc: armv7a BeagleBone Base
# Release Version (used to generate release_file)
release_version: 8
@ -18,3 +18,6 @@ image_mb: 16000
# Path to boot partition data (MLO, u-boot.img etc)
source_boot_directory: /sabayon/beaglebone/boot
# External script that will generate the image file.
# The same can be copied onto a MMC by using dd
image_generator_script: /sabayon/scripts/beaglebone_image_generator_script.sh

View File

@ -1,7 +1,7 @@
%import /sabayon/molecules/arm-base.common
# Release desc (the actual release description)
release_desc: armv7a Base
release_desc: armv7a BeagleBone Base
# Release Version (used to generate release_file)
release_version: 8
@ -18,3 +18,6 @@ image_mb: 3800
# Path to boot partition data (MLO, u-boot.img etc)
source_boot_directory: /sabayon/beaglebone/boot
# External script that will generate the image file.
# The same can be copied onto a MMC by using dd
image_generator_script: /sabayon/scripts/beaglebone_image_generator_script.sh

View File

@ -1,7 +1,7 @@
%import /sabayon/molecules/arm-base.common
# Release desc (the actual release description)
release_desc: armv7a Base
release_desc: armv7a BeagleBone Base
# Release Version (used to generate release_file)
release_version: 8
@ -18,3 +18,6 @@ image_mb: 7800
# Path to boot partition data (MLO, u-boot.img etc)
source_boot_directory: /sabayon/beaglebone/boot
# External script that will generate the image file.
# The same can be copied onto a MMC by using dd
image_generator_script: /sabayon/scripts/beaglebone_image_generator_script.sh

View File

@ -0,0 +1,2 @@
#!/bin/sh
exec /sabayon/scripts/mkloopcard.sh /sabayon/scripts/mkloopcard_beaglebone_chroot_hook.sh "$@"

View File

@ -14,15 +14,20 @@ export LC_ALL=C
# IMAGE_NAME
# DESTINATION_IMAGE_DIR
if [ ${#} -ne 4 ]; then
if [ ${#} -ne 5 ]; then
echo "usage: ${0} <path to regular file containing the image> <size in Mb> <source boot files dir> <source chroot>"
exit 1
fi
FILE="${1}"
SIZE="${2}"
BOOT_DIR="${3}"
CHROOT_DIR="${4}"
CHROOT_SCRIPT="${1}"
if [ ! -x "${CHROOT_SCRIPT}" ]; then
echo "${CHROOT_SCRIPT} is not executable"
exit 1
fi
FILE="${2}"
SIZE="${3}"
BOOT_DIR="${4}"
CHROOT_DIR="${5}"
# Should we make a tarball of the rootfs and bootfs?
MAKE_TARBALL="${MAKE_TARBALL:-1}"
@ -130,12 +135,14 @@ mount "${ext_part}" "${tmp_dir}"
rsync -a -H -A -X --delete-during "${CHROOT_DIR}"/ "${tmp_dir}"/ --exclude "/proc/*" --exclude "/sys/*" \
--exclude "/dev/pts/*" --exclude "/dev/shm/*" || exit 1
# setup root password to... root!
echo "echo root:root | chpasswd" | chroot "${tmp_dir}"
# enable sshd by default
echo "rc-update add sshd default" | chroot "${tmp_dir}"
# cleaning up deps
echo "rc-update --update" | chroot "${tmp_dir}"
# execute CHROOT_SCRIPT hook inside chroot
chroot_script_name=$(basename "${CHROOT_SCRIPT}")
target_chroot_script="${tmp_dir}"/"${chroot_script_name}"
cp -p "${CHROOT_SCRIPT}" "${target_chroot_script}" || exit 1
chmod 700 "${target_chroot_script}" || exit 1
chown root "${target_chroot_script}" || exit 1
chroot "${tmp_dir}" "/${chroot_script_name}" || exit 1
rm -f "${target_chroot_script}"
# work out paths to empty and paths to remove
if [ -n "${PATHS_TO_REMOVE}" ]; then

View File

@ -0,0 +1,23 @@
#!/bin/sh
# This script is executed inside the image chroot before packing up.
# Architecture/platform specific code goes here, like kernel install
# and configuration
env-update
. /etc/profile
# enable sshd by default
rc-update add sshd default
# TODO: error out here when linux-beaglebone is there
# "equo update" is done by inner_source_chroot_update script
# which directive is appended by iso_build.sh script
equo install sys-kernel/linux-beaglebone
# setup root password to... root!
echo root:root | chpasswd
# cleaning up deps
rc-update --update
exit 0