diff options
author | Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> | 2012-12-16 12:55:27 -0300 |
---|---|---|
committer | Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> | 2012-12-21 15:01:01 -0300 |
commit | f166038db845595d7022383da1a156968d58e2b1 (patch) | |
tree | cd090703adafff2c48fce696bae08219a20f96f7 /configs/releng | |
parent | 89fe9b78ae8ee86b10f60a28fb5a74fe9fb04914 (diff) | |
download | archiso32-f166038db845595d7022383da1a156968d58e2b1.tar.xz |
[configs/releng] Refactor build.sh: build only dual-iso
* This scripts, now runs only in x86_64.
* build.sh does not require arguments to run (no more build, clean, purge).
* /usr/share split is not done anymore: there are some differences between two arches. (ISO size +60MiB)
* /usr/lib/modules split is not done anymore: this was never enabled officially in aitab.
Tested and works fine. Maybe some small cosmetic changes needed.
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Diffstat (limited to 'configs/releng')
-rw-r--r-- | configs/releng/aitab | 5 | ||||
-rwxr-xr-x | configs/releng/build.sh | 561 | ||||
-rw-r--r-- | configs/releng/syslinux.dual/archiso.cfg | 11 | ||||
-rw-r--r-- | configs/releng/syslinux.dual/archiso_head.cfg | 25 | ||||
-rw-r--r-- | configs/releng/syslinux.dual/archiso_tail.cfg | 27 | ||||
-rw-r--r-- | configs/releng/syslinux.dual/syslinux.cfg | 5 | ||||
-rw-r--r-- | configs/releng/syslinux/archiso.cfg | 4 | ||||
-rw-r--r-- | configs/releng/syslinux/archiso_head.cfg | 2 | ||||
-rw-r--r-- | configs/releng/syslinux/archiso_pxe.cfg | 32 | ||||
-rw-r--r-- | configs/releng/syslinux/archiso_pxe32.cfg (renamed from configs/releng/syslinux.dual/archiso_pxe32.cfg) | 0 | ||||
-rw-r--r-- | configs/releng/syslinux/archiso_pxe64.cfg (renamed from configs/releng/syslinux.dual/archiso_pxe64.cfg) | 0 | ||||
-rw-r--r-- | configs/releng/syslinux/archiso_pxe_32_inc.cfg (renamed from configs/releng/syslinux.dual/archiso_pxe_32_inc.cfg) | 0 | ||||
-rw-r--r-- | configs/releng/syslinux/archiso_pxe_both_inc.cfg (renamed from configs/releng/syslinux.dual/archiso_pxe_both_inc.cfg) | 0 | ||||
-rw-r--r-- | configs/releng/syslinux/archiso_pxe_choose.cfg (renamed from configs/releng/syslinux.dual/archiso_pxe_choose.cfg) | 0 | ||||
-rw-r--r-- | configs/releng/syslinux/archiso_pxe_inc.cfg | 3 | ||||
-rw-r--r-- | configs/releng/syslinux/archiso_sys.cfg | 9 | ||||
-rw-r--r-- | configs/releng/syslinux/archiso_sys32.cfg (renamed from configs/releng/syslinux.dual/archiso_sys32.cfg) | 0 | ||||
-rw-r--r-- | configs/releng/syslinux/archiso_sys64.cfg (renamed from configs/releng/syslinux.dual/archiso_sys64.cfg) | 0 | ||||
-rw-r--r-- | configs/releng/syslinux/archiso_sys_32_inc.cfg (renamed from configs/releng/syslinux.dual/archiso_sys_32_inc.cfg) | 0 | ||||
-rw-r--r-- | configs/releng/syslinux/archiso_sys_both_inc.cfg (renamed from configs/releng/syslinux.dual/archiso_sys_both_inc.cfg) | 0 | ||||
-rw-r--r-- | configs/releng/syslinux/archiso_sys_choose.cfg (renamed from configs/releng/syslinux.dual/archiso_sys_choose.cfg) | 0 | ||||
-rw-r--r-- | configs/releng/syslinux/archiso_sys_inc.cfg | 3 |
22 files changed, 188 insertions, 499 deletions
diff --git a/configs/releng/aitab b/configs/releng/aitab index ede4033..b7e9a17 100644 --- a/configs/releng/aitab +++ b/configs/releng/aitab @@ -1,4 +1,3 @@ # <img> <mnt> <arch> <sfs_comp> <fs_type> <fs_size> -root-image / %ARCH% xz ext4 50% -usr-lib-modules /usr/lib/modules %ARCH% xz ext4 50% -usr-share /usr/share any xz ext4 50% +root-image / i686 xz ext4 50% +root-image / x86_64 xz ext4 50% diff --git a/configs/releng/build.sh b/configs/releng/build.sh index ca73e89..26ef895 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -6,314 +6,196 @@ iso_name=archlinux iso_label="ARCH_$(date +%Y%m)" iso_version=$(date +%Y.%m.%d) install_dir=arch -arch=$(uname -m) work_dir=work out_dir=out -verbose="" -cmd_args="" +arch=$(uname -m) +verbose="" +pacman_conf=${work_dir}/pacman.conf script_path=$(readlink -f ${0%/*}) -setup_workdir() { - cache_dirs=($(pacman -v 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g')) - mkdir -p "${work_dir}" - pacman_conf="${work_dir}/pacman.conf" - sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${cache_dirs[@]})|g" \ - "${script_path}/pacman.conf" > "${pacman_conf}" +_usage () +{ + echo "usage ${0} [options]" + echo + echo " General options:" + echo " -N <iso_name> Set an iso filename (prefix)" + echo " Default: ${iso_name}" + echo " -V <iso_version> Set an iso version (in filename)" + echo " Default: ${iso_version}" + echo " -L <iso_label> Set an iso label (disk label)" + echo " Default: ${iso_label}" + echo " -D <install_dir> Set an install_dir (directory inside iso)" + echo " Default: ${install_dir}" + echo " -w <work_dir> Set the working directory" + echo " Default: ${work_dir}" + echo " -o <out_dir> Set the output directory" + echo " Default: ${out_dir}" + echo " -v Enable verbose output" + echo " -h This help message" + exit ${1} } -# Base installation (root-image) +# Helper function to run make_*() only one time per architecture. +run_once() { + if [[ ! -e ${work_dir}/build.${1}_${arch} ]]; then + $1 + touch ${work_dir}/build.${1}_${arch} + fi +} + +# Setup custom pacman.conf with current cache directories. +make_pacman_conf() { + local _cache_dirs + _cache_dirs=($(pacman -v 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g')) + sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${_cache_dirs[@]})|g" ${script_path}/pacman.conf > ${pacman_conf} +} + +# Base installation, plus needed packages (root-image) make_basefs() { - mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" init - mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" -p "memtest86+ mkinitcpio-nfs-utils nbd" install + setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${pacman_conf}" -D "${install_dir}" init + setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${pacman_conf}" -D "${install_dir}" -p "memtest86+ mkinitcpio-nfs-utils nbd" install } # Additional packages (root-image) make_packages() { - mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" -p "$(grep -h -v ^# ${script_path}/packages.{both,${arch}})" install + setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${pacman_conf}" -D "${install_dir}" -p "$(grep -h -v ^# ${script_path}/packages.{both,${arch}})" install } -# Copy mkinitcpio archiso hooks (root-image) +# Copy mkinitcpio archiso hooks and build initramfs (root-image) make_setup_mkinitcpio() { - if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then - local _hook - for _hook in archiso archiso_shutdown archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_loop_mnt; do - cp /usr/lib/initcpio/hooks/${_hook} ${work_dir}/root-image/usr/lib/initcpio/hooks - cp /usr/lib/initcpio/install/${_hook} ${work_dir}/root-image/usr/lib/initcpio/install - done - cp /usr/lib/initcpio/install/archiso_kms ${work_dir}/root-image/usr/lib/initcpio/install - cp /usr/lib/initcpio/archiso_shutdown ${work_dir}/root-image/usr/lib/initcpio - cp ${script_path}/mkinitcpio.conf ${work_dir}/root-image/etc/mkinitcpio-archiso.conf - : > ${work_dir}/build.${FUNCNAME} - fi -} - -# Prepare ${install_dir}/boot/ -make_boot() { - if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then - local _src=${work_dir}/root-image - local _dst_boot=${work_dir}/iso/${install_dir}/boot - mkdir -p ${_dst_boot}/${arch} - mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" \ - -r 'mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img' \ - run - mv ${_src}/boot/archiso.img ${_dst_boot}/${arch}/archiso.img - mv ${_src}/boot/vmlinuz-linux ${_dst_boot}/${arch}/vmlinuz - cp ${_src}/boot/memtest86+/memtest.bin ${_dst_boot}/memtest - cp ${_src}/usr/share/licenses/common/GPL2/license.txt ${_dst_boot}/memtest.COPYING - : > ${work_dir}/build.${FUNCNAME} - fi + local _hook + for _hook in archiso archiso_shutdown archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_loop_mnt; do + cp /usr/lib/initcpio/hooks/${_hook} ${work_dir}/${arch}/root-image/usr/lib/initcpio/hooks + cp /usr/lib/initcpio/install/${_hook} ${work_dir}/${arch}/root-image/usr/lib/initcpio/install + done + cp /usr/lib/initcpio/install/archiso_kms ${work_dir}/${arch}/root-image/usr/lib/initcpio/install + cp /usr/lib/initcpio/archiso_shutdown ${work_dir}/${arch}/root-image/usr/lib/initcpio + cp ${script_path}/mkinitcpio.conf ${work_dir}/${arch}/root-image/etc/mkinitcpio-archiso.conf + setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${pacman_conf}" -D "${install_dir}" -r 'mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img' run } -make_efi() { - if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then - if [[ ${arch} == "x86_64" ]]; then - - mkdir -p ${work_dir}/iso/EFI/boot - cp ${work_dir}/root-image/usr/lib/gummiboot/gummibootx64.efi ${work_dir}/iso/EFI/boot/bootx64.efi - - mkdir -p ${work_dir}/iso/loader/entries - cp ${script_path}/efiboot/loader/loader.conf ${work_dir}/iso/loader/ - cp ${script_path}/efiboot/loader/entries/uefi-shell-v2-x86_64.conf ${work_dir}/iso/loader/entries/ - cp ${script_path}/efiboot/loader/entries/uefi-shell-v1-x86_64.conf ${work_dir}/iso/loader/entries/ +# Customize installation (root-image) +make_customize_root_image() { + cp -af ${script_path}/root-image ${work_dir}/${arch} - sed "s|%ARCHISO_LABEL%|${iso_label}|g; - s|%INSTALL_DIR%|${install_dir}|g" ${script_path}/efiboot/loader/entries/archiso-x86_64-usb.conf > ${work_dir}/iso/loader/entries/archiso-x86_64.conf + patch ${work_dir}/${arch}/root-image/usr/bin/pacman-key < ${script_path}/pacman-key-4.0.3_unattended-keyring-init.patch + wget -O ${work_dir}/${arch}/root-image/etc/pacman.d/mirrorlist 'https://www.archlinux.org/mirrorlist/?country=all&protocol=http&use_mirror_status=on' - # EFI Shell 2.0 for UEFI 2.3+ ( http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=UEFI_Shell ) - wget -O ${work_dir}/iso/EFI/shellx64_v2.efi https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/ShellBinPkg/UefiShell/X64/Shell.efi - # EFI Shell 1.0 for non UEFI 2.3+ ( http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Efi-shell ) - wget -O ${work_dir}/iso/EFI/shellx64_v1.efi https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi + lynx -dump -nolist 'https://wiki.archlinux.org/index.php/Installation_Guide?action=render' >> ${work_dir}/${arch}/root-image/root/install.txt - fi - : > ${work_dir}/build.${FUNCNAME} - fi + setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${pacman_conf}" -D "${install_dir}" -r '/root/customize_root_image.sh' run + rm ${work_dir}/${arch}/root-image/root/customize_root_image.sh } -make_efiboot() { - if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then - if [[ ${arch} == "x86_64" ]]; then - - mkdir -p ${work_dir}/iso/EFI/archiso - truncate -s 31M ${work_dir}/iso/EFI/archiso/efiboot.img - mkfs.vfat -n ARCHISO_EFI ${work_dir}/iso/EFI/archiso/efiboot.img - - mkdir -p ${work_dir}/efiboot - mount ${work_dir}/iso/EFI/archiso/efiboot.img ${work_dir}/efiboot - - mkdir -p ${work_dir}/efiboot/EFI/archiso - cp ${work_dir}/iso/${install_dir}/boot/x86_64/vmlinuz ${work_dir}/efiboot/EFI/archiso/vmlinuz.efi - cp ${work_dir}/iso/${install_dir}/boot/x86_64/archiso.img ${work_dir}/efiboot/EFI/archiso/archiso.img - - mkdir -p ${work_dir}/efiboot/EFI/boot - cp ${work_dir}/root-image/usr/lib/gummiboot/gummibootx64.efi ${work_dir}/efiboot/EFI/boot/bootx64.efi - - mkdir -p ${work_dir}/efiboot/loader/entries - cp ${script_path}/efiboot/loader/loader.conf ${work_dir}/efiboot/loader/ - cp ${script_path}/efiboot/loader/entries/uefi-shell-v2-x86_64.conf ${work_dir}/efiboot/loader/entries/ - cp ${script_path}/efiboot/loader/entries/uefi-shell-v1-x86_64.conf ${work_dir}/efiboot/loader/entries/ - - sed "s|%ARCHISO_LABEL%|${iso_label}|g; - s|%INSTALL_DIR%|${install_dir}|g" ${script_path}/efiboot/loader/entries/archiso-x86_64-cd.conf > ${work_dir}/efiboot/loader/entries/archiso-x86_64.conf - - cp ${work_dir}/iso/EFI/shellx64_v2.efi ${work_dir}/efiboot/EFI/ - cp ${work_dir}/iso/EFI/shellx64_v1.efi ${work_dir}/efiboot/EFI/ - - umount ${work_dir}/efiboot +# Prepare kernel/initramfs ${install_dir}/boot/ +make_boot() { + mkdir -p ${work_dir}/iso/${install_dir}/boot/${arch} + cp ${work_dir}/${arch}/root-image/boot/archiso.img ${work_dir}/iso/${install_dir}/boot/${arch}/archiso.img + cp ${work_dir}/${arch}/root-image/boot/vmlinuz-linux ${work_dir}/iso/${install_dir}/boot/${arch}/vmlinuz +} - fi - : > ${work_dir}/build.${FUNCNAME} - fi +# Add other aditional/extra files to ${install_dir}/boot/ +make_boot_extra() { + cp ${work_dir}/${arch}/root-image/boot/memtest86+/memtest.bin ${work_dir}/iso/${install_dir}/boot/memtest + cp ${work_dir}/${arch}/root-image/usr/share/licenses/common/GPL2/license.txt ${work_dir}/iso/${install_dir}/boot/memtest.COPYING } # Prepare /${install_dir}/boot/syslinux make_syslinux() { - if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then - local _src_syslinux=${work_dir}/root-image/usr/lib/syslinux - local _dst_syslinux=${work_dir}/iso/${install_dir}/boot/syslinux - mkdir -p ${_dst_syslinux} - for _cfg in ${script_path}/syslinux/*.cfg; do - sed "s|%ARCHISO_LABEL%|${iso_label}|g; - s|%INSTALL_DIR%|${install_dir}|g; - s|%ARCH%|${arch}|g" ${_cfg} > ${_dst_syslinux}/${_cfg##*/} - done - cp ${script_path}/syslinux/splash.png ${_dst_syslinux} - cp ${_src_syslinux}/*.c32 ${_dst_syslinux} - cp ${_src_syslinux}/*.com ${_dst_syslinux} - cp ${_src_syslinux}/*.0 ${_dst_syslinux} - cp ${_src_syslinux}/memdisk ${_dst_syslinux} - mkdir -p ${_dst_syslinux}/hdt - cat ${work_dir}/root-image/usr/share/hwdata/pci.ids | gzip -9 > ${_dst_syslinux}/hdt/pciids.gz - cat ${work_dir}/root-image/usr/lib/modules/*-ARCH/modules.alias | gzip -9 > ${_dst_syslinux}/hdt/modalias.gz - : > ${work_dir}/build.${FUNCNAME} - fi + mkdir -p ${work_dir}/iso/${install_dir}/boot/syslinux + for _cfg in ${script_path}/syslinux/*.cfg; do + sed "s|%ARCHISO_LABEL%|${iso_label}|g; + s|%INSTALL_DIR%|${install_dir}|g" ${_cfg} > ${work_dir}/iso/${install_dir}/boot/syslinux/${_cfg##*/} + done + cp ${script_path}/syslinux/splash.png ${work_dir}/iso/${install_dir}/boot/syslinux + cp ${work_dir}/${arch}/root-image/usr/lib/syslinux/*.c32 ${work_dir}/iso/${install_dir}/boot/syslinux + cp ${work_dir}/${arch}/root-image/usr/lib/syslinux/*.com ${work_dir}/iso/${install_dir}/boot/syslinux + cp ${work_dir}/${arch}/root-image/usr/lib/syslinux/*.0 ${work_dir}/iso/${install_dir}/boot/syslinux + cp ${work_dir}/${arch}/root-image/usr/lib/syslinux/memdisk ${work_dir}/iso/${install_dir}/boot/syslinux + mkdir -p ${work_dir}/iso/${install_dir}/boot/syslinux/hdt + gzip -c -9 ${work_dir}/${arch}/root-image/usr/share/hwdata/pci.ids > ${work_dir}/iso/${install_dir}/boot/syslinux/hdt/pciids.gz + gzip -c -9 ${work_dir}/${arch}/root-image/usr/lib/modules/*-ARCH/modules.alias > ${work_dir}/iso/${install_dir}/boot/syslinux/hdt/modalias.gz } # Prepare /isolinux make_isolinux() { - if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then - mkdir -p ${work_dir}/iso/isolinux - sed "s|%INSTALL_DIR%|${install_dir}|g" ${script_path}/isolinux/isolinux.cfg > ${work_dir}/iso/isolinux/isolinux.cfg - cp ${work_dir}/root-image/usr/lib/syslinux/isolinux.bin ${work_dir}/iso/isolinux/ - cp ${work_dir}/root-image/usr/lib/syslinux/isohdpfx.bin ${work_dir}/iso/isolinux/ - : > ${work_dir}/build.${FUNCNAME} - fi + mkdir -p ${work_dir}/iso/isolinux + sed "s|%INSTALL_DIR%|${install_dir}|g" ${script_path}/isolinux/isolinux.cfg > ${work_dir}/iso/isolinux/isolinux.cfg + cp ${work_dir}/${arch}/root-image/usr/lib/syslinux/isolinux.bin ${work_dir}/iso/isolinux/ + cp ${work_dir}/${arch}/root-image/usr/lib/syslinux/isohdpfx.bin ${work_dir}/iso/isolinux/ } -# Customize installation (root-image) -make_customize_root_image() { - if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then - cp -af ${script_path}/root-image ${work_dir} - - patch ${work_dir}/root-image/usr/bin/pacman-key < ${script_path}/pacman-key-4.0.3_unattended-keyring-init.patch - wget -O ${work_dir}/root-image/etc/pacman.d/mirrorlist 'https://www.archlinux.org/mirrorlist/?country=all&protocol=http&use_mirror_status=on' - - lynx -dump -nolist 'https://wiki.archlinux.org/index.php/Installation_Guide?action=render' >> ${work_dir}/root-image/root/install.txt - - mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" -r '/root/customize_root_image.sh' run - rm ${work_dir}/root-image/root/customize_root_image.sh - : > ${work_dir}/build.${FUNCNAME} - fi -} - -# Split out /usr/lib/modules from root-image (makes more "dual-iso" friendly) -make_usr_lib_modules() { - if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then - mv ${work_dir}/root-image/usr/lib/modules ${work_dir}/usr-lib-modules - : > ${work_dir}/build.${FUNCNAME} - fi +# Prepare /EFI +make_efi() { + mkdir -p ${work_dir}/iso/EFI/boot + cp ${work_dir}/x86_64/root-image/usr/lib/gummiboot/gummibootx64.efi ${work_dir}/iso/EFI/boot/bootx64.efi + + mkdir -p ${work_dir}/iso/loader/entries + cp ${script_path}/efiboot/loader/loader.conf ${work_dir}/iso/loader/ + cp ${script_path}/efiboot/loader/entries/uefi-shell-v2-x86_64.conf ${work_dir}/iso/loader/entries/ + cp ${script_path}/efiboot/loader/entries/uefi-shell-v1-x86_64.conf ${work_dir}/iso/loader/entries/ + + sed "s|%ARCHISO_LABEL%|${iso_label}|g; + s|%INSTALL_DIR%|${install_dir}|g" \ + ${script_path}/efiboot/loader/entries/archiso-x86_64-usb.conf > ${work_dir}/iso/loader/entries/archiso-x86_64.conf + + # EFI Shell 2.0 for UEFI 2.3+ ( http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=UEFI_Shell ) + wget -O ${work_dir}/iso/EFI/shellx64_v2.efi https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/ShellBinPkg/UefiShell/X64/Shell.efi + # EFI Shell 1.0 for non UEFI 2.3+ ( http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Efi-shell ) + wget -O ${work_dir}/iso/EFI/shellx64_v1.efi https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi } -# Split out /usr/share from root-image (makes more "dual-iso" friendly) -make_usr_share() { - if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then - mv ${work_dir}/root-image/usr/share ${work_dir}/usr-share - : > ${work_dir}/build.${FUNCNAME} - fi -} +# Prepare efiboot.img::/EFI for "El Torito" EFI boot mode +make_efiboot() { + mkdir -p ${work_dir}/iso/EFI/archiso + truncate -s 31M ${work_dir}/iso/EFI/archiso/efiboot.img + mkfs.vfat -n ARCHISO_EFI ${work_dir}/iso/EFI/archiso/efiboot.img -# Process aitab -make_aitab() { - if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then - sed "s|%ARCH%|${arch}|g" ${script_path}/aitab > ${work_dir}/iso/${install_dir}/aitab - : > ${work_dir}/build.${FUNCNAME} - fi -} + mkdir -p ${work_dir}/efiboot + mount ${work_dir}/iso/EFI/archiso/efiboot.img ${work_dir}/efiboot -# Build all filesystem images specified in aitab (.fs .fs.sfs .sfs) -make_prepare() { - mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" pkglist - mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" prepare -} + mkdir -p ${work_dir}/efiboot/EFI/archiso + cp ${work_dir}/iso/${install_dir}/boot/x86_64/vmlinuz ${work_dir}/efiboot/EFI/archiso/vmlinuz.efi + cp ${work_dir}/iso/${install_dir}/boot/x86_64/archiso.img ${work_dir}/efiboot/EFI/archiso/archiso.img -# Build ISO -make_iso() { - mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" checksum - mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-${arch}.iso" -} + mkdir -p ${work_dir}/efiboot/EFI/boot + cp ${work_dir}/x86_64/root-image/usr/lib/gummiboot/gummibootx64.efi ${work_dir}/efiboot/EFI/boot/bootx64.efi -# Build dual-iso images from ${work_dir}/i686/iso and ${work_dir}/x86_64/iso -make_dual() { - if [[ ! -e ${work_dir}/dual/build.${FUNCNAME} ]]; then - if [[ ! -d ${work_dir}/i686/iso || ! -d ${work_dir}/x86_64/iso ]]; then - echo "ERROR: i686 or x86_64 builds does not exist." - _usage 1 - fi - mkdir -p ${work_dir}/dual/iso - cp -a -l -f ${work_dir}/x86_64/iso ${work_dir}/dual - cp -a -l -n ${work_dir}/i686/iso ${work_dir}/dual - rm -f ${work_dir}/dual/iso/${install_dir}/aitab - rm -f ${work_dir}/dual/iso/${install_dir}/boot/syslinux/*.cfg - paste -d"\n" <(sed "s|%ARCH%|i686|g" ${script_path}/aitab) \ - <(sed "s|%ARCH%|x86_64|g" ${script_path}/aitab) | uniq > ${work_dir}/dual/iso/${install_dir}/aitab - for _cfg in ${script_path}/syslinux.dual/*.cfg; do - sed "s|%ARCHISO_LABEL%|${iso_label}|g; - s|%INSTALL_DIR%|${install_dir}|g" ${_cfg} > ${work_dir}/dual/iso/${install_dir}/boot/syslinux/${_cfg##*/} - done - mkarchiso ${verbose} -w "${work_dir}/dual" -D "${install_dir}" checksum - mkarchiso ${verbose} -w "${work_dir}/dual" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-dual.iso" - : > ${work_dir}/dual/build.${FUNCNAME} - fi -} + mkdir -p ${work_dir}/efiboot/loader/entries + cp ${script_path}/efiboot/loader/loader.conf ${work_dir}/efiboot/loader/ + cp ${script_path}/efiboot/loader/entries/uefi-shell-v2-x86_64.conf ${work_dir}/efiboot/loader/entries/ + cp ${script_path}/efiboot/loader/entries/uefi-shell-v1-x86_64.conf ${work_dir}/efiboot/loader/entries/ -purge_single () -{ - if [[ -d ${work_dir} ]]; then - find ${work_dir} -mindepth 1 -maxdepth 1 \ - ! -path ${work_dir}/iso -prune \ - | xargs rm -rf - fi -} + sed "s|%ARCHISO_LABEL%|${iso_label}|g; + s|%INSTALL_DIR%|${install_dir}|g" \ + ${script_path}/efiboot/loader/entries/archiso-x86_64-cd.conf > ${work_dir}/efiboot/loader/entries/archiso-x86_64.conf -purge_dual () -{ - if [[ -d ${work_dir}/dual ]]; then - find ${work_dir}/dual -mindepth 1 -maxdepth 1 \ - ! -path ${work_dir}/dual/iso -prune \ - | xargs rm -rf - fi -} + cp ${work_dir}/iso/EFI/shellx64_v2.efi ${work_dir}/efiboot/EFI/ + cp ${work_dir}/iso/EFI/shellx64_v1.efi ${work_dir}/efiboot/EFI/ -clean_single () -{ - rm -rf ${work_dir} - rm -f ${out_dir}/${iso_name}-${iso_version}-*-${arch}.iso + umount ${work_dir}/efiboot } -clean_dual () -{ - rm -rf ${work_dir}/dual - rm -f ${out_dir}/${iso_name}-${iso_version}-*-dual.iso +# Copy aitab +make_aitab() { + mkdir -p ${work_dir}/iso/${install_dir} + cp ${script_path}/aitab ${work_dir}/iso/${install_dir}/aitab } -make_common_single() { - make_basefs - make_packages - make_setup_mkinitcpio - make_boot - make_efi - make_efiboot - make_syslinux - make_isolinux - make_customize_root_image - make_usr_lib_modules - make_usr_share - make_aitab - make_prepare - make_iso +# Build all filesystem images specified in aitab (.fs.sfs .sfs) +make_prepare() { + cp -a -l -f ${work_dir}/${arch}/root-image ${work_dir} + setarch ${arch} mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" pkglist + setarch ${arch} mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" prepare + rm -rf ${work_dir}/root-image + # rm -rf ${work_dir}/${arch}/root-image (if low space, this helps) } -_usage () -{ - echo "usage ${0} [options] command <command options>" - echo - echo " General options:" - echo " -N <iso_name> Set an iso filename (prefix)" - echo " Default: ${iso_name}" - echo " -V <iso_version> Set an iso version (in filename)" - echo " Default: ${iso_version}" - echo " -L <iso_label> Set an iso label (disk label)" - echo " Default: ${iso_label}" - echo " -D <install_dir> Set an install_dir (directory inside iso)" - echo " Default: ${install_dir}" - echo " -w <work_dir> Set the working directory" - echo " Default: ${work_dir}" - echo " -o <out_dir> Set the output directory" - echo " Default: ${out_dir}" - echo " -v Enable verbose output" - echo " -h This help message" - echo - echo " Commands:" - echo " build <mode>" - echo " Build selected .iso by <mode>" - echo " purge <mode>" - echo " Clean working directory except iso/ directory of build <mode>" - echo " clean <mode>" - echo " Clean working directory and .iso file in output directory of build <mode>" - echo - echo " Command options:" - echo " <mode> Valid values 'single', 'dual' or 'all'" - exit ${1} +# Build ISO +make_iso() { + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" checksum + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-dual.iso" } if [[ ${EUID} -ne 0 ]]; then @@ -321,132 +203,55 @@ if [[ ${EUID} -ne 0 ]]; then _usage 1 fi +if [[ ${arch} != x86_64 ]]; then + echo "This script needs to be run on x86_64" + _usage 1 +fi + while getopts 'N:V:L:D:w:o:vh' arg; do case "${arg}" in - N) - iso_name="${OPTARG}" - cmd_args+=" -N ${iso_name}" - ;; - V) - iso_version="${OPTARG}" - cmd_args+=" -V ${iso_version}" - ;; - L) - iso_label="${OPTARG}" - cmd_args+=" -L ${iso_label}" - ;; - D) - install_dir="${OPTARG}" - cmd_args+=" -D ${install_dir}" - ;; - w) - work_dir="${OPTARG}" - cmd_args+=" -w ${work_dir}" - ;; - o) - out_dir="${OPTARG}" - cmd_args+=" -o ${out_dir}" - ;; - v) - verbose="-v" - cmd_args+=" -v" - ;; - h|?) _usage 0 ;; + N) iso_name="${OPTARG}" ;; + V) iso_version="${OPTARG}" ;; + L) iso_label="${OPTARG}" ;; + D) install_dir="${OPTARG}" ;; + w) work_dir="${OPTARG}" ;; + o) out_dir="${OPTARG}" ;; + v) verbose="-v" ;; + h) _usage 0 ;; *) - _msg_error "Invalid argument '${arg}'" 0 - _usage 1 - ;; + echo "Invalid argument '${arg}'" + _usage 1 + ;; esac done -shift $((OPTIND - 1)) +mkdir -p ${work_dir} -if [[ $# -lt 1 ]]; then - echo "No command specified" - _usage 1 -fi -command_name="${1}" +run_once make_pacman_conf -if [[ $# -lt 2 ]]; then - echo "No command mode specified" - _usage 1 -fi -command_mode="${2}" +# Do all stuff for each root-image +for arch in i686 x86_64; do + run_once make_basefs + run_once make_packages + run_once make_setup_mkinitcpio + run_once make_customize_root_image +done -if [[ ${command_mode} == "all" && ${arch} != "x86_64" ]]; then - echo "This mode <all> needs to be run on x86_64" - _usage 1 -fi +for arch in i686 x86_64; do + run_once make_boot +done -if [[ ${command_mode} == "single" ]]; then - work_dir=${work_dir}/${arch} -fi +# Do all stuff for "iso" +run_once make_boot_extra +run_once make_syslinux +run_once make_isolinux +run_once make_efi +run_once make_efiboot + +run_once make_aitab + +for arch in i686 x86_64; do + run_once make_prepare +done -setup_workdir - -case "${command_name}" in - build) - case "${command_mode}" in - single) - make_common_single - ;; - dual) - make_dual - ;; - all) - $0 ${cmd_args} build single - $0 ${cmd_args} purge single - linux32 $0 ${cmd_args} build single - linux32 $0 ${cmd_args} purge single - $0 ${cmd_args} build dual - $0 ${cmd_args} purge dual - ;; - *) - echo "Invalid build mode '${command_mode}'" - _usage 1 - ;; - esac - ;; - purge) - case "${command_mode}" in - single) - purge_single - ;; - dual) - purge_dual - ;; - all) - $0 ${cmd_args} purge single - linux32 $0 ${cmd_args} purge single - $0 ${cmd_args} purge dual - ;; - *) - echo "Invalid purge mode '${command_mode}'" - _usage 1 - ;; - esac - ;; - clean) - case "${command_mode}" in - single) - clean_single - ;; - dual) - clean_dual - ;; - all) - $0 ${cmd_args} clean single - linux32 $0 ${cmd_args} clean single - $0 ${cmd_args} clean dual - ;; - *) - echo "Invalid clean mode '${command_mode}'" - _usage 1 - ;; - esac - ;; - *) - echo "Invalid command name '${command_name}'" - _usage 1 - ;; -esac +run_once make_iso diff --git a/configs/releng/syslinux.dual/archiso.cfg b/configs/releng/syslinux.dual/archiso.cfg deleted file mode 100644 index d1817af..0000000 --- a/configs/releng/syslinux.dual/archiso.cfg +++ /dev/null @@ -1,11 +0,0 @@ -DEFAULT select - -LABEL select -COM32 boot/syslinux/whichsys.c32 -APPEND -pxe- pxe -sys- sys -iso- sys - -LABEL pxe -CONFIG boot/syslinux/archiso_pxe_choose.cfg - -LABEL sys -CONFIG boot/syslinux/archiso_sys_choose.cfg diff --git a/configs/releng/syslinux.dual/archiso_head.cfg b/configs/releng/syslinux.dual/archiso_head.cfg deleted file mode 100644 index 81ad26e..0000000 --- a/configs/releng/syslinux.dual/archiso_head.cfg +++ /dev/null @@ -1,25 +0,0 @@ -SERIAL 0 38400 -UI boot/syslinux/vesamenu.c32 -MENU TITLE Arch Linux -MENU BACKGROUND boot/syslinux/splash.png - -MENU WIDTH 78 -MENU MARGIN 4 -MENU ROWS 7 -MENU VSHIFT 10 -MENU TABMSGROW 14 -MENU CMDLINEROW 14 -MENU HELPMSGROW 16 -MENU HELPMSGENDROW 29 - -# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu - -MENU COLOR border 30;44 #40ffffff #a0000000 std -MENU COLOR title 1;36;44 #9033ccff #a0000000 std -MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all -MENU COLOR unsel 37;44 #50ffffff #a0000000 std -MENU COLOR help 37;40 #c0ffffff #a0000000 std -MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std -MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std -MENU COLOR msg07 37;40 #90ffffff #a0000000 std -MENU COLOR tabmsg 31;40 #30ffffff #00000000 std diff --git a/configs/releng/syslinux.dual/archiso_tail.cfg b/configs/releng/syslinux.dual/archiso_tail.cfg deleted file mode 100644 index a55548c..0000000 --- a/configs/releng/syslinux.dual/archiso_tail.cfg +++ /dev/null @@ -1,27 +0,0 @@ -LABEL existing -TEXT HELP -Boot an existing operating system. Press TAB to edit the disk and partition -number to boot. -ENDTEXT -MENU LABEL Boot existing OS -COM32 boot/syslinux/chain.c32 -APPEND hd0 0 - -# http://www.memtest.org/ -LABEL memtest -MENU LABEL Run Memtest86+ (RAM test) -LINUX boot/memtest - -# http://hdt-project.org/ -LABEL hdt -MENU LABEL Hardware Information (HDT) -COM32 boot/syslinux/hdt.c32 -APPEND modules_alias=boot/syslinux/hdt/modalias.gz pciids=boot/syslinux/hdt/pciids.gz - -LABEL reboot -MENU LABEL Reboot -COM32 boot/syslinux/reboot.c32 - -LABEL poweroff -MENU LABEL Power Off -COMBOOT boot/syslinux/poweroff.com diff --git a/configs/releng/syslinux.dual/syslinux.cfg b/configs/releng/syslinux.dual/syslinux.cfg deleted file mode 100644 index 3ee98de..0000000 --- a/configs/releng/syslinux.dual/syslinux.cfg +++ /dev/null @@ -1,5 +0,0 @@ -DEFAULT loadconfig - -LABEL loadconfig - CONFIG archiso.cfg - APPEND ../../ diff --git a/configs/releng/syslinux/archiso.cfg b/configs/releng/syslinux/archiso.cfg index 126fc77..d1817af 100644 --- a/configs/releng/syslinux/archiso.cfg +++ b/configs/releng/syslinux/archiso.cfg @@ -5,7 +5,7 @@ COM32 boot/syslinux/whichsys.c32 APPEND -pxe- pxe -sys- sys -iso- sys LABEL pxe -CONFIG boot/syslinux/archiso_pxe_inc.cfg +CONFIG boot/syslinux/archiso_pxe_choose.cfg LABEL sys -CONFIG boot/syslinux/archiso_sys_inc.cfg +CONFIG boot/syslinux/archiso_sys_choose.cfg diff --git a/configs/releng/syslinux/archiso_head.cfg b/configs/releng/syslinux/archiso_head.cfg index faa2588..81ad26e 100644 --- a/configs/releng/syslinux/archiso_head.cfg +++ b/configs/releng/syslinux/archiso_head.cfg @@ -5,7 +5,7 @@ MENU BACKGROUND boot/syslinux/splash.png MENU WIDTH 78 MENU MARGIN 4 -MENU ROWS 6 +MENU ROWS 7 MENU VSHIFT 10 MENU TABMSGROW 14 MENU CMDLINEROW 14 diff --git a/configs/releng/syslinux/archiso_pxe.cfg b/configs/releng/syslinux/archiso_pxe.cfg deleted file mode 100644 index 8bb60ed..0000000 --- a/configs/releng/syslinux/archiso_pxe.cfg +++ /dev/null @@ -1,32 +0,0 @@ -LABEL arch_nbd -TEXT HELP -Boot the Arch Linux live medium (Using NBD). It allows you to install Arch Linux or -perform system maintenance. -ENDTEXT -MENU LABEL Boot Arch Linux (NBD) -LINUX boot/%ARCH%/vmlinuz -INITRD boot/%ARCH%/archiso.img -APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% archiso_nbd_srv=${pxeserver} -IPAPPEND 3 - -LABEL arch_nfs -TEXT HELP -Boot the Arch Linux live medium (Using NFS). It allows you to install Arch Linux or -perform system maintenance. -ENDTEXT -MENU LABEL Boot Arch Linux (NFS) -LINUX boot/%ARCH%/vmlinuz -INITRD boot/%ARCH%/archiso.img -APPEND archisobasedir=%INSTALL_DIR% archiso_nfs_srv=${pxeserver}:/run/archiso/bootmnt -IPAPPEND 3 - -LABEL arch_http -TEXT HELP -Boot the Arch Linux live medium (Using HTTP). It allows you to install Arch Linux or -perform system maintenance. -ENDTEXT -MENU LABEL Boot Arch Linux (HTTP) -LINUX boot/%ARCH%/vmlinuz -INITRD boot/%ARCH%/archiso.img -APPEND archisobasedir=%INSTALL_DIR% archiso_http_srv=http://${pxeserver}/ -IPAPPEND 3 diff --git a/configs/releng/syslinux.dual/archiso_pxe32.cfg b/configs/releng/syslinux/archiso_pxe32.cfg index 4bdeefa..4bdeefa 100644 --- a/configs/releng/syslinux.dual/archiso_pxe32.cfg +++ b/configs/releng/syslinux/archiso_pxe32.cfg diff --git a/configs/releng/syslinux.dual/archiso_pxe64.cfg b/configs/releng/syslinux/archiso_pxe64.cfg index 1676236..1676236 100644 --- a/configs/releng/syslinux.dual/archiso_pxe64.cfg +++ b/configs/releng/syslinux/archiso_pxe64.cfg diff --git a/configs/releng/syslinux.dual/archiso_pxe_32_inc.cfg b/configs/releng/syslinux/archiso_pxe_32_inc.cfg index e4115df..e4115df 100644 --- a/configs/releng/syslinux.dual/archiso_pxe_32_inc.cfg +++ b/configs/releng/syslinux/archiso_pxe_32_inc.cfg diff --git a/configs/releng/syslinux.dual/archiso_pxe_both_inc.cfg b/configs/releng/syslinux/archiso_pxe_both_inc.cfg index 1593303..1593303 100644 --- a/configs/releng/syslinux.dual/archiso_pxe_both_inc.cfg +++ b/configs/releng/syslinux/archiso_pxe_both_inc.cfg diff --git a/configs/releng/syslinux.dual/archiso_pxe_choose.cfg b/configs/releng/syslinux/archiso_pxe_choose.cfg index 6296065..6296065 100644 --- a/configs/releng/syslinux.dual/archiso_pxe_choose.cfg +++ b/configs/releng/syslinux/archiso_pxe_choose.cfg diff --git a/configs/releng/syslinux/archiso_pxe_inc.cfg b/configs/releng/syslinux/archiso_pxe_inc.cfg deleted file mode 100644 index b2b6887..0000000 --- a/configs/releng/syslinux/archiso_pxe_inc.cfg +++ /dev/null @@ -1,3 +0,0 @@ -INCLUDE boot/syslinux/archiso_head.cfg -INCLUDE boot/syslinux/archiso_pxe.cfg -INCLUDE boot/syslinux/archiso_tail.cfg diff --git a/configs/releng/syslinux/archiso_sys.cfg b/configs/releng/syslinux/archiso_sys.cfg deleted file mode 100644 index 35303db..0000000 --- a/configs/releng/syslinux/archiso_sys.cfg +++ /dev/null @@ -1,9 +0,0 @@ -LABEL arch -TEXT HELP -Boot the Arch Linux live medium. It allows you to install Arch Linux or -perform system maintenance. -ENDTEXT -MENU LABEL Boot Arch Linux -LINUX boot/%ARCH%/vmlinuz -INITRD boot/%ARCH%/archiso.img -APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% diff --git a/configs/releng/syslinux.dual/archiso_sys32.cfg b/configs/releng/syslinux/archiso_sys32.cfg index 261579e..261579e 100644 --- a/configs/releng/syslinux.dual/archiso_sys32.cfg +++ b/configs/releng/syslinux/archiso_sys32.cfg diff --git a/configs/releng/syslinux.dual/archiso_sys64.cfg b/configs/releng/syslinux/archiso_sys64.cfg index eb89813..eb89813 100644 --- a/configs/releng/syslinux.dual/archiso_sys64.cfg +++ b/configs/releng/syslinux/archiso_sys64.cfg diff --git a/configs/releng/syslinux.dual/archiso_sys_32_inc.cfg b/configs/releng/syslinux/archiso_sys_32_inc.cfg index 9e37093..9e37093 100644 --- a/configs/releng/syslinux.dual/archiso_sys_32_inc.cfg +++ b/configs/releng/syslinux/archiso_sys_32_inc.cfg diff --git a/configs/releng/syslinux.dual/archiso_sys_both_inc.cfg b/configs/releng/syslinux/archiso_sys_both_inc.cfg index e885c40..e885c40 100644 --- a/configs/releng/syslinux.dual/archiso_sys_both_inc.cfg +++ b/configs/releng/syslinux/archiso_sys_both_inc.cfg diff --git a/configs/releng/syslinux.dual/archiso_sys_choose.cfg b/configs/releng/syslinux/archiso_sys_choose.cfg index 24c597a..24c597a 100644 --- a/configs/releng/syslinux.dual/archiso_sys_choose.cfg +++ b/configs/releng/syslinux/archiso_sys_choose.cfg diff --git a/configs/releng/syslinux/archiso_sys_inc.cfg b/configs/releng/syslinux/archiso_sys_inc.cfg deleted file mode 100644 index 56c6a17..0000000 --- a/configs/releng/syslinux/archiso_sys_inc.cfg +++ /dev/null @@ -1,3 +0,0 @@ -INCLUDE boot/syslinux/archiso_head.cfg -INCLUDE boot/syslinux/archiso_sys.cfg -INCLUDE boot/syslinux/archiso_tail.cfg |