echo " --dmraid Include DMRAID support"
echo " --bootloader=grub Add new kernel to GRUB configuration"
echo " --linuxrc=<file> Specifies a user created linuxrc"
+ echo " --disklabel Include disk label and uuid support in your initrd"
echo " Internals"
echo " --arch-override=<arch> Force to arch instead of autodetect"
echo " --cachedir=<dir> Override the default cache location"
GENERATE_Z_IMAGE=1
print_info 2 "GENERATE_Z_IMAGE: $GENERATE_Z_IMAGE"
;;
+ --disklabel)
+ CMD_DISKLABEL=1
+ print_info 2 "CMD_DISKLABEL: $CMD_DISKLABEL"
+ ;;
all)
BUILD_KERNEL=1
BUILD_MODULES=1
fi
}
+compile_e2fsprogs() {
+ if [ ! -f "${BLKID_BINCACHE}" ]
+ then
+ [ ! -f "${E2FSPROGS_SRCTAR}" ] &&
+ gen_die "Could not find e2fsprogs source tarball: ${E2FSPROGS_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
+ cd "${TEMP}"
+ rm -rf "${E2FSPROGS_DIR}"
+ tar -zxpf "${E2FSPROGS_SRCTAR}"
+ [ ! -d "${E2FSPROGS_DIR}" ] &&
+ gen_die "e2fsprogs directory ${E2FSPROGS_DIR} invalid"
+ cd "${E2FSPROGS_DIR}"
+ print_info 1 'e2fsprogs: >> Configuring...'
+ ./configure --with-ldopts=-static >> ${DEBUGFILE} 2>&1 ||
+ gen_die 'Configuring e2fsprogs failed!'
+ print_info 1 'e2fsprogs: >> Compiling...'
+ MAKE=${UTILS_MAKE} compile_generic "" ""
+ print_info 1 'blkid: >> Copying to cache...'
+ [ -f "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ] ||
+ gen_die 'Blkid executable does not exist!'
+ strip "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ||
+ gen_die 'Could not strip blkid binary!'
+ bzip2 "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ||
+ gen_die 'bzip2 compression of blkid failed!'
+ mv "${TEMP}/${E2FSPROGS_DIR}/misc/blkid.bz2" "${BLKID_BINCACHE}" ||
+ gen_die 'Could not copy the blkid binary to the package directory, does the directory exist?'
+
+ cd "${TEMP}"
+ rm -rf "${E2FSPROGS_DIR}" > /dev/null
+ fi
+}
fi
fi
+
+ if isTrue "${CMD_DISKLABEL}"
+ then
+ DISKLABEL=1
+ else
+ DISKLABEL=0
+ fi
}
determine_real_args() {
DMRAID_BINCACHE=`cache_replace "${DMRAID_BINCACHE}"`
UNIONFS_BINCACHE=`cache_replace "${UNIONFS_BINCACHE}"`
UNIONFS_MODULES_BINCACHE=`cache_replace "${UNIONFS_MODULES_BINCACHE}"`
+ BLKID_BINCACHE=`cache_replace "${BLKID_BINCACHE}"`
DEFAULT_KERNEL_CONFIG=`arch_replace "${DEFAULT_KERNEL_CONFIG}"`
BUSYBOX_CONFIG=`arch_replace "${BUSYBOX_CONFIG}"`
DMRAID_BINCACHE=`arch_replace "${DMRAID_BINCACHE}"`
UNIONFS_BINCACHE=`arch_replace "${UNIONFS_BINCACHE}"`
UNIONFS_MODULES_BINCACHE=`arch_replace "${UNIONFS_MODULES_BINCACHE}"`
+ BLKID_BINCACHE=`arch_replace "${BLKID_BINCACHE}"`
if [ "${CMD_BOOTSPLASH}" != '' ]
then
rm -rf "${TEMP}/initramfs-udev-temp" > /dev/null
}
+create_blkid_cpio(){
+ if [ -d "${TEMP}/initramfs-blkid-temp" ]
+ then
+ rm -r "${TEMP}/initramfs-blkid-temp/"
+ fi
+ cd ${TEMP}
+ mkdir -p "${TEMP}/initramfs-blkid-temp/bin/"
+ [ "${DISKLABEL}" -eq '1' ] && { /bin/bzip2 -dc "${BLKID_BINCACHE}" > "${TEMP}/initramfs-blkid-temp/bin/blkid" ||
+ gen_die "Could not extract blkid binary cache!"; }
+ chmod a+x "${TEMP}/initramfs-blkid-temp/bin/blkid"
+ cd "${TEMP}/initramfs-blkid-temp/"
+ find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_DIR}/cpio/initramfs-blkid-${E2FSPROGS_VER}.cpio.gz
+ rm -rf "${TEMP}/initramfs-blkid-temp" > /dev/null
+}
+
create_devfs_cpio(){
if [ -d "${TEMP}/initramfs-devfs-temp" ]
then
then
MERGE_LIST="${MERGE_LIST} initramfs-udev-${UDEV_VER}.cpio.gz"
fi
+ if [ "${DISKLABEL}" -eq '1' -a -e ${CACHE_DIR}/cpio/initramfs-blkid-${E2FSPROGS_VER}.cpio.gz ]
+ then
+ MERGE_LIST="${MERGE_LIST} initramfs-blkid-${E2FSPROGS_VER}.cpio.gz"
+ fi
if [ "${UNIONFS}" -eq '1' -a -e ${CACHE_DIR}/cpio/initramfs-unionfs-${UNIONFS_VER}-tools.cpio.gz ]
then
MERGE_LIST="${MERGE_LIST} initramfs-unionfs-${UNIONFS_VER}-tools.cpio.gz"
print_info 1 "initramfs: Not copying modules..."
fi
+ if [ "${DISKLABEL}" -eq '1' ]
+ then
+ print_info 1 " >> Creating blkid cpio archive..."
+ create_blkid_cpio
+ fi
+
create_gensplash
if [ "${INITRAMFS_OVERLAY}" != '' ]
MAKEDEV std
MAKEDEV console
+ if [ "${DISKLABEL}" -eq '1' ]; then
+ cp "${BLKID_BINCACHE}" "${TEMP}/initrd-temp/bin/blkid.bz2" ||
+ gen_die 'Could not copy blkid from bincache!'
+ bunzip2 "${TEMP}/initrd-temp/bin/blkid.bz2" ||
+ gen_die 'Could not uncompress blkid!'
+ chmod +x "${TEMP}/initrd-temp/bin/blkid"
+ fi
+
cp "${BUSYBOX_BINCACHE}" "${TEMP}/initrd-temp/bin/busybox.bz2" ||
gen_die 'Could not copy busybox from bincache!'
bunzip2 "${TEMP}/initrd-temp/bin/busybox.bz2" ||
echo -ne "\033[0G\033[0K"
}
+strlen()
+{
+ if [ -z "$1" ]
+ then
+ echo "usage: strlen <variable_name>"
+ die
+ fi
+ eval echo "\${#${1}}"
+}
+
parse_opt() {
case "$1" in
*\=*)
- echo "$1" | cut -f2 -d=
+ local key_name="`echo "$1" | cut -f1 -d=`"
+ local key_len=`strlen key_name`
+ local value_start=$((key_len+2))
+ echo "$1" | cut -c ${value_start}-
;;
esac
}
do
while [ "${got_good_root}" != '1' ]
do
-
+ case "${REAL_ROOT}" in
+ LABEL\=*|UUID\=*)
+
+ ROOT_DEV=""
+ retval=1
+
+ if [ "${retval}" -ne '0' ]; then
+ ROOT_DEV=`findfs "${REAL_ROOT}" 2>/dev/null`
+ retval=$?
+ fi
+
+ if [ "$retval" -ne '0' ]; then
+ ROOT_DEV=`busybox findfs "${REAL_ROOT}" 2>/dev/null`
+ retval=$?
+ fi
+
+ if [ "${retval}" -ne '0' ]; then
+ ROOT_DEV=`blkid -t "${REAL_ROOT}" | cut -d ":" -f 1 2>/dev/null`
+ retval=$?
+ fi
+
+ if [ "${retval}" -eq '0' ] && [ -n "${ROOT_DEV}" ]; then
+ good_msg "Detected real_root=${ROOT_DEV}"
+ REAL_ROOT="${ROOT_DEV}"
+ else
+ bad_msg "Could not find root block device: ${REAL_ROOT}"
+ echo ' Please specify a device to boot, or "shell" for a shell...'
+ echo -n 'boot() :: '
+ read REAL_ROOT
+ got_good_root=0
+ continue
+ fi
+ ;;
+ esac
+
if [ "${REAL_ROOT}" = 'shell' ]
then
run_shell
compile_modutils
fi
fi
+
+ [ "${DISKLABEL}" -eq '1' ] && compile_e2fsprogs
if [ "${PAT}" -gt '4' -a "${UDEV}" -eq '1' ]
then
UNIONFS_SRCTAR="${GK_SHARE}/pkg/unionfs-${UNIONFS_VER}.tar.gz"
UNIONFS_BINCACHE="%%CACHE%%/unionfs-${UNIONFS_VER}-tools-%%ARCH%%.tar.bz2"
UNIONFS_MODULES_BINCACHE="%%CACHE%%/unionfs-${UNIONFS_VER}-modules-%%KV%%-%%ARCH%%.tar.bz2"
+
+E2FSPROGS_VER="1.38"
+E2FSPROGS_DIR="e2fsprogs-${E2FSPROGS_VER}"
+E2FSPROGS_SRCTAR="${GK_SHARE}/pkg/e2fsprogs-${E2FSPROGS_VER}.tar.gz"
+BLKID_BINCACHE="%%CACHE%%/blkid-${E2FSPROGS_VER}-%%ARCH%%.bz2"
+