8000 Support for `amd64` by JedMeister · Pull Request #31 · turnkeylinux/fab · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Support for amd64 #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions contrib/install-arm-on-amd-deps
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash -eu

DEBUG=${DEBUG:-}
[[ -z "$DEBUG" ]] || set -x

QUIET=
pkgs=(binfmt-support qemu-system-arm qemu-user-static)
bins=(/usr/sbin/update-binfmts /usr/bin/qemu-system-arm /usr/bin/qemu-arm-static)
pkgs_to_install=()

usage() {
cat <<EOF< 10000 /span>
$(basename "$0") [-h|--help] [-q|--quiet]

Checks packages required to build arm64 on amd64 are installed
and if not, installs them.

args::

-h|--help show this help and exit
-q|--quiet no output

env vars::

DEBUG verbose debugging output - overrides -q|--quiet

EOF
exit
}

while [[ $# -ne 0 ]]; do
case $1 in
-h|--help)
usage;;
-q|--quiet)
QUIET=q;;
*)
echo "Unknown option: $1" >&2
exit 1;;
esac
shift
done

for i in "${!pkgs[@]}"; do
if ! which "${bins[$i]}" >/dev/null 2>&1; then
pkgs_to_install+=("${pkgs[$i]}")
fi
done

set +u # unset u - otherwise the test will give an "unbound variable" error
# shellcheck disable=SC2128
# even if there are no elements in a array; ${foo[@]} still isn't "empty"
if [[ -n "$pkgs_to_install" ]]; then
if [[ -n "$QUIET" ]]; then
echo "Installing: ${pkgs_to_install[*]}"
apt-get update
apt-get install -y "${pkgs_to_install[@]}"
echo ""
else
apt-get update >/dev/null 2>&1
apt-get install -y "${pkgs_to_install[@]}" >/dev/null 2>&1
fi
fi

update-binfmts --display | grep -i"$QUIET" aarch
5 changes: 4 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Build-Depends:
Standards-Version: 4.0.0

Package: fab
Architecture: any
Architecture: all
Depends:
cpp,
${misc:Depends},
Expand All @@ -25,4 +25,7 @@ Recommends:
Suggests:
dd,
wodim,
binfmt-support,
qemu-system-arm,
qemu-user-static
Description: TurnKey GNU/Linux product fabrication framework
1 change: 1 addition & 0 deletions debian/install
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
share/* usr/share/fab
contrib/install-arm-on-amd-deps usr/bin
4 changes: 2 additions & 2 deletions fab
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import sys
import os
from os.path import isdir, join, basename, relpath

from debian import debfile
from debian import debfile, deb822

from fablib.installer import (PoolInstaller,
LiveInstaller, Installer)
Expand Down Expand Up @@ -96,7 +96,7 @@ class AssociatedAppendAction(argparse.Action):
setattr(namespace, self.dest, [(option_string, values)])


def generate_index(dctrls: Dict[Dependency, debfile.Deb822]) -> str:
def generate_index(dctrls: Dict[Dependency, deb822.Deb822]) -> str:
fields = (
"Package",
"Essential",
Expand Down
33 changes: 25 additions & 8 deletions share/product.mk
EDB7
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# Free Software Foundation; either version 3 of the License, or (at your
# option) any later version.

HOST_ARCH := $(shell dpkg --print-architecture)

ifndef FAB_PATH
$(error FAB_PATH not defined - needed for default paths)
endif
Expand All @@ -16,27 +18,39 @@ ifndef RELEASE
$(error RELEASE not defined)
endif

ifdef FAB_ARCH
ifneq ($(FAB_ARCH),$(HOST_ARCH))
$(info building $(FAB_ARCH) on $(HOST_ARCH))
ifeq ($(HOST_ARCH),arm64)
$(error amd64 product can not be built on arm64)
endif
endif
else
FAB_ARCH := $(HOST_ARCH)
endif

DISTRO ?= $(shell dirname $(RELEASE))
CODENAME ?= $(shell basename $(RELEASE))

UBUNTU = $(shell [ $(DISTRO) = 'ubuntu' ] && echo 'y')
DEBIAN = $(shell [ $(DISTRO) = 'debian' ] && echo 'y')

FAB_ARCH ?= $(shell dpkg --print-architecture)

I386 = $(shell [ $(FAB_ARCH) = 'i386' ] && echo 'y')
AMD64 = $(shell [ $(FAB_ARCH) = 'amd64' ] && echo 'y')
ARM64 = $(shell [ $(FAB_ARCH) = 'arm64' ] && echo 'y')

ifndef FAB_ARCH_FAMILY
ifeq ($(I386),y)
FAB_ARCH_FAMILY=x86
FAB_INSTALL_OPTS := '--arch i386'
endif
ifeq ($(AMD64),y)
FAB_ARCH_FAMILY=x86
FAB_INSTALL_OPTS := '--arch amd64'
endif
ifeq ($(ARM64),y)
FAB_ARCH_FAMILY=arm
FAB_INSTALL_OPTS := '--arch arm64'
# NONFREE is used to get raspi-firmware and firmware-brcm80211
# NONFREE=1
endif
Expand All @@ -52,7 +66,7 @@ export FAB_POOL_PATH
endif

ifdef FAB_POOL_PATH
FAB_INSTALL_OPTS = '--no-deps'
FAB_INSTALL_OPTS += '--no-deps'
endif

ifndef FAB_HTTP_PROXY
Expand All @@ -65,7 +79,7 @@ endif

COMMON_PATCHES := turnkey.d $(COMMON_PATCHES)

CONF_VARS_BUILTIN ?= FAB_ARCH FAB_HTTP_PROXY I386 AMD64 ARM64 RELEASE DISTRO CODENAME DEBIAN UBUNTU KERNEL DEBUG CHROOT_ONLY
CONF_VARS_BUILTIN ?= FAB_ARCH HOST_ARCH FAB_HTTP_PROXY I386 AMD64 ARM64 RELEASE DISTRO CODENAME DEBIAN UBUNTU KERNEL DEBUG CHROOT_ONLY

define filter-undefined-vars
$(foreach var,$1,$(if $($(var)), $(var)))
Expand All @@ -80,9 +94,12 @@ export FAB_INSTALL_ENV = $(FAB_CHROOT_ENV)

# FAB_PATH dependent infrastructural components
FAB_SHARE_PATH ?= /usr/share/fab
BOOTSTRAP ?= $(FAB_PATH)/bootstraps/$(CODENAME)
ifneq ("$(wildcard $(FAB_PATH)/altstraps/$(CODENAME).core)", "")
BOOTSTRAP := $(FAB_PATH)/altstraps/$(CODENAME).core
BOOTSTRAP ?= $(FAB_PATH)/bootstraps/$(CODENAME)-$(FAB_ARCH)
ifneq ("$(wildcard $(FAB_PATH)/altstraps/$(CODENAME)-$(FAB_ARCH).core)", "")
BOOTSTRAP := $(FAB_PATH)/altstraps/$(CODENAME)-$(FAB_ARCH).core
endif
ifeq (,"$(wildcard $(BOOTSTRAP)"))
$(error bootstrap $(BOOTSTRAP) not found - download or build it first)
endif

CDROOTS_PATH ?= $(FAB_PATH)/cdroots
Expand Down Expand Up @@ -123,7 +140,7 @@ PLAN ?= plan/main
ROOT_OVERLAY ?= overlay
CDROOT_OVERLAY ?= cdroot.overlay
REMOVELIST ?= removelist
# undefine REMOVELIST if the file doesn't exist
# unset REMOVELIST if the file doesn't exist
ifeq ($(wildcard $(REMOVELIST)),)
REMOVELIST =
endif
Expand Down
0