From 85d243ff5836fc17416c65dca8a9e8b4e9d915bc Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Sat, 18 Jun 2011 18:38:58 -0300 Subject: [archiso] Use dm-snapshot instead of aufs2 (A.K.A. "The Big Commit") * Use device mapper + snapshot module, instead union layer filesystem. * A block-level approach vs vfs-level. * No more unofficial (Linux) things. * More memory is needed. * Refactor mkarchiso. * Refactor hooks/archiso. * Fix install/archiso_pxe_nbd (due recent change in mkinitcpio-0.6.15 on checked_modules()/all_modules()) [Thanks Dave for the improved workaround] * New configs/releng to build official images. * Works with a Bash script instead of Makefile. (better control and easy to maintain) * Remove configs/syslinux-iso. * Remove archiso2dual script. Integrate functionality in configs/releng. * New configs/baseline to build the most basic live medium or use as template. * New README (draft). [Thanks Dieter for fixing english grammar] Signed-off-by: Gerardo Exequiel Pozzi --- configs/baseline/aitab | 2 + configs/baseline/build.sh | 97 ++++++++++++++++++++++++++++++++++ configs/baseline/isolinux/isolinux.cfg | 5 ++ configs/baseline/mkinitcpio.conf | 2 + configs/baseline/root-image/etc/fstab | 2 + configs/baseline/syslinux/syslinux.cfg | 12 +++++ 6 files changed, 120 insertions(+) create mode 100644 configs/baseline/aitab create mode 100755 configs/baseline/build.sh create mode 100644 configs/baseline/isolinux/isolinux.cfg create mode 100644 configs/baseline/mkinitcpio.conf create mode 100644 configs/baseline/root-image/etc/fstab create mode 100644 configs/baseline/syslinux/syslinux.cfg (limited to 'configs/baseline') diff --git a/configs/baseline/aitab b/configs/baseline/aitab new file mode 100644 index 0000000..fbd4d00 --- /dev/null +++ b/configs/baseline/aitab @@ -0,0 +1,2 @@ +# +root-image / %ARCH% xz ext4 50% diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh new file mode 100755 index 0000000..3c896e8 --- /dev/null +++ b/configs/baseline/build.sh @@ -0,0 +1,97 @@ +#!/bin/bash + +set -e -u + +name=archlinux +iso_label="ARCH_$(date +%Y%m)" +version=$(date +%Y.%m.%d) +install_dir=arch +arch=$(uname -m) +work_dir=work +verbose="n" + +# This function can be called after make_basefs() +get_linux_ver() { + local ALL_kver + eval $(grep ^ALL_kver ${work_dir}/root-image/etc/mkinitcpio.d/kernel26.kver) + echo ${ALL_kver} +} + +# Base installation (root-image) +make_basefs() { + mkarchiso ${verbose} -D "${install_dir}" -p "base" create "${work_dir}" + mkarchiso ${verbose} -D "${install_dir}" -p "syslinux" create "${work_dir}" +} + +# Customize installation (root-image) +make_customize_root_image() { + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then + cp -af root-image ${work_dir} + : > ${work_dir}/build.${FUNCNAME} + fi +} + +# Prepare ${install_dir}/boot/ +make_boot() { + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then + mkdir -p ${work_dir}/iso/${install_dir}/boot/${arch} + cp ${work_dir}/root-image/boot/vmlinuz26 ${work_dir}/iso/${install_dir}/boot/${arch} + mkinitcpio -c ./mkinitcpio.conf -b ${work_dir}/root-image -k $(get_linux_ver) -g ${work_dir}/iso/${install_dir}/boot/${arch}/archiso.img + : > ${work_dir}/build.${FUNCNAME} + fi +} + +# Prepare /${install_dir}/boot/syslinux +make_syslinux() { + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then + mkdir -p ${work_dir}/iso/${install_dir}/boot/syslinux + sed "s|%ARCHISO_LABEL%|${iso_label}|g; + s|%INSTALL_DIR%|${install_dir}|g; + s|%ARCH%|${arch}|g" syslinux/syslinux.cfg > ${work_dir}/iso/${install_dir}/boot/syslinux/syslinux.cfg + cp ${work_dir}/root-image/usr/lib/syslinux/menu.c32 ${work_dir}/iso/${install_dir}/boot/syslinux/ + : > ${work_dir}/build.${FUNCNAME} + fi +} + +# Prepare /isolinux +make_isolinux() { + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then + mkdir -p ${work_dir}/iso/isolinux + sed "s|%INSTALL_DIR%|${install_dir}|g" isolinux/isolinux.cfg > ${work_dir}/iso/isolinux/isolinux.cfg + cp ${work_dir}/root-image/usr/lib/syslinux/isolinux.bin ${work_dir}/iso/isolinux/ + : > ${work_dir}/build.${FUNCNAME} + fi +} + +# Process aitab +make_aitab() { + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then + sed "s|%ARCH%|${arch}|g" aitab > ${work_dir}/iso/${install_dir}/aitab + : > ${work_dir}/build.${FUNCNAME} + fi +} + +# Build all filesystem images specified in aitab (.fs .fs.sfs .sfs) +make_prepare() { + mkarchiso ${verbose} -D "${install_dir}" prepare "${work_dir}" +} + +# Build ISO +make_iso() { + mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${name}-${version}-${arch}.iso" +} + +if [[ $verbose == "y" ]]; then + verbose="-v" +else + verbose="" +fi + +make_basefs +make_customize_root_image +make_boot +make_syslinux +make_isolinux +make_aitab +make_prepare +make_iso diff --git a/configs/baseline/isolinux/isolinux.cfg b/configs/baseline/isolinux/isolinux.cfg new file mode 100644 index 0000000..e7bbaa4 --- /dev/null +++ b/configs/baseline/isolinux/isolinux.cfg @@ -0,0 +1,5 @@ +DEFAULT loadconfig + +LABEL loadconfig + CONFIG /%INSTALL_DIR%/boot/syslinux/syslinux.cfg + APPEND /%INSTALL_DIR%/boot/syslinux/ diff --git a/configs/baseline/mkinitcpio.conf b/configs/baseline/mkinitcpio.conf new file mode 100644 index 0000000..389ec51 --- /dev/null +++ b/configs/baseline/mkinitcpio.conf @@ -0,0 +1,2 @@ +HOOKS="base udev archiso sata filesystems" +COMPRESSION="xz" diff --git a/configs/baseline/root-image/etc/fstab b/configs/baseline/root-image/etc/fstab new file mode 100644 index 0000000..4b82b80 --- /dev/null +++ b/configs/baseline/root-image/etc/fstab @@ -0,0 +1,2 @@ +# +/dev/mapper/root-image / auto defaults 0 0 diff --git a/configs/baseline/syslinux/syslinux.cfg b/configs/baseline/syslinux/syslinux.cfg new file mode 100644 index 0000000..f755453 --- /dev/null +++ b/configs/baseline/syslinux/syslinux.cfg @@ -0,0 +1,12 @@ +DEFAULT menu.c32 +PROMPT 0 +MENU TITLE Arch Linux +TIMEOUT 300 + +LABEL arch +MENU LABEL Arch Linux +LINUX /%INSTALL_DIR%/boot/%ARCH%/vmlinuz26 +INITRD /%INSTALL_DIR%/boot/%ARCH%/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% + +ONTIMEOUT arch -- cgit v1.2.3-70-g09d2