2011-06-18 23:38:58 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e -u
|
|
|
|
|
2011-08-29 06:45:49 +02:00
|
|
|
iso_name=archlinux
|
2011-06-18 23:38:58 +02:00
|
|
|
iso_label="ARCH_$(date +%Y%m)"
|
2011-08-29 06:45:49 +02:00
|
|
|
iso_version=$(date +%Y.%m.%d)
|
2011-06-18 23:38:58 +02:00
|
|
|
install_dir=arch
|
|
|
|
arch=$(uname -m)
|
|
|
|
work_dir=work
|
2011-08-29 06:45:49 +02:00
|
|
|
out_dir=out
|
2011-08-29 06:45:49 +02:00
|
|
|
verbose=""
|
2012-03-16 21:40:48 +01:00
|
|
|
cmd_args=""
|
2011-06-18 23:38:58 +02:00
|
|
|
|
2011-07-14 05:46:42 +02:00
|
|
|
script_path=$(readlink -f ${0%/*})
|
2012-06-23 11:37:56 +02:00
|
|
|
|
|
|
|
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}"
|
|
|
|
}
|
2011-07-14 05:46:42 +02:00
|
|
|
|
2011-06-18 23:38:58 +02:00
|
|
|
# Base installation (root-image)
|
|
|
|
make_basefs() {
|
2012-06-23 11:04:48 +02:00
|
|
|
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 curl" install
|
2012-10-03 15:52:13 +02:00
|
|
|
|
|
|
|
# Install systemd-sysvcompat in this way until hits {base} group
|
|
|
|
mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" \
|
|
|
|
-r 'pacman -R --noconfirm --noprogressbar initscripts sysvinit' \
|
|
|
|
run
|
|
|
|
mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" \
|
|
|
|
-p "systemd-sysvcompat" \
|
|
|
|
install
|
2011-06-18 23:38:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Additional packages (root-image)
|
|
|
|
make_packages() {
|
2012-06-23 11:04:48 +02:00
|
|
|
mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" -p "$(grep -v ^# ${script_path}/packages.${arch})" install
|
2011-06-18 23:38:58 +02:00
|
|
|
}
|
|
|
|
|
2011-06-28 00:16:29 +02:00
|
|
|
# Copy mkinitcpio archiso hooks (root-image)
|
|
|
|
make_setup_mkinitcpio() {
|
|
|
|
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
|
|
|
local _hook
|
2011-12-03 22:08:57 +01:00
|
|
|
for _hook in archiso archiso_shutdown archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_loop_mnt; do
|
2012-03-05 00:58:58 +01:00
|
|
|
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
|
2011-06-28 00:16:29 +02:00
|
|
|
done
|
2012-03-05 00:58:58 +01:00
|
|
|
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
|
2011-11-28 14:35:05 +01:00
|
|
|
cp ${script_path}/mkinitcpio.conf ${work_dir}/root-image/etc/mkinitcpio-archiso.conf
|
2011-06-28 00:16:29 +02:00
|
|
|
: > ${work_dir}/build.${FUNCNAME}
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2011-06-18 23:38:58 +02:00
|
|
|
# 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}
|
2012-06-23 11:04:48 +02:00
|
|
|
mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" \
|
2012-03-16 05:48:10 +01:00
|
|
|
-r 'mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img' \
|
|
|
|
run
|
2011-11-28 14:35:05 +01:00
|
|
|
mv ${_src}/boot/archiso.img ${_dst_boot}/${arch}/archiso.img
|
2011-07-24 23:25:33 +02:00
|
|
|
mv ${_src}/boot/vmlinuz-linux ${_dst_boot}/${arch}/vmlinuz
|
2011-06-18 23:38:58 +02:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2012-09-26 17:24:41 +02:00
|
|
|
make_efi() {
|
[configs/releng] Add UEFI boot support via Linux >= 3.3 EFI boot stub on x86_64
Makes an efiboot.img (FAT16) for "El Torito" (additional).
Under an EFI-system, implies that this .ISO works only if is used
as "CD-ROM/DVD-ROM" not in ISO-HYBRID-MBR mode.
If you want, an EFI-ready USB-key, just unpack this "<ISO>/EFI/efiboot.img" (FAT16) to
"<USB-key-FAT-formatted>/EFI" then copy "<ISO>/arch" and setup the filesystem label.
An aditional EFI shell is provided with an startup script for automatic booting
until EFI_STUB supports "linux.conf" to pass boot parms to kernel.
Anyway I think that is a good idea to keep this shell, so can customize boot parms,
or for doing other tasks on systems without an EFI-shell.
RFCv1: Initial efiboot.img build with vmlinuz.efi (Linux with EFI_STUB enabled)
and archiso.img (initramfs).
RFCv2: Use an startup.nsh with EFI-Shell 2.0 (generated from build.sh) for automatic boot.
RFCv3: Use and older EFI-Shell 1.0 instead of 2.0, since not all UEFI-systems
are compatible with 2.3+ specs.
RFCv4: The script "startup.nsh" improved by Keshav P R, using a for-loop
(see notes below from original commit), now that has more than 1-line,
I moved it to an independent file and is parsed by build.sh.
----
About startup.nsh:
Author: Keshav P R <the.ridikulus.rat@gmail.com>
Date: Thu Apr 5 10:33:20 2012 +0530
[configs/releng] Search in all existing UEFI FS mountpoints for archiso efistub kernel file
There is no guarantee that the efistub kernel will always be in fs0:
(similar to the case inside linux OS where the sda, sdb confusion exists,
hence the need for UUIDs), especially when USB (instead os CD/ISO) is
used for booting.
Hence loop through all possible fs mountpoints (in UEFI) in startup.nsh
and try to launch the first mountpoint that contains the archiso files.
Cd's into the fs%m:\EFI\archiso directory also may remove future issues
with efistub's linux.conf where the efistub might have problems
identifying the directory from which the kernel was launched.
Also add an helpful echo message showing the user the UEFI PATH to the
archiso kernel file being launched by startup.nsh .
Hopefully this should work in both CD and USB. Tested in Tianocore
UDK/EDK2 DuetPkg X64 UEFI 2.3.1 firmware with EdkShellBinPkg's Shell.
----
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2012-04-11 02:01:12 +02:00
|
|
|
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
|
|
|
if [[ ${arch} == "x86_64" ]]; then
|
2012-09-26 17:24:41 +02:00
|
|
|
|
|
|
|
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
|
2012-09-26 17:24:41 +02:00
|
|
|
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/
|
2012-09-26 17:24:41 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2012-09-26 17:24:41 +02:00
|
|
|
fi
|
|
|
|
: > ${work_dir}/build.${FUNCNAME}
|
|
|
|
fi
|
|
|
|
}
|
2012-09-26 17:24:41 +02:00
|
|
|
|
2012-09-26 17:24:41 +02:00
|
|
|
make_efiboot() {
|
|
|
|
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
|
|
|
if [[ ${arch} == "x86_64" ]]; then
|
2012-09-26 17:24:41 +02:00
|
|
|
|
[configs/releng] Add UEFI boot support via Linux >= 3.3 EFI boot stub on x86_64
Makes an efiboot.img (FAT16) for "El Torito" (additional).
Under an EFI-system, implies that this .ISO works only if is used
as "CD-ROM/DVD-ROM" not in ISO-HYBRID-MBR mode.
If you want, an EFI-ready USB-key, just unpack this "<ISO>/EFI/efiboot.img" (FAT16) to
"<USB-key-FAT-formatted>/EFI" then copy "<ISO>/arch" and setup the filesystem label.
An aditional EFI shell is provided with an startup script for automatic booting
until EFI_STUB supports "linux.conf" to pass boot parms to kernel.
Anyway I think that is a good idea to keep this shell, so can customize boot parms,
or for doing other tasks on systems without an EFI-shell.
RFCv1: Initial efiboot.img build with vmlinuz.efi (Linux with EFI_STUB enabled)
and archiso.img (initramfs).
RFCv2: Use an startup.nsh with EFI-Shell 2.0 (generated from build.sh) for automatic boot.
RFCv3: Use and older EFI-Shell 1.0 instead of 2.0, since not all UEFI-systems
are compatible with 2.3+ specs.
RFCv4: The script "startup.nsh" improved by Keshav P R, using a for-loop
(see notes below from original commit), now that has more than 1-line,
I moved it to an independent file and is parsed by build.sh.
----
About startup.nsh:
Author: Keshav P R <the.ridikulus.rat@gmail.com>
Date: Thu Apr 5 10:33:20 2012 +0530
[configs/releng] Search in all existing UEFI FS mountpoints for archiso efistub kernel file
There is no guarantee that the efistub kernel will always be in fs0:
(similar to the case inside linux OS where the sda, sdb confusion exists,
hence the need for UUIDs), especially when USB (instead os CD/ISO) is
used for booting.
Hence loop through all possible fs mountpoints (in UEFI) in startup.nsh
and try to launch the first mountpoint that contains the archiso files.
Cd's into the fs%m:\EFI\archiso directory also may remove future issues
with efistub's linux.conf where the efistub might have problems
identifying the directory from which the kernel was launched.
Also add an helpful echo message showing the user the UEFI PATH to the
archiso kernel file being launched by startup.nsh .
Hopefully this should work in both CD and USB. Tested in Tianocore
UDK/EDK2 DuetPkg X64 UEFI 2.3.1 firmware with EdkShellBinPkg's Shell.
----
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2012-04-11 02:01:12 +02:00
|
|
|
mkdir -p ${work_dir}/iso/EFI/archiso
|
2012-09-27 02:25:34 +02:00
|
|
|
truncate -s 31M ${work_dir}/iso/EFI/archiso/efiboot.img
|
|
|
|
mkfs.vfat -n ARCHISO_EFI ${work_dir}/iso/EFI/archiso/efiboot.img
|
[configs/releng] Add UEFI boot support via Linux >= 3.3 EFI boot stub on x86_64
Makes an efiboot.img (FAT16) for "El Torito" (additional).
Under an EFI-system, implies that this .ISO works only if is used
as "CD-ROM/DVD-ROM" not in ISO-HYBRID-MBR mode.
If you want, an EFI-ready USB-key, just unpack this "<ISO>/EFI/efiboot.img" (FAT16) to
"<USB-key-FAT-formatted>/EFI" then copy "<ISO>/arch" and setup the filesystem label.
An aditional EFI shell is provided with an startup script for automatic booting
until EFI_STUB supports "linux.conf" to pass boot parms to kernel.
Anyway I think that is a good idea to keep this shell, so can customize boot parms,
or for doing other tasks on systems without an EFI-shell.
RFCv1: Initial efiboot.img build with vmlinuz.efi (Linux with EFI_STUB enabled)
and archiso.img (initramfs).
RFCv2: Use an startup.nsh with EFI-Shell 2.0 (generated from build.sh) for automatic boot.
RFCv3: Use and older EFI-Shell 1.0 instead of 2.0, since not all UEFI-systems
are compatible with 2.3+ specs.
RFCv4: The script "startup.nsh" improved by Keshav P R, using a for-loop
(see notes below from original commit), now that has more than 1-line,
I moved it to an independent file and is parsed by build.sh.
----
About startup.nsh:
Author: Keshav P R <the.ridikulus.rat@gmail.com>
Date: Thu Apr 5 10:33:20 2012 +0530
[configs/releng] Search in all existing UEFI FS mountpoints for archiso efistub kernel file
There is no guarantee that the efistub kernel will always be in fs0:
(similar to the case inside linux OS where the sda, sdb confusion exists,
hence the need for UUIDs), especially when USB (instead os CD/ISO) is
used for booting.
Hence loop through all possible fs mountpoints (in UEFI) in startup.nsh
and try to launch the first mountpoint that contains the archiso files.
Cd's into the fs%m:\EFI\archiso directory also may remove future issues
with efistub's linux.conf where the efistub might have problems
identifying the directory from which the kernel was launched.
Also add an helpful echo message showing the user the UEFI PATH to the
archiso kernel file being launched by startup.nsh .
Hopefully this should work in both CD and USB. Tested in Tianocore
UDK/EDK2 DuetPkg X64 UEFI 2.3.1 firmware with EdkShellBinPkg's Shell.
----
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2012-04-11 02:01:12 +02:00
|
|
|
|
|
|
|
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
|
2012-09-26 17:24:41 +02:00
|
|
|
cp ${work_dir}/root-image/usr/lib/gummiboot/gummibootx64.efi ${work_dir}/efiboot/EFI/boot/bootx64.efi
|
[configs/releng] Add UEFI boot support via Linux >= 3.3 EFI boot stub on x86_64
Makes an efiboot.img (FAT16) for "El Torito" (additional).
Under an EFI-system, implies that this .ISO works only if is used
as "CD-ROM/DVD-ROM" not in ISO-HYBRID-MBR mode.
If you want, an EFI-ready USB-key, just unpack this "<ISO>/EFI/efiboot.img" (FAT16) to
"<USB-key-FAT-formatted>/EFI" then copy "<ISO>/arch" and setup the filesystem label.
An aditional EFI shell is provided with an startup script for automatic booting
until EFI_STUB supports "linux.conf" to pass boot parms to kernel.
Anyway I think that is a good idea to keep this shell, so can customize boot parms,
or for doing other tasks on systems without an EFI-shell.
RFCv1: Initial efiboot.img build with vmlinuz.efi (Linux with EFI_STUB enabled)
and archiso.img (initramfs).
RFCv2: Use an startup.nsh with EFI-Shell 2.0 (generated from build.sh) for automatic boot.
RFCv3: Use and older EFI-Shell 1.0 instead of 2.0, since not all UEFI-systems
are compatible with 2.3+ specs.
RFCv4: The script "startup.nsh" improved by Keshav P R, using a for-loop
(see notes below from original commit), now that has more than 1-line,
I moved it to an independent file and is parsed by build.sh.
----
About startup.nsh:
Author: Keshav P R <the.ridikulus.rat@gmail.com>
Date: Thu Apr 5 10:33:20 2012 +0530
[configs/releng] Search in all existing UEFI FS mountpoints for archiso efistub kernel file
There is no guarantee that the efistub kernel will always be in fs0:
(similar to the case inside linux OS where the sda, sdb confusion exists,
hence the need for UUIDs), especially when USB (instead os CD/ISO) is
used for booting.
Hence loop through all possible fs mountpoints (in UEFI) in startup.nsh
and try to launch the first mountpoint that contains the archiso files.
Cd's into the fs%m:\EFI\archiso directory also may remove future issues
with efistub's linux.conf where the efistub might have problems
identifying the directory from which the kernel was launched.
Also add an helpful echo message showing the user the UEFI PATH to the
archiso kernel file being launched by startup.nsh .
Hopefully this should work in both CD and USB. Tested in Tianocore
UDK/EDK2 DuetPkg X64 UEFI 2.3.1 firmware with EdkShellBinPkg's Shell.
----
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2012-04-11 02:01:12 +02:00
|
|
|
|
2012-09-26 17:24:41 +02:00
|
|
|
mkdir -p ${work_dir}/efiboot/loader/entries
|
2012-09-26 17:24:41 +02:00
|
|
|
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/
|
2012-09-12 16:19:21 +02:00
|
|
|
|
|
|
|
sed "s|%ARCHISO_LABEL%|${iso_label}|g;
|
2012-09-26 17:24:41 +02:00
|
|
|
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
|
[configs/releng] Add UEFI boot support via Linux >= 3.3 EFI boot stub on x86_64
Makes an efiboot.img (FAT16) for "El Torito" (additional).
Under an EFI-system, implies that this .ISO works only if is used
as "CD-ROM/DVD-ROM" not in ISO-HYBRID-MBR mode.
If you want, an EFI-ready USB-key, just unpack this "<ISO>/EFI/efiboot.img" (FAT16) to
"<USB-key-FAT-formatted>/EFI" then copy "<ISO>/arch" and setup the filesystem label.
An aditional EFI shell is provided with an startup script for automatic booting
until EFI_STUB supports "linux.conf" to pass boot parms to kernel.
Anyway I think that is a good idea to keep this shell, so can customize boot parms,
or for doing other tasks on systems without an EFI-shell.
RFCv1: Initial efiboot.img build with vmlinuz.efi (Linux with EFI_STUB enabled)
and archiso.img (initramfs).
RFCv2: Use an startup.nsh with EFI-Shell 2.0 (generated from build.sh) for automatic boot.
RFCv3: Use and older EFI-Shell 1.0 instead of 2.0, since not all UEFI-systems
are compatible with 2.3+ specs.
RFCv4: The script "startup.nsh" improved by Keshav P R, using a for-loop
(see notes below from original commit), now that has more than 1-line,
I moved it to an independent file and is parsed by build.sh.
----
About startup.nsh:
Author: Keshav P R <the.ridikulus.rat@gmail.com>
Date: Thu Apr 5 10:33:20 2012 +0530
[configs/releng] Search in all existing UEFI FS mountpoints for archiso efistub kernel file
There is no guarantee that the efistub kernel will always be in fs0:
(similar to the case inside linux OS where the sda, sdb confusion exists,
hence the need for UUIDs), especially when USB (instead os CD/ISO) is
used for booting.
Hence loop through all possible fs mountpoints (in UEFI) in startup.nsh
and try to launch the first mountpoint that contains the archiso files.
Cd's into the fs%m:\EFI\archiso directory also may remove future issues
with efistub's linux.conf where the efistub might have problems
identifying the directory from which the kernel was launched.
Also add an helpful echo message showing the user the UEFI PATH to the
archiso kernel file being launched by startup.nsh .
Hopefully this should work in both CD and USB. Tested in Tianocore
UDK/EDK2 DuetPkg X64 UEFI 2.3.1 firmware with EdkShellBinPkg's Shell.
----
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2012-04-11 02:01:12 +02:00
|
|
|
|
2012-09-26 17:24:41 +02:00
|
|
|
cp ${work_dir}/iso/EFI/shellx64_v2.efi ${work_dir}/efiboot/EFI/
|
|
|
|
cp ${work_dir}/iso/EFI/shellx64_v1.efi ${work_dir}/efiboot/EFI/
|
|
|
|
|
[configs/releng] Add UEFI boot support via Linux >= 3.3 EFI boot stub on x86_64
Makes an efiboot.img (FAT16) for "El Torito" (additional).
Under an EFI-system, implies that this .ISO works only if is used
as "CD-ROM/DVD-ROM" not in ISO-HYBRID-MBR mode.
If you want, an EFI-ready USB-key, just unpack this "<ISO>/EFI/efiboot.img" (FAT16) to
"<USB-key-FAT-formatted>/EFI" then copy "<ISO>/arch" and setup the filesystem label.
An aditional EFI shell is provided with an startup script for automatic booting
until EFI_STUB supports "linux.conf" to pass boot parms to kernel.
Anyway I think that is a good idea to keep this shell, so can customize boot parms,
or for doing other tasks on systems without an EFI-shell.
RFCv1: Initial efiboot.img build with vmlinuz.efi (Linux with EFI_STUB enabled)
and archiso.img (initramfs).
RFCv2: Use an startup.nsh with EFI-Shell 2.0 (generated from build.sh) for automatic boot.
RFCv3: Use and older EFI-Shell 1.0 instead of 2.0, since not all UEFI-systems
are compatible with 2.3+ specs.
RFCv4: The script "startup.nsh" improved by Keshav P R, using a for-loop
(see notes below from original commit), now that has more than 1-line,
I moved it to an independent file and is parsed by build.sh.
----
About startup.nsh:
Author: Keshav P R <the.ridikulus.rat@gmail.com>
Date: Thu Apr 5 10:33:20 2012 +0530
[configs/releng] Search in all existing UEFI FS mountpoints for archiso efistub kernel file
There is no guarantee that the efistub kernel will always be in fs0:
(similar to the case inside linux OS where the sda, sdb confusion exists,
hence the need for UUIDs), especially when USB (instead os CD/ISO) is
used for booting.
Hence loop through all possible fs mountpoints (in UEFI) in startup.nsh
and try to launch the first mountpoint that contains the archiso files.
Cd's into the fs%m:\EFI\archiso directory also may remove future issues
with efistub's linux.conf where the efistub might have problems
identifying the directory from which the kernel was launched.
Also add an helpful echo message showing the user the UEFI PATH to the
archiso kernel file being launched by startup.nsh .
Hopefully this should work in both CD and USB. Tested in Tianocore
UDK/EDK2 DuetPkg X64 UEFI 2.3.1 firmware with EdkShellBinPkg's Shell.
----
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2012-04-11 02:01:12 +02:00
|
|
|
umount ${work_dir}/efiboot
|
2012-09-26 17:24:41 +02:00
|
|
|
|
[configs/releng] Add UEFI boot support via Linux >= 3.3 EFI boot stub on x86_64
Makes an efiboot.img (FAT16) for "El Torito" (additional).
Under an EFI-system, implies that this .ISO works only if is used
as "CD-ROM/DVD-ROM" not in ISO-HYBRID-MBR mode.
If you want, an EFI-ready USB-key, just unpack this "<ISO>/EFI/efiboot.img" (FAT16) to
"<USB-key-FAT-formatted>/EFI" then copy "<ISO>/arch" and setup the filesystem label.
An aditional EFI shell is provided with an startup script for automatic booting
until EFI_STUB supports "linux.conf" to pass boot parms to kernel.
Anyway I think that is a good idea to keep this shell, so can customize boot parms,
or for doing other tasks on systems without an EFI-shell.
RFCv1: Initial efiboot.img build with vmlinuz.efi (Linux with EFI_STUB enabled)
and archiso.img (initramfs).
RFCv2: Use an startup.nsh with EFI-Shell 2.0 (generated from build.sh) for automatic boot.
RFCv3: Use and older EFI-Shell 1.0 instead of 2.0, since not all UEFI-systems
are compatible with 2.3+ specs.
RFCv4: The script "startup.nsh" improved by Keshav P R, using a for-loop
(see notes below from original commit), now that has more than 1-line,
I moved it to an independent file and is parsed by build.sh.
----
About startup.nsh:
Author: Keshav P R <the.ridikulus.rat@gmail.com>
Date: Thu Apr 5 10:33:20 2012 +0530
[configs/releng] Search in all existing UEFI FS mountpoints for archiso efistub kernel file
There is no guarantee that the efistub kernel will always be in fs0:
(similar to the case inside linux OS where the sda, sdb confusion exists,
hence the need for UUIDs), especially when USB (instead os CD/ISO) is
used for booting.
Hence loop through all possible fs mountpoints (in UEFI) in startup.nsh
and try to launch the first mountpoint that contains the archiso files.
Cd's into the fs%m:\EFI\archiso directory also may remove future issues
with efistub's linux.conf where the efistub might have problems
identifying the directory from which the kernel was launched.
Also add an helpful echo message showing the user the UEFI PATH to the
archiso kernel file being launched by startup.nsh .
Hopefully this should work in both CD and USB. Tested in Tianocore
UDK/EDK2 DuetPkg X64 UEFI 2.3.1 firmware with EdkShellBinPkg's Shell.
----
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2012-04-11 02:01:12 +02:00
|
|
|
fi
|
|
|
|
: > ${work_dir}/build.${FUNCNAME}
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2011-06-18 23:38:58 +02:00
|
|
|
# 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}
|
2011-11-28 16:28:03 +01:00
|
|
|
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
|
2011-07-14 05:46:42 +02:00
|
|
|
cp ${script_path}/syslinux/splash.png ${_dst_syslinux}
|
2011-06-18 23:38:58 +02:00
|
|
|
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
|
2012-06-23 09:45:47 +02:00
|
|
|
cat ${work_dir}/root-image/usr/share/hwdata/pci.ids | gzip -9 > ${_dst_syslinux}/hdt/pciids.gz
|
2012-07-14 16:07:12 +02:00
|
|
|
cat ${work_dir}/root-image/usr/lib/modules/*-ARCH/modules.alias | gzip -9 > ${_dst_syslinux}/hdt/modalias.gz
|
2011-06-18 23:38:58 +02:00
|
|
|
: > ${work_dir}/build.${FUNCNAME}
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Prepare /isolinux
|
|
|
|
make_isolinux() {
|
|
|
|
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
|
|
|
mkdir -p ${work_dir}/iso/isolinux
|
2011-07-14 05:46:42 +02:00
|
|
|
sed "s|%INSTALL_DIR%|${install_dir}|g" ${script_path}/isolinux/isolinux.cfg > ${work_dir}/iso/isolinux/isolinux.cfg
|
2011-06-18 23:38:58 +02:00
|
|
|
cp ${work_dir}/root-image/usr/lib/syslinux/isolinux.bin ${work_dir}/iso/isolinux/
|
2011-08-29 06:47:57 +02:00
|
|
|
cp ${work_dir}/root-image/usr/lib/syslinux/isohdpfx.bin ${work_dir}/iso/isolinux/
|
2011-06-18 23:38:58 +02:00
|
|
|
: > ${work_dir}/build.${FUNCNAME}
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2011-11-28 14:35:05 +01:00
|
|
|
# Customize installation (root-image)
|
|
|
|
make_customize_root_image() {
|
|
|
|
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
|
|
|
cp -af ${script_path}/root-image ${work_dir}
|
2012-08-01 00:52:09 +02:00
|
|
|
cp -aT ${work_dir}/root-image/etc/skel/ ${work_dir}/root-image/root/
|
2012-08-01 00:52:09 +02:00
|
|
|
ln -sf /usr/share/zoneinfo/UTC ${work_dir}/root-image/etc/localtime
|
2011-11-28 14:35:05 +01:00
|
|
|
chmod 750 ${work_dir}/root-image/etc/sudoers.d
|
|
|
|
chmod 440 ${work_dir}/root-image/etc/sudoers.d/g_wheel
|
|
|
|
mkdir -p ${work_dir}/root-image/etc/pacman.d
|
2012-06-22 14:56:05 +02:00
|
|
|
wget -O ${work_dir}/root-image/etc/pacman.d/mirrorlist 'https://www.archlinux.org/mirrorlist/?country=all&protocol=http&use_mirror_status=on'
|
2012-07-25 20:05:55 +02:00
|
|
|
lynx -dump -nolist 'https://wiki.archlinux.org/index.php/Installation_Guide?action=render' >> ${work_dir}/root-image/root/install.txt
|
2011-11-28 14:35:05 +01:00
|
|
|
sed -i "s/#Server/Server/g" ${work_dir}/root-image/etc/pacman.d/mirrorlist
|
2012-07-18 21:55:51 +02:00
|
|
|
patch ${work_dir}/root-image/usr/bin/pacman-key < ${script_path}/pacman-key-4.0.3_unattended-keyring-init.patch
|
2012-03-17 17:27:37 +01:00
|
|
|
sed -i 's/#\(en_US\.UTF-8\)/\1/' ${work_dir}/root-image/etc/locale.gen
|
2012-10-03 15:52:13 +02:00
|
|
|
sed 's#\(^ExecStart=-/sbin/agetty\)#\1 --autologin root#' \
|
|
|
|
${work_dir}/root-image/usr/lib/systemd/system/getty@.service > ${work_dir}/root-image/etc/systemd/system/autologin@.service
|
2012-06-23 11:04:48 +02:00
|
|
|
mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" \
|
2012-03-16 05:48:10 +01:00
|
|
|
-r 'locale-gen' \
|
|
|
|
run
|
2012-06-23 11:04:48 +02:00
|
|
|
mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" \
|
2012-08-01 00:52:09 +02:00
|
|
|
-r 'usermod -s /bin/zsh root' \
|
|
|
|
run
|
|
|
|
mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" \
|
|
|
|
-r 'useradd -m -p "" -g users -G "audio,disk,optical,wheel" -s /bin/zsh arch' \
|
2012-03-16 05:48:10 +01:00
|
|
|
run
|
2012-10-03 15:52:13 +02:00
|
|
|
mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" \
|
2012-10-05 11:32:28 +02:00
|
|
|
-r 'systemctl -f enable multi-user.target haveged.service pacman-init.service autologin@.service dhcpcd.service || true' \
|
2012-10-03 15:52:13 +02:00
|
|
|
run
|
2011-11-28 14:35:05 +01:00
|
|
|
: > ${work_dir}/build.${FUNCNAME}
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2012-07-14 16:07:12 +02:00
|
|
|
# Split out /usr/lib/modules from root-image (makes more "dual-iso" friendly)
|
|
|
|
make_usr_lib_modules() {
|
2011-06-18 23:38:58 +02:00
|
|
|
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
2012-07-14 16:07:12 +02:00
|
|
|
mv ${work_dir}/root-image/usr/lib/modules ${work_dir}/usr-lib-modules
|
2011-06-18 23:38:58 +02:00
|
|
|
: > ${work_dir}/build.${FUNCNAME}
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# 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
|
|
|
|
}
|
|
|
|
|
|
|
|
# Process aitab
|
|
|
|
make_aitab() {
|
2012-08-01 00:52:09 +02:00
|
|
|
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}
|
2011-06-18 23:38:58 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Build all filesystem images specified in aitab (.fs .fs.sfs .sfs)
|
|
|
|
make_prepare() {
|
2012-06-23 11:04:48 +02:00
|
|
|
mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" pkglist
|
|
|
|
mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" prepare
|
2011-06-18 23:38:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Build ISO
|
|
|
|
make_iso() {
|
2012-06-23 11:04:48 +02:00
|
|
|
mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" checksum
|
2012-08-01 00:52:09 +02:00
|
|
|
mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-${arch}.iso"
|
2011-06-18 23:38:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Build dual-iso images from ${work_dir}/i686/iso and ${work_dir}/x86_64/iso
|
|
|
|
make_dual() {
|
2012-08-01 00:52:09 +02:00
|
|
|
if [[ ! -e ${work_dir}/dual/build.${FUNCNAME} ]]; then
|
2011-06-18 23:38:58 +02:00
|
|
|
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
|
|
|
|
local _src_one _src_two _cfg
|
|
|
|
if [[ ${arch} == "i686" ]]; then
|
|
|
|
_src_one=${work_dir}/i686/iso
|
|
|
|
_src_two=${work_dir}/x86_64/iso
|
|
|
|
else
|
|
|
|
_src_one=${work_dir}/x86_64/iso
|
|
|
|
_src_two=${work_dir}/i686/iso
|
|
|
|
fi
|
|
|
|
mkdir -p ${work_dir}/dual/iso
|
|
|
|
cp -a -l -f ${_src_one} ${work_dir}/dual
|
|
|
|
cp -a -l -n ${_src_two} ${work_dir}/dual
|
|
|
|
rm -f ${work_dir}/dual/iso/${install_dir}/aitab
|
2011-11-28 16:28:03 +01:00
|
|
|
rm -f ${work_dir}/dual/iso/${install_dir}/boot/syslinux/*.cfg
|
2012-08-01 00:52:09 +02:00
|
|
|
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
|
2011-07-14 05:46:42 +02:00
|
|
|
for _cfg in ${script_path}/syslinux.dual/*.cfg; do
|
2011-06-18 23:38:58 +02:00
|
|
|
sed "s|%ARCHISO_LABEL%|${iso_label}|g;
|
|
|
|
s|%INSTALL_DIR%|${install_dir}|g" ${_cfg} > ${work_dir}/dual/iso/${install_dir}/boot/syslinux/${_cfg##*/}
|
|
|
|
done
|
2011-08-29 06:45:49 +02:00
|
|
|
mkarchiso ${verbose} -w "${work_dir}/dual" -D "${install_dir}" checksum
|
2012-08-01 00:52:09 +02:00
|
|
|
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}
|
2011-06-18 23:38:58 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2011-08-29 06:45:49 +02:00
|
|
|
purge_single ()
|
|
|
|
{
|
|
|
|
if [[ -d ${work_dir} ]]; then
|
|
|
|
find ${work_dir} -mindepth 1 -maxdepth 1 \
|
|
|
|
! -path ${work_dir}/iso -prune \
|
|
|
|
| xargs rm -rf
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
clean_single ()
|
|
|
|
{
|
|
|
|
rm -rf ${work_dir}
|
|
|
|
rm -f ${out_dir}/${iso_name}-${iso_version}-*-${arch}.iso
|
|
|
|
}
|
2011-06-18 23:38:58 +02:00
|
|
|
|
2011-08-29 06:45:49 +02:00
|
|
|
clean_dual ()
|
|
|
|
{
|
|
|
|
rm -rf ${work_dir}/dual
|
|
|
|
rm -f ${out_dir}/${iso_name}-${iso_version}-*-dual.iso
|
|
|
|
}
|
|
|
|
|
|
|
|
make_common_single() {
|
|
|
|
make_basefs
|
|
|
|
make_packages
|
|
|
|
make_setup_mkinitcpio
|
|
|
|
make_boot
|
2012-09-26 17:24:41 +02:00
|
|
|
make_efi
|
|
|
|
make_efiboot
|
2011-08-29 06:45:49 +02:00
|
|
|
make_syslinux
|
|
|
|
make_isolinux
|
2011-11-28 14:35:05 +01:00
|
|
|
make_customize_root_image
|
2012-07-14 16:07:12 +02:00
|
|
|
make_usr_lib_modules
|
2011-08-29 06:45:49 +02:00
|
|
|
make_usr_share
|
2012-08-01 00:52:09 +02:00
|
|
|
make_aitab
|
|
|
|
make_prepare
|
|
|
|
make_iso
|
2011-08-29 06:45:49 +02:00
|
|
|
}
|
2011-06-18 23:38:58 +02:00
|
|
|
|
|
|
|
_usage ()
|
|
|
|
{
|
2011-08-29 06:45:49 +02:00
|
|
|
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"
|
2011-06-18 23:38:58 +02:00
|
|
|
echo
|
2011-08-29 06:45:49 +02:00
|
|
|
echo " Commands:"
|
2012-08-01 00:52:09 +02:00
|
|
|
echo " build <mode>"
|
|
|
|
echo " Build selected .iso by <mode>"
|
2011-08-29 06:45:49 +02:00
|
|
|
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:"
|
2012-03-16 21:40:48 +01:00
|
|
|
echo " <mode> Valid values 'single', 'dual' or 'all'"
|
2011-06-18 23:38:58 +02:00
|
|
|
exit ${1}
|
|
|
|
}
|
|
|
|
|
|
|
|
if [[ ${EUID} -ne 0 ]]; then
|
|
|
|
echo "This script must be run as root."
|
|
|
|
_usage 1
|
|
|
|
fi
|
|
|
|
|
2011-08-29 06:45:49 +02:00
|
|
|
while getopts 'N:V:L:D:w:o:vh' arg; do
|
|
|
|
case "${arg}" in
|
2012-03-16 21:40:48 +01:00
|
|
|
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"
|
|
|
|
;;
|
2011-08-29 06:45:49 +02:00
|
|
|
h|?) _usage 0 ;;
|
|
|
|
*)
|
|
|
|
_msg_error "Invalid argument '${arg}'" 0
|
|
|
|
_usage 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
shift $((OPTIND - 1))
|
|
|
|
|
2011-06-18 23:38:58 +02:00
|
|
|
if [[ $# -lt 1 ]]; then
|
|
|
|
echo "No command specified"
|
|
|
|
_usage 1
|
|
|
|
fi
|
|
|
|
command_name="${1}"
|
|
|
|
|
2011-08-29 06:45:49 +02:00
|
|
|
if [[ $# -lt 2 ]]; then
|
|
|
|
echo "No command mode specified"
|
|
|
|
_usage 1
|
2011-06-18 23:38:58 +02:00
|
|
|
fi
|
2011-08-29 06:45:49 +02:00
|
|
|
command_mode="${2}"
|
2011-06-18 23:38:58 +02:00
|
|
|
|
2012-03-16 21:40:48 +01:00
|
|
|
if [[ ${command_mode} == "all" && ${arch} != "x86_64" ]]; then
|
|
|
|
echo "This mode <all> needs to be run on x86_64"
|
|
|
|
_usage 1
|
|
|
|
fi
|
|
|
|
|
2011-08-29 06:45:49 +02:00
|
|
|
if [[ ${command_mode} == "single" ]]; then
|
|
|
|
work_dir=${work_dir}/${arch}
|
|
|
|
fi
|
2011-06-18 23:38:58 +02:00
|
|
|
|
2012-06-23 11:37:56 +02:00
|
|
|
setup_workdir
|
|
|
|
|
2011-06-18 23:38:58 +02:00
|
|
|
case "${command_name}" in
|
2011-08-29 06:45:49 +02:00
|
|
|
build)
|
|
|
|
case "${command_mode}" in
|
|
|
|
single)
|
2012-08-01 00:52:09 +02:00
|
|
|
make_common_single
|
2011-08-29 06:45:49 +02:00
|
|
|
;;
|
|
|
|
dual)
|
2012-08-01 00:52:09 +02:00
|
|
|
make_dual
|
2011-08-29 06:45:49 +02:00
|
|
|
;;
|
2012-03-16 21:40:48 +01:00
|
|
|
all)
|
2012-08-01 00:52:09 +02:00
|
|
|
$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
|
2012-03-16 21:40:48 +01:00
|
|
|
;;
|
2011-08-29 06:45:49 +02:00
|
|
|
*)
|
|
|
|
echo "Invalid build mode '${command_mode}'"
|
|
|
|
_usage 1
|
|
|
|
;;
|
|
|
|
esac
|
2011-08-08 20:40:31 +02:00
|
|
|
;;
|
2011-08-29 06:45:49 +02:00
|
|
|
purge)
|
|
|
|
case "${command_mode}" in
|
|
|
|
single)
|
|
|
|
purge_single
|
|
|
|
;;
|
|
|
|
dual)
|
|
|
|
purge_dual
|
|
|
|
;;
|
2012-03-16 21:40:48 +01:00
|
|
|
all)
|
|
|
|
$0 ${cmd_args} purge single
|
|
|
|
linux32 $0 ${cmd_args} purge single
|
|
|
|
$0 ${cmd_args} purge dual
|
|
|
|
;;
|
2011-08-29 06:45:49 +02:00
|
|
|
*)
|
|
|
|
echo "Invalid purge mode '${command_mode}'"
|
|
|
|
_usage 1
|
|
|
|
;;
|
|
|
|
esac
|
2011-06-18 23:38:58 +02:00
|
|
|
;;
|
2011-08-29 06:45:49 +02:00
|
|
|
clean)
|
|
|
|
case "${command_mode}" in
|
|
|
|
single)
|
|
|
|
clean_single
|
|
|
|
;;
|
|
|
|
dual)
|
|
|
|
clean_dual
|
|
|
|
;;
|
2012-03-16 21:40:48 +01:00
|
|
|
all)
|
|
|
|
$0 ${cmd_args} clean single
|
|
|
|
linux32 $0 ${cmd_args} clean single
|
|
|
|
$0 ${cmd_args} clean dual
|
|
|
|
;;
|
2011-08-29 06:45:49 +02:00
|
|
|
*)
|
|
|
|
echo "Invalid clean mode '${command_mode}'"
|
|
|
|
_usage 1
|
|
|
|
;;
|
|
|
|
esac
|
2011-06-18 23:38:58 +02:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Invalid command name '${command_name}'"
|
|
|
|
_usage 1
|
|
|
|
;;
|
|
|
|
esac
|