live-build/scripts/build/binary

103 lines
2.4 KiB
Plaintext
Raw Normal View History

2007-09-23 08:04:46 +00:00
#!/bin/sh
## live-build(7) - System Build Scripts
## Copyright (C) 2016-2020 The Debian Live team
## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
##
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.
2007-09-23 08:04:46 +00:00
2007-09-23 08:04:48 +00:00
set -e
2007-09-23 08:05:11 +00:00
# Including common functions
[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
2007-09-23 08:04:48 +00:00
2007-09-23 08:05:11 +00:00
# Setting static variables
DESCRIPTION="Build binary images"
2007-09-23 08:04:48 +00:00
USAGE="${PROGRAM} [--force]"
# Automatically populating config tree
Auto_build_config
# Processing arguments and configuration files
Init_config_data "${@}"
2007-09-23 08:05:16 +00:00
# Setting up cleanup function
Setup_clean_exit
2007-09-23 08:04:48 +00:00
# Preparing root filesystem
lb binary_chroot ${@}
2007-09-23 08:04:46 +00:00
if [ "${LB_BUILD_WITH_CHROOT}" = "true" ]
2007-09-23 08:05:15 +00:00
then
# Configuring chroot
lb chroot_devpts install ${@}
lb chroot_proc install ${@}
lb chroot_selinuxfs install ${@}
lb chroot_sysfs install ${@}
lb chroot_hosts install ${@}
lb chroot_resolv install ${@}
lb chroot_hostname install ${@}
lb chroot_dpkg install ${@}
lb chroot_sysv-rc install ${@}
lb chroot_apt install-binary ${@}
lb chroot_archives chroot install ${@}
2007-09-23 08:05:15 +00:00
fi
2007-09-23 08:04:48 +00:00
# Building root filesystem
lb binary_rootfs ${@}
lb binary_manifest ${@}
2007-09-23 08:04:46 +00:00
# Prepare images
lb binary_package-lists ${@}
lb binary_linux-image ${@}
lb binary_memtest ${@}
lb binary_grub-legacy ${@}
lb binary_grub-pc ${@}
Loopback cfg support. Development details -------------------- * This patch has been based originally on: binary_grub2 . It has been improved thanks to some binary_syslinux bits. * This patch ensures that binary_loopback_cfg needs is run before binary_syslinux is run. The reason is that it reuses some code from binary_syslinux to avoid problems when binary_syslinux renames the kernel filenames. * This patch already supports CPU detection * I haven't tested all the possible scenarios for the script (with the latest version). When amd64 and 486 Gnu/Linux flavours is used and the bootloader is syslinux it works ok. * I have not implemented a disable switch for not generating it. Usually you always want loopback.cfg to be there. * Compared to binary_grub2 script I have removed the installation entries because I did not see any of them in binary_syslinux. How to test ----------- These are some steps to easily test if Looback cfg support is working ok. 0) We assume you have generated an iso 1) Make sure you have a partition that Grub understands. Plain ext4 or vfat should do it. 2) Create directory: /boot/boot-isos/ 3) Put the iso file into that directory making sure it has an ISO or iso extension. 4) Setup your computer to boot from cdrom and use: Super Grub2 Disk 2.00s2 (Hybrid version recommended) 5) Choose Boot manually... 6) Choose Bootable ISOs (in /boot- ... ) 7) Choose (the detected) GRUB Loopback Config (hdN,msodsN)/boot/boot-ios/name-of-the.iso 8) You will be presented your loopback.cfg. Choose anyone of the entries (unless it does not match your cpu architecture of course). 9) You should boot into your Debian Live without problems (thanks to findiso boot parametre). If you ever wanted to test from your grub2 installation instead from Super Grub2 Disk check: http://www.supergrubdisk.org/wiki/Loopback.cfg for an example.
2014-12-07 16:20:09 -01:00
lb binary_loopback_cfg ${@}
lb binary_syslinux ${@}
lb binary_disk ${@}
lb binary_loadlin ${@}
lb binary_win32-loader ${@}
lb binary_includes ${@}
lb binary_grub-efi ${@}
lb binary_hooks ${@}
lb binary_checksums ${@}
2007-09-23 08:04:46 +00:00
if [ "${LB_BUILD_WITH_CHROOT}" != "true" ]
then
lb chroot_devpts install ${@}
lb chroot_proc install ${@}
lb chroot_selinuxfs install ${@}
lb chroot_sysfs install ${@}
fi
2007-09-23 08:04:46 +00:00
# Building images
lb binary_iso ${@}
Add options to build ONIE images Open Network Install Environment is an open image format used by networking vendor to ship a standardised image for networking white box switches. ONIE hardware takes this image at boot and a script to chain load into the final environment via kexec. We can support Debian and derivatives on such systems by packing an ISO which then gets unpacked, kexec'ed and live-booted. A base ONIE system can be tested in QEMU by building a VM following these instrunctions: https://github.com/opencomputeproject/onie/blob/master/machine/kvm_x86_64/INSTALL Once built, boot onie-recovery-x86_64-kvm_x86_64-r0.iso in QEMU/libvirt and on the console there will be the terminal prompt. Check the IP assigned by libvirt and then scp the live image (ssh access is enabled as root without password...). Then the .bin can be booted with: ONIE-RECOVERY:/ # onie-nos-install /tmp/live.hybrid.iso-ONIE.bin The implementation is inspired by ONIE's own scripts that can be found at: https://github.com/opencomputeproject/onie/blob/master/contrib/debian-iso/cook-bits.sh A new option, --onie (false by default) can be set to true to enable building this new format in addition to an ISO. An additional option, --onie-kernel-cmdline can be used to specify additional options that the ONIE system should use when kexec'ing the final image. Note that only iso or hybrid-iso formats are supported. For more information about the ONIE ecosystem see: http://onie.org Signed-off-by: Erik Ziegenbalg <eziegenb@Brocade.com> Signed-off-by: Luca Boccassi <bluca@debian.org>
2018-03-16 18:30:50 -01:00
lb binary_onie ${@}
lb binary_netboot ${@}
lb binary_tar ${@}
lb binary_hdd ${@}
2007-09-23 08:04:46 +00:00
lb binary_zsync ${@}
if [ "${LB_BUILD_WITH_CHROOT}" = "true" ]
2007-09-23 08:05:15 +00:00
then
# Deconfiguring chroot
rm -f .build/chroot_archives
lb chroot_apt remove ${@}
lb chroot_hostname remove ${@}
lb chroot_resolv remove ${@}
lb chroot_hosts remove ${@}
lb chroot_sysv-rc remove ${@}
lb chroot_dpkg remove ${@}
lb chroot_debianchroot remove ${@}
2007-09-23 08:05:15 +00:00
fi
lb chroot_sysfs remove ${@}
lb chroot_selinuxfs remove ${@}
lb chroot_proc remove ${@}
lb chroot_devpts remove ${@}