[molecules/*] add basic and untested .spec file for the Efika MX

This commit is contained in:
Fabio Erculiani 2012-02-14 15:55:45 +01:00
parent 29119b2b48
commit eb41b3e1b9
7 changed files with 209 additions and 20 deletions

BIN
boot/arm/efikamx/boot.scr Executable file

Binary file not shown.

12
boot/arm/efikamx/boot.script Executable file
View File

@ -0,0 +1,12 @@
setenv ramdisk uInitrd;
setenv kernel uImage;
setenv bootargs console=tty1 console=/dev/${console} root=/dev/mmcblk0p2 rootwait rw quiet rootfstype=ext3;
${loadcmd} ${ramdiskaddr} ${ramdisk};
if imi ${ramdiskaddr}; then; else
setenv bootargs ${bootargs} noinitrd;
setenv ramdiskaddr "";
fi;
${loadcmd} ${kerneladdr} ${kernel}
if imi ${kerneladdr}; then
bootm ${kerneladdr} ${ramdiskaddr}
fi;

14
molecules/efikamx.common Normal file
View File

@ -0,0 +1,14 @@
# List of packages to add
packages_to_add:
app-misc/sabayonlive-tools,
app-misc/sabayon-skel,
app-admin/syslog-ng,
net-misc/cnetworkmanager,
net-misc/ntp,
sys-apps/keyboard-configuration-helpers,
sys-apps/language-configuration-helpers,
sys-kernel/linux-efikamx,
sys-process/vixie-cron
# List of packages to remove
packages_to_remove:

View File

@ -0,0 +1,24 @@
%import /sabayon/molecules/arm-base.common
%import /sabayon/molecules/efikamx.common
# Release desc (the actual release description)
release_desc: armv7a Efika MX
# Release Version (used to generate release_file)
release_version: 8
# Specify image file name (image file name will be automatically
# produced otherwise)
image_name: Sabayon_Linux_8_armv7a_EfikaMX_Base_2GB.img
# Specify the image file size in Megabytes. This is mandatory.
# To avoid runtime failure, make sure the image is large enough to fit your
# chroot data.
image_mb: 2000
# Path to boot partition data (MLO, u-boot.img etc)
source_boot_directory: /sabayon/boot/arm/efikamx
# External script that will generate the image file.
# The same can be copied onto a MMC by using dd
image_generator_script: /sabayon/scripts/efikamx_image_generator_script.sh

View File

@ -0,0 +1,7 @@
#!/bin/sh
export BOOT_PART_TYPE=ext3
export BOOT_PART_TYPE_INSIDE_ROOT=1
export ROOT_PART_TYPE=ext4
exec /sabayon/scripts/mkloopcard.sh /sabayon/scripts/mkloopcard_efikamx_chroot_hook.sh "$@"

View File

@ -35,6 +35,12 @@ BOOT_DIR="${4}"
CHROOT_DIR="${5}"
# Should we make a tarball of the rootfs and bootfs?
MAKE_TARBALL="${MAKE_TARBALL:-1}"
# Boot partition type
BOOT_PART_TYPE="${BOOT_PART_TYPE:-vfat}"
# Root partition type
ROOT_PART_TYPE="${ROOT_PART_TYPE:-ext3}"
# Copy /boot content from Root partition to Boot partition?
BOOT_PART_TYPE_INSIDE_ROOT="${BOOT_PART_TYPE_INSIDE_ROOT:-}"
cleanup_loopbacks() {
cd /
@ -44,9 +50,10 @@ cleanup_loopbacks() {
sync
[[ -n "${tmp_file}" ]] && rm "${tmp_file}" 2> /dev/null
[[ -n "${tmp_dir}" ]] && { umount "${tmp_dir}" &> /dev/null; rmdir "${tmp_dir}" &> /dev/null; }
[[ -n "${boot_tmp_dir}" ]] && { umount "${boot_tmp_dir}" &> /dev/null; rmdir "${boot_tmp_dir}" &> /dev/null; }
sleep 1
[[ -n "${vfat_part}" ]] && losetup -d "${vfat_part}" 2> /dev/null
[[ -n "${ext_part}" ]] && losetup -d "${ext_part}" 2> /dev/null
[[ -n "${boot_part}" ]] && losetup -d "${boot_part}" 2> /dev/null
[[ -n "${root_part}" ]] && losetup -d "${root_part}" 2> /dev/null
[[ -n "${DRIVE}" ]] && losetup -d "${DRIVE}" 2> /dev/null
# make sure to have run this
[[ -n "${tmp_dir}" ]] && CHROOT_DIR="${tmp_dir}" /sabayon/scripts/mmc_remaster_post.sh
@ -98,29 +105,36 @@ echo "ExtFS size : ${EXTSIZE} bytes"
echo "ExtFS offset : ${EXTOFFSET} bytes"
# Get other two loopback devices first
vfat_part=$(losetup -f --offset "${STARTOFFSET}" --sizelimit "${MAGICSIZE}" "${FILE}" --show)
if [ -z "${vfat_part}" ]; then
echo "Cannot setup the vfat partition loopback"
boot_part=$(losetup -f --offset "${STARTOFFSET}" --sizelimit "${MAGICSIZE}" "${FILE}" --show)
if [ -z "${boot_part}" ]; then
echo "Cannot setup the boot partition loopback"
exit 1
fi
ext_part=$(losetup -f --offset "${EXTOFFSET}" --sizelimit "${EXTSIZE}" "${FILE}" --show)
if [ -z "${ext_part}" ]; then
echo "Cannot setup the ext3 partition loopback"
root_part=$(losetup -f --offset "${EXTOFFSET}" --sizelimit "${EXTSIZE}" "${FILE}" --show)
if [ -z "${root_part}" ]; then
echo "Cannot setup the ${ROOT_PART_TYPE} partition loopback"
exit 1
fi
echo "VFAT Partiton at : ${vfat_part}"
echo "ExtFS Partition at : ${ext_part}"
echo "Boot Partiton at : ${boot_part}"
echo "Root Partition at : ${root_part}"
# Format vfat
echo "Formatting VFAT ${vfat_part}..."
mkfs.vfat -n "boot" -F 32 "${vfat_part}" || exit 1
# Format boot
echo "Formatting ${BOOT_PART_TYPE} ${boot_part}..."
"mkfs.${BOOT_PART_TYPE}" -n "boot" -F 32 "${boot_part}" || exit 1
# Format extfs
echo "Formatting ExtFS ${ext_part}..."
mkfs.ext3 -L "Sabayon" "${ext_part}" || exit 1
echo "Formatting ${ROOT_PART_TYPE} ${root_part}..."
"mkfs.${ROOT_PART_TYPE}" -L "Sabayon" "${root_part}" || exit 1
boot_tmp_dir=$(mktemp -d)
if [[ -z "${boot_tmp_dir}" ]]; then
echo "Cannot create temporary dir (boot)"
exit 1
fi
chmod 755 "${boot_tmp_dir}" || exit 1
tmp_dir=$(mktemp -d)
if [[ -z "${tmp_dir}" ]]; then
@ -132,13 +146,12 @@ chmod 755 "${tmp_dir}" || exit 1
sleep 2
sync
echo "Setting up the boot directory content, mounting on ${tmp_dir}"
mount "${vfat_part}" "${tmp_dir}"
cp -R "${BOOT_DIR}"/* "${tmp_dir}"/ || exit 1
umount "${tmp_dir}" || exit 1
echo "Setting up the boot directory content, mounting on ${boot_tmp_dir}"
mount "${boot_part}" "${boot_tmp_dir}"
cp -R "${BOOT_DIR}"/* "${boot_tmp_dir}"/ || exit 1
echo "Setting up the extfs directory content, mounting on ${tmp_dir}"
mount "${ext_part}" "${tmp_dir}"
mount "${root_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
@ -229,6 +242,14 @@ if [ -n "${RELEASE_FILE}" ]; then
echo "${RELEASE_STRING} ${RELEASE_VERSION} ${RELEASE_DESC}" > "${release_file}"
fi
# BOOT_PART_TYPE_INSIDE_ROOT
if [ -n "${BOOT_PART_TYPE_INSIDE_ROOT}" ]; then
echo "Copying data from ${tmp_dir}/boot to ${boot_tmp_dir} as requested..."
cp -Rp "${tmp_dir}/boot/*" "${boot_tmp_dir}/" || exit 1
fi
umount "${boot_tmp_dir}" || exit 1
if [ -n "${DESTINATION_IMAGE_DIR}" ] && [ "${MAKE_TARBALL}" = "1" ]; then
# Create the rootfs tarball
ROOTFS_TARBALL="${DESTINATION_IMAGE_DIR}/${IMAGE_NAME}.rootfs.tar.xz"

View File

@ -0,0 +1,111 @@
#!/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
setup_displaymanager() {
# determine what is the login manager
if [ -n "$(equo match --installed gnome-base/gdm -qv)" ]; then
sed -i 's/DISPLAYMANAGER=".*"/DISPLAYMANAGER="gdm"/g' /etc/conf.d/xdm
elif [ -n "$(equo match --installed lxde-base/lxdm -qv)" ]; then
sed -i 's/DISPLAYMANAGER=".*"/DISPLAYMANAGER="lxdm"/g' /etc/conf.d/xdm
elif [ -n "$(equo match --installed kde-base/kdm -qv)" ]; then
sed -i 's/DISPLAYMANAGER=".*"/DISPLAYMANAGER="kdm"/g' /etc/conf.d/xdm
else
sed -i 's/DISPLAYMANAGER=".*"/DISPLAYMANAGER="xdm"/g' /etc/conf.d/xdm
fi
}
setup_desktop_environment() {
if [ -f "/usr/share/xsessions/LXDE.desktop" ]; then
echo "[Desktop]" > /etc/skel/.dmrc
echo "Session=LXDE" >> /etc/skel/.dmrc
elif [ -n "/usr/share/xsessions/xfce.desktop" ]; then
echo "[Desktop]" > /etc/skel/.dmrc
echo "Session=xfce" >> /etc/skel/.dmrc
else
# Fluxbox is always there
echo "[Desktop]" > /etc/skel/.dmrc
echo "Session=fluxbox" >> /etc/skel/.dmrc
fi
}
setup_boot() {
# enable sshd by default
rc-update add sshd default
# enable logger by default
rc-update add syslog-ng boot
rc-update add vixie-cron boot
# enable dbus, of course, and also NetworkManager
rc-update add dbus boot
rc-update add NetworkManager default
rc-update del net.eth0 default
# start X.Org by default
rc-update add xdm default
# select the first available kernel
eselect uimage set 1
# cleaning up deps
rc-update --update
}
setup_startup_caches() {
mount -t proc proc /proc
/lib/rc/bin/rc-depend -u
# Generate openrc cache
touch /lib/rc/init.d/softlevel
/etc/init.d/savecache start
/etc/init.d/savecache zap
ldconfig
ldconfig
umount /proc
}
setup_users() {
# setup root password to... root!
echo root:root | chpasswd
# setup normal user "sabayon"
(
if [ ! -x "/sbin/sabayon-functions.sh" ]; then
echo "no /sbin/sabayon-functions.sh found"
exit 1
fi
. /sbin/sabayon-functions.sh
sabayon_setup_live_user "sabayon" || exit 1
# setup "sabayon" password to... sabayon!
echo "sabayon:sabayon" | chpasswd
# also add "sabayon" to disk group
usermod -a -G disk sabayon
)
}
setup_serial() {
# setup serial login
echo "s0:12345:respawn:/sbin/agetty 115200 ttymxc0 vt100" >> /etc/inittab
echo "ttymxc0" >> /etc/securetty
}
setup_fstab() {
# add /dev/mmcblk0p1 to /etc/fstab
local boot_part_type="${BOOT_PART_TYPE:-ext3}"
echo "/dev/mmcblk0p1 /boot ${boot_part_type} defaults 0 1" >> /etc/fstab
}
setup_displaymanager
setup_desktop_environment
setup_users
setup_boot
setup_serial
setup_fstab
setup_startup_caches
exit 0