Adding foreign bootstrap via qemu for cross arch building.
This commit is contained in:
parent
9e5218ec75
commit
d90c311ef9
|
@ -22,6 +22,24 @@ Check_architectures ()
|
|||
fi
|
||||
done
|
||||
|
||||
if [ "${ARCHITECTURES}" = "${LB_BOOTSTRAP_QEMU_ARCHITECTURES}" ]
|
||||
then
|
||||
VALID="true"
|
||||
|
||||
if [ ! -e "${LB_BOOTSTRAP_QEMU_STATIC}" ]
|
||||
then
|
||||
Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_ARCHITECTURES} was not found"
|
||||
VALID="false"
|
||||
fi
|
||||
|
||||
if [ ! -x "${LB_BOOTSTRAP_QEMU_STATIC}" ]
|
||||
then
|
||||
Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_STATIC} is not executable"
|
||||
VALID="false"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if [ "${VALID}" = "false" ]
|
||||
then
|
||||
Echo_warning "skipping %s, foreign architecture(s)." "${0}"
|
||||
|
@ -52,6 +70,24 @@ Check_crossarchitectures ()
|
|||
;;
|
||||
esac
|
||||
|
||||
if [ "${LB_ARCHITECTURES}" = "${LB_BOOTSTRAP_QEMU_ARCHITECTURES}" ]
|
||||
then
|
||||
|
||||
if [ ! -e "${LB_BOOTSTRAP_QEMU_STATIC}" ]
|
||||
then
|
||||
Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_ARCHITECTURES} was not found"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -x "${LB_BOOTSTRAP_QEMU_STATIC}" ]
|
||||
then
|
||||
Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_STATIC} is not executable"
|
||||
exit 0
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
Check_architectures "${CROSS}"
|
||||
}
|
||||
|
||||
|
|
|
@ -1276,4 +1276,13 @@ Check_defaults ()
|
|||
fi
|
||||
fi
|
||||
|
||||
# Architectures to use foreign bootstrap for
|
||||
LB_BOOTSTRAP_QEMU_ARCHITECTURES="${LB_BOOTSTRAP_QEMU_ARCHITECTURES:-}"
|
||||
|
||||
# Packages to exclude for the foreign/ports bootstrapping
|
||||
LB_BOOTSTRAP_QEMU_EXCLUDE="${LB_PORTS_BOOTSTRAP_EXCLUDE:-}"
|
||||
|
||||
# Ports using foreign bootstrap need a working qemu-*-system. This is the location it
|
||||
LB_BOOTSTRAP_QEMU_STATIC="${LB_BOOTSTRAP_QEMU_STATIC:-}"
|
||||
|
||||
}
|
||||
|
|
|
@ -137,7 +137,24 @@ then
|
|||
fi
|
||||
|
||||
Echo_breakage "Running debootstrap... "
|
||||
${LB_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}"
|
||||
|
||||
# Run appropriate bootstrap, i.e. foreign or regular bootstrap
|
||||
if [ "${LB_BOOTSTRAP_QEMU_ARCHITECTURES}" = "${LB_ARCHITECTURES}" ]; then
|
||||
|
||||
if [ -n "${LB_BOOTSTRAP_QEMU_EXCLUDE}" ]
|
||||
then
|
||||
DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --exclude=$(echo ${LB_BOOTSTRAP_QEMU_EXCLUDE} | sed 's| *|,|g')"
|
||||
fi
|
||||
|
||||
Echo_message "Bootstrap will be foreign"
|
||||
${LB_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} --foreign "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}"
|
||||
|
||||
Echo_message "Running debootstrap second stage under QEMU"
|
||||
cp ${LB_BOOTSTRAP_QEMU_STATIC} chroot/usr/bin
|
||||
Chroot chroot /debootstrap/debootstrap --second-stage
|
||||
else
|
||||
${LB_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}"
|
||||
fi
|
||||
|
||||
if [ -n "${LB_ROOT_COMMAND}" ]
|
||||
then
|
||||
|
|
|
@ -147,7 +147,11 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
|
|||
\t [--exposed-root true|false]\n\
|
||||
\t [--username NAME]\n\
|
||||
\t [--verbose]\n\
|
||||
\t [--win32-loader true|false]"
|
||||
\t [--win32-loader true|false]\n\
|
||||
\t [--bootstrap-qemu-exclude PACKAGES]\n\
|
||||
\t [--bootstrap-qemu-static PATH]\n\
|
||||
\t [--bootstrap-qemu-arch ARCH]"
|
||||
|
||||
|
||||
Local_arguments ()
|
||||
{
|
||||
|
@ -170,7 +174,8 @@ Local_arguments ()
|
|||
net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:,
|
||||
net-cow-server:,net-tarball:,swap-file-path:,swap-file-size:,syslinux-theme:,
|
||||
username:,win32-loader:,source:,source-images:,breakpoints,conffile:,debug,force,
|
||||
help,ignore-system-defaults,quiet,usage,verbose,version"
|
||||
help,ignore-system-defaults,quiet,usage,verbose,version,bootstrap-qemu-static:,bootstrap-qemu-arch:,
|
||||
bootstrap-qemu-exclude:"
|
||||
# Remove spaces added by indentation
|
||||
LONG_OPTIONS="$(echo ${LONG_OPTIONS} | tr -d ' ')"
|
||||
ARGUMENTS="$(getopt --longoptions ${LONG_OPTIONS} --name="${PROGRAM}" --options a:f:d:m:l:k:p:b:e:s:c:huv --shell sh -- "${@}")"
|
||||
|
@ -781,6 +786,21 @@ Local_arguments ()
|
|||
shift 2
|
||||
;;
|
||||
|
||||
--bootstrap-qemu-arch)
|
||||
LB_BOOTSTRAP_QEMU_ARCHITECTURES="${2}"
|
||||
shift 2
|
||||
;;
|
||||
|
||||
--bootstrap-qemu-exclude)
|
||||
LB_BOOTSTRAP_QEMU_EXCLUDE="${2}"
|
||||
shift 2
|
||||
;;
|
||||
|
||||
--bootstrap-qemu-static)
|
||||
LB_BOOTSTRAP_QEMU_STATIC="${2}"
|
||||
shift 2
|
||||
;;
|
||||
|
||||
# config/source
|
||||
--source)
|
||||
LB_SOURCE="${2}"
|
||||
|
@ -1171,6 +1191,18 @@ LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS}"
|
|||
# \$LB_PARENT_ARCHIVE_AREAS: select archive areas to use
|
||||
# (Default: ${LB_PARENT_ARCHIVE_AREAS})
|
||||
LB_PARENT_ARCHIVE_AREAS="${LB_PARENT_ARCHIVE_AREAS}"
|
||||
|
||||
# \$LB_BOOTSTRAP_QEMU_ARCHITECTURES: architectures to use foreign bootstrap
|
||||
# (Default: ${LB_BOOTSTRAP_QEMU_ARCHITECTURES})
|
||||
LB_BOOTSTRAP_QEMU_ARCHITECTURES="${LB_BOOTSTRAP_QEMU_ARCHITECTURES}"
|
||||
|
||||
# \$LB_BOOTSTRAP_QEMU_EXCLUDE: packages to exclude during foreign bootstrap
|
||||
# (Default: ${LB_BOOTSTRAP_QEMU_EXCLUDE})
|
||||
LB_BOOTSTRAP_QEMU_EXCLUDE="${LB_BOOTSTRAP_QEMU_EXCLUDE}"
|
||||
|
||||
# \$LB_BOOTSTRAP_QEMU_STATIC: static qemu binary for foreign bootstrap
|
||||
# (Default: ${LB_BOOTSTRAP_QEMU_STATIC})
|
||||
LB_BOOTSTRAP_QEMU_STATIC="${LB_BOOTSTRAP_QEMU_STATIC}"
|
||||
EOF
|
||||
|
||||
# Creating lb_chroot_* configuration
|
||||
|
|
Loading…
Reference in New Issue