add support for ox820 devices

This commit is contained in:
Mario Fetka 2012-12-22 10:15:25 +01:00
parent 658f09c066
commit 7dad20c4b5
31 changed files with 934 additions and 6 deletions

View File

@ -0,0 +1,83 @@
Hi, welcome to Sabayon for the BeagleBoard xM.
First of all, you may want to install the image into a new SDHC card.
Make sure to have enough space for it, for example, if you downloaded
the 4GB version, make sure you're using a 4GB SDHC stick.
Other requirements:
-------------------
- a Linux distro to copy the image to the SDHC
- a SDHC reader
- a root shell on the Linux distro
How to burn the image:
----------------------
Insert the SDHC memory into your reader (make sure that the LOCK
switch is turned off). After a few seconds, type:
# dmesg | tail -n 10
In the last kernel message lines you will be able to read the
actual device name, might be something like "sdc" or in general
"sdX" where X is just a letter.
Make sure to see the same device name inside /dev directory.
Once you got the name, just dump the image into that, in this
example, we assume that the device is /dev/sdc and the image
name is "Sabayon_Linux_8_armv7a_BeagleBoard_xM_4GB.img".
Do this as root!
# xzcat Sabayon_Linux_8_armv7a_BeagleBoard_xM_4GB.img > /dev/sdd
Once it is done, check for any error using:
# dmesg | tail -n 10
And if it's all good, type:
# sync; sync; sync
To make sure everything has been flushed to the device.
At this point, extract your SDHC and place it into the BeagleBoard xM.
You're set!
How to change keyboard mapping:
-------------------------------
Our images come with "keyboard-setup", a shell too that lets you easily
do this, just type:
# keyboard-setup "<your keyboard layout code>" all
Then reboot!
How to change language:
-----------------------
Open /etc/locale.gen and add your locale (you can find a full list
at: /usr/share/i18n/SUPPORTED).
Make sure to add UTF-8 locales, this is what we support.
Once you've added your line, just type:
# language-setup "<your locale, without the .UTF-8 part>" system
Then reboot!
You want to know more?
----------------------
Just go to http://www.sabayon.org and to http://wiki.sabayon.org
and search for "BeagleBoard".
We're full of guides.
Contact
-------
Just mail us at website@sabayon.org if you need any help or register
to our mailing list at http://lists.sabayon.org/cgi-bin/mailman/listinfo/devel

47
boot/arm/usb_key_func Executable file
View File

@ -0,0 +1,47 @@
# usb key funct taken from Medion live and adapted for buffalo
# modified by Mario Fetka (geos_one) <mario.fetka@gmail.com>
Exe_USB_KEY()
{
# Check model name
export MODEL_NAME="@@NASKERNELNAME@@"
# Scan USB disk for HW test.
any_usb=`ls /sys/block/ | grep sd`
echo "${any_usb}"
if [ -n "${any_usb}" ]; then
#/bin/mkdir /mnt/parnerkey
for usb in ${any_usb}
do
echo "checking ${usb}"
#Get the number of question marks
qmark_num=`fdisk -l /dev/${usb} | grep "^"/dev/${usb} | grep -c "?"`
partition_num=`fdisk -l /dev/${usb} | grep "^"/dev/${usb}`
if [ "${qmark_num}" == "4" ] || [ "${partition_num}" == "" ]; then
mnt_point=/dev/${usb}
echo "Trying to mount ${mnt_point}"
mount -o iocharset=utf8,shortname=mixed,ro ${mnt_point} /mnt/parnerkey
else
mnt_point=`fdisk -l /dev/${usb} | grep "^"/dev/${usb} | awk '{print $1}' | sed -n '1p'`
echo "Trying to mount ${mnt_point}"
mount -o iocharset=utf8,shortname=mixed,ro ${mnt_point} /mnt/parnerkey
fi
mount_SUC=`cat /proc/mounts | grep /mnt/parnerkey`
if [ "${mount_SUC}" != "" ]; then
if [ -e /mnt/parnerkey/${MODEL_NAME}_check_file ]; then
#/mnt/parnerkey/usb_key_func.sh
script_path=`cat /mnt/parnerkey/${MODEL_NAME}_check_file | sed -n '1p'`
${script_path}
if [ $? == 0 ]; then
exit 0
fi
fi
umount /mnt/parnerkey
else
echo "Fail to mount ${mnt_point}"
fi
done
#rmdir /mnt/parnerkey
fi
}

View File

@ -0,0 +1,134 @@
# Define an alternative execution strategy, in this case, the value must be
execution_strategy: chroot_to_mmc
# Prefix command to add to chroot calls, when on x86_64 and touching a i686
# chroot, set it to "linux32"
# prechroot:
# Outer source chroot script. It's executed before entering the source_chroot.
# This is the very first thing molecule does. You can use it to setup
# packages cache.
# Variables exported:
# IMAGE_NAME = name of the final MMC image
# DESTINATION_IMAGE_DIR = path to the destination image directory
# CHROOT_DIR = path pointing to the chroot
# outer_source_chroot_script: /some/path.sh
# Inner source chroot script. Called from inside the source_chroot.
# Can be used to spawn package updates inside the chroot.
# inner_source_chroot_script: /sabayon/scripts/inner_source_chroot_update.sh
# Outer source chroot script, executed after inner_source_chroot_script.
# Can be used to unload resources allocated by outer_source_chroot_script.
# Variables exported:
# IMAGE_NAME = name of the final MMC image
# DESTINATION_IMAGE_DIR = path to the destination image directory
# CHROOT_DIR = path pointing to the chroot
# outer_source_chroot_script_after: /some/path.sh
# Error script command, executed when something went wrong and molecule has
# to terminate the execution
# error_script: /path/to/some/error_script.sh
# Pre-image building script. Hook called before image file creation
# IMAGE_NAME = name of the final MMC image
# DESTINATION_IMAGE_DIR = path to the destination image directory
# CHROOT_DIR = path pointing to the chroot
# %env pre_image_script: ${SABAYON_MOLECULE_HOME:-/sabayon}/scripts/pre_image_script.sh
# Post-image building script. Hook called after image file creation and move
# into destination directory.
# Variables exported:
# IMAGE_NAME = name of the final MMC image
# DESTINATION_IMAGE_DIR = path to the destination image directory
# CHROOT_DIR = path pointing to the chroot
# IMAGE_PATH = path pointing to the destination image file
# IMAGE_CHECKSUM_PATH = path pointing to the destination image file checksum (md5)
%env post_image_script: ${SABAYON_MOLECULE_HOME:-/sabayon}/scripts/post_mmc_image_script.sh
# Destination directory for the image path (MANDATORY)
%env destination_image_directory: ${SABAYON_MOLECULE_HOME:-/sabayon}/images
# Path to source chroot (mandatory)
%env source_chroot: ${SABAYON_MOLECULE_HOME:-/sabayon}/sources/image-0-armv6j
# Release file that will be created onto the root filesystem
release_file: /etc/sablink-edition
# Release string (the actual distro name)
release_string: SabLink Linux
# Directories to remove completely (comma separated)
paths_to_remove:
/var/lib/entropy/client/database/*/sabayon*,
/root/.subversion,
/lib/udev-state/devices.tar.bz2,
/var/log/scrollkeeper.log, /var/log/genkernel.log,
/var/log/emerge.log, /usr/tmp/portage/*,
/root/.bash_history,
/usr/share/slocate/slocate.db,
/root/test-results.txt,
/root/test.sh,
/usr/portage/distfiles/*,
/usr/portage/packages/*,
/root/.revdep*,
/install-data/games/*,
/var/lib/entropy/store/*,
/var/log/entropy/*,
/var/lib/entropy/caches/*,
/var/lib/entropy/smartapps/*/*,
/var/lib/entropy/smartapps/*/*,
/var/lib/entropy/tmp/*,
/var/tmp/entropy/*,
/*.txt,
/usr/portage/a*,
/usr/portage/b*,
/usr/portage/c*,
/usr/portage/d*,
/usr/portage/e*,
/usr/portage/f*,
/usr/portage/g*,
/usr/portage/h*,
/usr/portage/i*,
/usr/portage/j*,
/usr/portage/k*,
/usr/portage/licenses,
/usr/portage/lxde*,
/usr/portage/m*,
/usr/portage/n*,
/usr/portage/o*,
/usr/portage/packages,
/usr/portage/pe*,
/usr/portage/q*,
/usr/portage/r*,
/usr/portage/s*,
/usr/portage/t*,
/usr/portage/u*,
/usr/portage/v*,
/usr/portage/w*,
/usr/portage/x*,
/usr/portage/y*,
/usr/portage/z*,
/etc/ssh/ssh_host_*,
/entropy,
/tmp/equoerror.txt,
/var/cache/man,
/var/lib/entropy/glsa/*,
/root/local,
/var/tmp/*,
/root/.ssh,
/root/.distcc,
/etc/distcc/.ssh
# Directories to empty (comma separated)
paths_to_empty:
/home/sablinkuser/.thumbnails/,
/root/.ccache,
/var/tmp/portage,
/var/tmp/ccache,
/var/tmp/portage-pkg,
/var/tmp/binpkgs,
/var/lib/entropy/portage,
/var/lib/entropy/logs,
/var/lib/layman,
/var/cache/genkernel

View File

@ -0,0 +1,25 @@
# List of packages to add on the Medion STG-212
packages_to_add:
app-admin/eselect-uimage,
app-admin/syslog-ng,
app-admin/sudo,
app-misc/sablink-core,
media-fonts/ttf-bitstream-vera,
media-fonts/dejavu,
media-fonts/corefonts,
net-misc/ntp,
sys-apps/keyboard-configuration-helpers,
sys-apps/language-configuration-helpers,
sys-apps/blstools,
sys-apps/gptfdisk,
sys-auth/consolekit,
sys-block/parted,
sys-fs/btrfs-progs,
sys-fs/ntfs3g,
sys-fs/jfsutils,
sys-kernel/linux-medion_stg212,
sys-process/vixie-cron
# List of packages to remove from the Medion STG-212
packages_to_remove:

View File

@ -1,4 +1,4 @@
%env %import ${SABAYON_MOLECULE_HOME:-/sabayon}/molecules/armel-base.common %env %import ${SABAYON_MOLECULE_HOME:-/sabayon}/molecules/armelv5-base.common
%env %import ${SABAYON_MOLECULE_HOME:-/sabayon}/molecules/buffalo_kb_pro.common %env %import ${SABAYON_MOLECULE_HOME:-/sabayon}/molecules/buffalo_kb_pro.common
# Release desc (the actual release description) # Release desc (the actual release description)

View File

@ -1,4 +1,4 @@
%env %import ${SABAYON_MOLECULE_HOME:-/sabayon}/molecules/armel-base.common %env %import ${SABAYON_MOLECULE_HOME:-/sabayon}/molecules/armelv5-base.common
%env %import ${SABAYON_MOLECULE_HOME:-/sabayon}/molecules/buffalo_ls_chlv2.common %env %import ${SABAYON_MOLECULE_HOME:-/sabayon}/molecules/buffalo_ls_chlv2.common
# Release desc (the actual release description) # Release desc (the actual release description)

View File

@ -1,4 +1,4 @@
%env %import ${SABAYON_MOLECULE_HOME:-/sabayon}/molecules/armel-base.common %env %import ${SABAYON_MOLECULE_HOME:-/sabayon}/molecules/armelv5-base.common
%env %import ${SABAYON_MOLECULE_HOME:-/sabayon}/molecules/buffalo_ls_pro_live.common %env %import ${SABAYON_MOLECULE_HOME:-/sabayon}/molecules/buffalo_ls_pro_live.common
# Release desc (the actual release description) # Release desc (the actual release description)

View File

@ -1,4 +1,4 @@
%env %import ${SABAYON_MOLECULE_HOME:-/sabayon}/molecules/armel-base.common %env %import ${SABAYON_MOLECULE_HOME:-/sabayon}/molecules/armelv5-base.common
%env %import ${SABAYON_MOLECULE_HOME:-/sabayon}/molecules/buffalo_ls_xhl.common %env %import ${SABAYON_MOLECULE_HOME:-/sabayon}/molecules/buffalo_ls_xhl.common
# Release desc (the actual release description) # Release desc (the actual release description)

View File

@ -0,0 +1,24 @@
%env %import ${SABAYON_MOLECULE_HOME:-/sabayon}/molecules/armelv6-base.common
%env %import ${SABAYON_MOLECULE_HOME:-/sabayon}/molecules/medion_stg212.common
# Release desc (the actual release description)
release_desc: armelv6j Medion STG-212
# Release Version (used to generate release_file)
release_version: 0
# Specify image file name (image file name will be automatically
# produced otherwise)
image_name: SabLink_Linux_0_armelv6j_medion_stg212_20GB.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: 20000
# Path to boot partition data (MLO, u-boot.img etc)
%env source_boot_directory: ${SABAYON_MOLECULE_HOME:-/sabayon}/boot/arm/medion_stg212
# External script that will generate the image file.
# The same can be copied onto a MMC by using dd
%env image_generator_script: ${SABAYON_MOLECULE_HOME:-/sabayon}/scripts/medion_stg212_image_generator_script.sh

View File

@ -6,4 +6,4 @@ export SABAYON_MOLECULE_HOME
# rootfs and bootfs tarball is generated by beaglebone image # rootfs and bootfs tarball is generated by beaglebone image
export MAKE_TARBALL="0" export MAKE_TARBALL="0"
exec "${SABAYON_MOLECULE_HOME}"/scripts/mkloopgptdisk.sh "${SABAYON_MOLECULE_HOME}"/scripts/mkloopgptdisk_buffalo_ls_xhl_chroot_hook.sh "$@" exec "${SABAYON_MOLECULE_HOME}"/scripts/mkloopgptdisk.sh "${SABAYON_MOLECULE_HOME}"/scripts/mkloopgptdisk_buffalo_ls_chlv2_chroot_hook.sh "$@"

View File

@ -6,4 +6,4 @@ export SABAYON_MOLECULE_HOME
# rootfs and bootfs tarball is generated by beaglebone image # rootfs and bootfs tarball is generated by beaglebone image
export MAKE_TARBALL="0" export MAKE_TARBALL="0"
exec "${SABAYON_MOLECULE_HOME}"/scripts/mkloopgptdisk.sh "${SABAYON_MOLECULE_HOME}"/scripts/mkloopgptdisk_buffalo_ls_xhl_chroot_hook.sh "$@" exec "${SABAYON_MOLECULE_HOME}"/scripts/mkloopgptdisk-oxnas.sh "${SABAYON_MOLECULE_HOME}"/scripts/mkloopgptdisk_buffalo_ls_xhl_chroot_hook.sh "$@"

View File

@ -0,0 +1,9 @@
#!/bin/sh
# Path to molecules.git dir
SABAYON_MOLECULE_HOME="${SABAYON_MOLECULE_HOME:-/sabayon}"
export SABAYON_MOLECULE_HOME
# rootfs and bootfs tarball is generated by beaglebone image
export MAKE_TARBALL="0"
exec "${SABAYON_MOLECULE_HOME}"/scripts/mkloopgptdisk-oxnas.sh "${SABAYON_MOLECULE_HOME}"/scripts/mkloopgptdisk_medion_stg212_chroot_hook.sh "$@"

301
scripts/mkloopgptdisk-oxnas.sh Executable file
View File

@ -0,0 +1,301 @@
#! /bin/sh
# (c) Copyright 2012 Fabio Erculiani <lxnay@sabayon.org>
# Licensed under terms of GPLv2
env-update
. /etc/profile
export LC_ALL=en_US.UTF-8
# Path to molecules.git dir
SABAYON_MOLECULE_HOME="${SABAYON_MOLECULE_HOME:-/sabayon}"
export SABAYON_MOLECULE_HOME
# Expected env variables:
# PATHS_TO_REMOVE = ";" separated list of paths to rm -rf
# PATHS_TO_EMPTY = ";" separated list of paths to rm -rf (keeping the dir)
# RELEASE_STRING
# RELEASE_VERSION
# RELEASE_DESC
# RELEASE_FILE
# IMAGE_NAME
# DESTINATION_IMAGE_DIR
# PACKAGES_TO_ADD
# PACKAGES_TO_REMOVE
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
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}"
# Boot partition type
BOOT_PART_TYPE="${BOOT_PART_TYPE:-ext2}"
BOOT_PART_TYPE_GPT="${BOOT_PART_TYPE_GPT:-8300}"
BOOT_PART_MKFS_ARGS="${BOOT_PART_MKFS_ARGS:--L Boot -I 128}"
# Root partition type
ROOT_PART_TYPE="${ROOT_PART_TYPE:-btrfs}"
ROOT_PART_MKFS_ARGS="${ROOT_PART_MKFS_ARGS:--L SabLink}"
# Swap partiton arguments
SWAP_PART_MKFS_ARGS="${SWAP_PART_MKFS_ARGS:--L Swap}"
# Copy /boot content from Root partition to Boot partition?
BOOT_PART_TYPE_INSIDE_ROOT="${BOOT_PART_TYPE_INSIDE_ROOT:-1}"
cleanup_loopbacks() {
cd /
sync
sync
sleep 5
sync
[[ -n "${tmp_file}" ]] && rm "${tmp_file}" 2> /dev/null
[[ -n "${tmp_dir}" ]] && { umount "${tmp_dir}/proc" &> /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 "${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_MOLECULE_HOME}"/scripts/mmc_remaster_post.sh
}
trap "cleanup_loopbacks" 1 2 3 6 9 14 15 EXIT
# Erase the file
echo "Generating the empty image file at ${FILE}"
dd if=/dev/zero of="${FILE}" bs=1024000 count="${SIZE}"
[[ "$?" != "0" ]] && exit 1
echo "Configured the loopback partition at ${FILE}"
echo "Adding the Stage1 loader the proper Das uBoot and the ext2load uEnv to ${FILE}"
pushd "${SABAYON_MOLECULE_HOME}"/scripts/oxnas/
./disc_create ${FILE}
popd
# Calculate size using fdisk
SIZE=$(sgdisk -p "${FILE}" | grep First | awk '{print $10}')
# Magic first partition size, given 300MB below
BOOTSIZE="616447"
BOOTOFFSET="2048"
SWAPSIZE="4194304"
echo "Disk size : ${SIZE} Sectors"
echo "Disk sectors : ${SECTORS}"
echo "Magic size : Sector ${BOOTSIZE} (boot part size 300MB)"
echo "Start offset : Sector ${BOOTOFFSET}"
# this will create a first partition that is 300MB long
# Starts at sect 2048, ends at sect 616447, each sector is 512bytes
sgdisk -n 1:${BOOTOFFSET}:${BOOTSIZE} -t 1:${BOOT_PART_TYPE_GPT} ${FILE}
# Start of Root is 1 sector after the Boot Part
ROOTOFFSET=$((BOOTSIZE+1))
# Swap starts 2GB bevore end of Disk
SWAPOFFSET=$((SIZE-SWAPSIZE))
# root ends 1 sector before swap starts
ROOTSIZE=$((SWAPOFFSET-1))
sgdisk -n 2:${ROOTOFFSET}:${ROOTSIZE} -t 2:${BOOT_PART_TYPE_GPT} ${FILE}
sgdisk -n 3:${SWAPOFFSET}:${SIZE} -t 3:8200 ${FILE}
echo "create compatibility hybrid MBR"
# sgdisk still not support the possibility to make the ee part non 1
echo "r
h
1
n
83
y
n
w
y" | gdisk ${FILE}
sleep 2
sgdisk -p "${FILE}"
# each sector has 512bytes
LOOPDEVICE=$(kpartx -v -l "${FILE}" | grep deleted | awk '{print $4}')
echo "Loop Device ${LOOPDEVICE}"
LOOPNAME=${LOOPDEVICE##*/}
echo "Loop Device Name ${LOOPNAME}"
echo "Create loop devces"
# Get two loopback devices first
part=$(kpartx -v -a "${FILE}")
if [ -z "${part}" ]; then
echo "Cannot setup the partitions loopbacks"
exit 1
fi
boot_part="/dev/mapper/${LOOPNAME}p1"
root_part="/dev/mapper/${LOOPNAME}p2"
swap_part="/dev/mapper/${LOOPNAME}p3"
echo "Boot Partiton at : ${boot_part}"
echo "Root Partition at : ${root_part}"
# Format boot
echo "Formatting ${BOOT_PART_TYPE} ${boot_part}..."
"mkfs.${BOOT_PART_TYPE}" ${BOOT_PART_MKFS_ARGS} "${boot_part}" || exit 1
# Format extfs
echo "Formatting ${ROOT_PART_TYPE} ${root_part}..."
"mkfs.${ROOT_PART_TYPE}" ${ROOT_PART_MKFS_ARGS} "${root_part}" || exit 1
# Format swap
echo "Formatting swap ${swap_part}..."
"mkswap" ${SWAP_PART_MKFS_ARGS} "${swap_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
echo "Cannot create temporary dir"
exit 1
fi
chmod 755 "${tmp_dir}" || exit 1
sleep 2
sync
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 "${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
CHROOT_DIR="${tmp_dir}" "${SABAYON_MOLECULE_HOME}"/scripts/remaster_pre.sh || exit 1
# Configure 00-board-setup.start
source_board_setup="${SABAYON_MOLECULE_HOME}/boot/arm_startup/00-board-setup.start"
dest_board_setup="${CHROOT_DIR}/etc/local.d/00-board-setup.start"
if [ -f "${source_board_setup}" ]; then
echo "Setting up ${dest_board_setup}"
cp "${source_board_setup}" "${dest_board_setup}" || exit 1
chmod 755 "${dest_board_setup}" || exit 1
chown root:root "${dest_board_setup}" || exit 1
fi
# execute PACKAGES_TO_ADD and PACKAGES_TO_REMOVE
export ETP_NONINTERACTIVE=1
# Entropy doesn't like non-UTF locale encodings
export LC_ALL=en_US.UTF-8
# do I have to run "equo update?"
# If we are running outside the DAILY scope, it's
# better to do it here. If instead we're doing a
# DAILY, this is already done by other scripts.
if [ -z "$(basename ${IMAGE_NAME} | grep DAILY)" ]; then
FORCE_EAPI=2 chroot "${tmp_dir}" equo update || \
FORCE_EAPI=2 chroot "${tmp_dir}" equo update || \
exit 1
fi
if [ -n "${PACKAGES_TO_ADD}" ]; then
add_cmd="equo install ${PACKAGES_TO_ADD}"
chroot "${tmp_dir}" ${add_cmd} || exit 1
fi
if [ -n "${PACKAGES_TO_REMOVE}" ]; then
rem_cmd="equo remove ${PACKAGES_TO_REMOVE}"
chroot "${tmp_dir}" ${rem_cmd} || exit 1
fi
# 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}"
CHROOT_DIR="${tmp_dir}" "${SABAYON_MOLECULE_HOME}"/scripts/mmc_remaster_post.sh
# execute final cleanup of entropy stuff
chroot "${tmp_dir}" equo rescue vacuum
# setup sudoers, enable wheel group
if [ -f "${tmp_dir}/etc/sudoers" ]; then
echo "# added by Sabayon Molecule" >> "${tmp_dir}/etc/sudoers"
echo "%wheel ALL=ALL" >> "${tmp_dir}/etc/sudoers"
fi
export LC_ALL=C
# work out paths to empty and paths to remove
if [ -n "${PATHS_TO_REMOVE}" ]; then
set -f
for path in $(echo ${PATHS_TO_REMOVE} | tr ";" "\n"); do
echo "Removing: ${path}"
set +f
rm -rf "${tmp_dir}"/${path}
set -f
done
set +f
fi
if [ -n "${PATHS_TO_EMPTY}" ]; then
set -f
for path in $(echo ${PATHS_TO_EMPTY} | tr ";" "\n"); do
set +f
echo "Emptying: ${path}"
rm -rf "${tmp_dir}"/"${path}"/*
set -f
done
set +f
fi
if [ -n "${RELEASE_FILE}" ]; then
release_file="${tmp_dir}"/"${RELEASE_FILE}"
release_dir=$(dirname "${release_file}")
[[ ! -d "${release_dir}" ]] && { mkdir -p "${release_dir}" || exit 1; }
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"
echo "Creating the roofs tarball: ${ROOTFS_TARBALL}"
tmp_file=$(mktemp --suffix=.tar.xz)
[[ -z "${tmp_file}" ]] && exit 1
cd "${tmp_dir}" || exit 1
tar --numeric-owner --preserve-permissions --same-owner -cJf "${tmp_file}" ./ || exit 1
mv "${tmp_file}" "${ROOTFS_TARBALL}" || exit 1
chmod 644 "${ROOTFS_TARBALL}" || exit 1
cd "$(dirname "${ROOTFS_TARBALL}")" || exit 1
md5sum "$(basename "${ROOTFS_TARBALL}")" > "$(basename "${ROOTFS_TARBALL}")".md5
fi
umount "${tmp_dir}" || exit 1
cleanup_loopbacks
kpartx -v -d "${FILE}"
kpartx -v -d "${FILE}"
echo "Your GPT Disk image \"${FILE}\" is ready"

View File

@ -0,0 +1,105 @@
#!/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_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
# Linkstation Pro/Live Deamon
rc-update add ntp-client default
rc-update add ntpd default
# enable dbus, of course, and also NetworkManager
rc-update add dbus boot
# we are on eth0 in the Medion STG-212 so create the init.d link
ln -sf net.lo /etc/init.d/net.eth0
rc-update add net.eth0 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
[[ -d "/lib/rc/init.d" ]] && touch /lib/rc/init.d/softlevel
[[ -d "/run/openrc" ]] && touch /run/openrc/softlevel
/etc/init.d/savecache start
/etc/init.d/savecache zap
ldconfig
ldconfig
umount /proc
}
setup_users() {
# setup root password to... root!
echo root:sablink | chpasswd
}
setup_serial() {
# setup serial login
sed -i "s:^s0.*::" /etc/inittab
echo "s0:12345:respawn:/sbin/agetty 115200 ttyS0 vt100" >> /etc/inittab
}
setup_fallback_network() {
# setup fallback network
echo "" >> /etc/conf.d/net
echo "" >> /etc/conf.d/net
echo "# Sablink Core Network Config" >> /etc/conf.d/net
echo "#" >> /etc/conf.d/net
echo "# DHCP IP / route configuration, with fallback to a static IP / route" >> /etc/conf.d/net
echo "#" >> /etc/conf.d/net
echo "" >> /etc/conf.d/net
echo "config_eth0=\"dhcp\"" >> /etc/conf.d/net
echo "fallback_eth0=\"192.168.178.103 netmask 255.255.255.0 broadcast 192.168.178.255\"" >> /etc/conf.d/net
echo "fallback_route_eth0=\"default via 192.168.178.1\"" >> /etc/conf.d/net
echo "" >> /etc/conf.d/net
echo "" >> /etc/conf.d/net
echo "#" >> /etc/conf.d/net
echo "# pure static IP / route configuration, should the above not work even with fallback.." >> /etc/conf.d/net
echo "# (in that case, comment the whole DHCP section and uncomment this one)" >> /etc/conf.d/net
echo "#" >> /etc/conf.d/net
echo "" >> /etc/conf.d/net
echo "#config_eth0=\"192.168.11.3 netmask 255.255.255.0 broadcast 192.168.11.255\"" >> /etc/conf.d/net
echo "#routes_eth0=\"default via 192.168.11.1\"" >> /etc/conf.d/net
echo "" >> /etc/conf.d/net
echo "" >> /etc/conf.d/net
echo "" >> /etc/conf.d/net
echo "#" >> /etc/conf.d/net
echo "# DNS configuration" >> /etc/conf.d/net
echo "#" >> /etc/conf.d/net
echo "" >> /etc/conf.d/net
echo "dns_servers_eth0=\"192.168.178.1\"" >> /etc/conf.d/net
}
setup_fstab() {
sed -e "s!/BOOT!/sda1!g" -e "s!/ROOT!/sda2!g" -e "s!SWAP!sda3!g" -e "s!ext3!btrfs!g" -i /etc/fstab
}
setup_layman() {
sed -e "s!/source!/#source!g" -i /etc/make.conf
}
setup_users
setup_boot
setup_serial
setup_startup_caches
setup_fallback_network
setup_fstab
setup_layman
exit 0

47
scripts/oxnas/disk_create Executable file
View File

@ -0,0 +1,47 @@
#!/bin/sh
[ "x$1" == "x"] && {
echo "Usage: $0 hard-disk-device"
exit 1
}
# uncomment line below and set to the correct disk
disk=$1
workarea="."
stage1File=$workarea/stage1.wrapped
ubootFile=$workarea/u-boot.wrapped
ubootenvFile=$workarea/u-boot.env
perl <<EOF | dd of="$disk" bs=512
print "\x00" x 0x1a4;
print "\x00\x5f\x01\x00";
print "\x00\xdf\x00\x00";
print "\x00\x80\x00\x00";
print "\x00" x (0x1b0 -0x1a4 -12 );
print "\x22\x80\x00\x00";
print "\x22\x00\x00\x00";
print "\x00\x80\x00\x00";
EOF
if [ -f $stage1File ];then
echo "Writing stage 1"
dd if=$stage1File of="$disk" bs=512 seek=34
fi
if [ -f $ubootFile ];then
echo "Writing uboot"
dd if=$ubootFile of="$disk" bs=512 seek=154
fi
echo "Generating uboot env"
pushd $workarea/u-boot-env
./creatext2loadenv.sh
popd
if [ -f $ubootenvFile ];then
echo "Writing uboot env"
dd if=$ubootenvFile of="$disk" bs=512 seek=558
fi

View File

@ -0,0 +1 @@
stage1/stage1.wrapped850

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,34 @@
#!/bin/sh
echo "Generating U-Boot Environment"
echo -en "\0\0\0\0" >uboot.env
echo -en "bootargs=mac_adr=0x00,0xd0,0xb8,0x19,0x81,0xfb\0" >>uboot.env
echo -en "baudrate=115200\0" >>uboot.env
echo -en "loads_echo=0\0" >>uboot.env
echo -en "rootpath=/nfs/arm\0" >>uboot.env
echo -en "ethact=egiga0\0" >>uboot.env
echo -en "ethaddr=00:16:01:41:4E:2B\0" >>uboot.env
echo -en "ipaddr=192.168.11.150\0" >>uboot.env
echo -en "serverip=192.168.11.1\0" >>uboot.env
echo -en "stdin=serial\0" >>uboot.env
echo -en "stdout=serial\0" >>uboot.env
echo -en "stderr=serial\0" >>uboot.env
echo -en "ethprime=egiga0\0" >>uboot.env
echo -en "initrd=uInitrd\0" >>uboot.env
echo -en "kernel=uImage\0" >>uboot.env
echo -en "bootargs_base=console=ttyS0,115200\0" >>uboot.env
echo -en "bootargs_root=root=/dev/sda2 rw\0" >>uboot.env
echo -en "def_tftp=tftp 0x60100000 \${kernel};tftp 0x60800000 \${initrd};setenv bootargs_new \${bootargs};setenv bootargs \${bootargs_base} \${bootargs_root} \${bootargs_new} tftpboot=yes;bootm 0x60100000 0x60800000\0" >>uboot.env
echo -en "bootdelay=3\0" >>uboot.env
echo -en "force_tftp=1\0" >>uboot.env
echo -en "bootcmd=ide reset; ext2load ide 0:1 0x60100000 /\${kernel};ext2load ide 0:1 0x60800000 /\${initrd};setenv bootargs_new \${bootargs};setenv bootargs \${bootargs_base} \${bootargs_root} \${bootargs_new};bootm 0x60100000 0x60800000\0" >>uboot.env
echo -en "\0" >>uboot.env
if [ ! -e ./ubootcrc-8192bytes ] ; then
echo "Compiling CRC calculation tool"
gcc -o ubootcrc-8192bytes ubootcrc-8192bytes.c
fi
echo "Finalizing U-Boot Environment"
./ubootcrc-8192bytes <uboot.env >uboot.newenv
echo "uboot.newenv contains a valid environment for SATA disk"

View File

@ -0,0 +1,115 @@
#include <stdio.h>
#include <string.h>
#include <stdint.h>
/* ========================================================================
* Table of CRC-32's of all single-byte values (made by make_crc_table)
*/
const uint32_t crc_table[256] = {
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
0x2d02ef8dL
};
/* ========================================================================= */
#define DO1(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8);
#define DO2(buf) DO1(buf); DO1(buf);
#define DO4(buf) DO2(buf); DO2(buf);
#define DO8(buf) DO4(buf); DO4(buf);
/* ========================================================================= */
uint32_t crc32(uint32_t crc, const uint8_t* buf, unsigned int len)
{
crc = crc ^ 0xffffffffL;
while (len >= 8)
{
DO8(buf);
len -= 8;
}
if (len) do {
DO1(buf);
} while (--len);
return crc ^ 0xffffffffL;
}
int main(int argc, char* argv[])
{
char data[8188];
uint32_t crc;
uint32_t oldcrc;
uint8_t crcdata[4];
memset(data, 0, sizeof(data));
if(1 != fread(crcdata, 4, 1, stdin))
{
return 3;
}
oldcrc = crcdata[0] | (crcdata[1] << 8) | (crcdata[2] << 16) | (crcdata[3] << 24);
if(0 >= fread(data, 1, 8188, stdin))
{
return 3;
}
crc = crc32(0, data, 8188);
fprintf(stderr, "CRC32: %08x\n", crc);
fprintf(stderr, "Env CRC32: %08x\n", oldcrc);
crcdata[0] = crc & 0xFF;
crcdata[1] = (crc >> 8) & 0xFF;
crcdata[2] = (crc >> 16) & 0xFF;
crcdata[3] = (crc >> 24) & 0xFF;
fwrite(crcdata, 1, 4, stdout);
fwrite(data, 1, 8188, stdout);
return 0;
}

1
scripts/oxnas/u-boot.env Symbolic link
View File

@ -0,0 +1 @@
u-boot-env/uboot.newenv

View File

@ -0,0 +1 @@
u-boot/u-boot.wrapped

Binary file not shown.

1
scripts/oxnas/uImage Symbolic link
View File

@ -0,0 +1 @@
uImages/uImage

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.