Commit d31a2555 authored by Michael Shigorin's avatar Michael Shigorin

non-native ARM support via qemu

mkimage and hasher can make use of qemu to run non-native binaries while working on the chroots; thanks kas@, manowar@ and sbolshakov@ for implementing this functionality as well as providing nice examples through mkimage-profiles-arm and mkimage-profile-armrootfs. This required the architecture check to be added since baking a tarball with "arm" as its specified arch and x86_64 inside isn't particularly good thing to let slip through; however the implementation is quite fragile, bugreports and patches are seriously welcome. NB: APTCONF evaluation order between lazy make and nimble shell turned out to be quite a delicate issue in this particular case.
parent 03ba4631
Для сборки с применением трансляции посредством QEMU
выполните от имени root следующие команды:
apt-get install qemu-user-binfmt_misc
modprobe binfmt_misc
echo ":arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/.host/qemu-arm:" > /proc/sys/fs/binfmt_misc/register
echo 32768 > /proc/sys/vm/mmap_min_addr
Если файл /proc/sys/fs/binfmt_misc/register не существует,
потребуется установить и загрузить иное ядро (например, std-def).
Также нужен sources.list с указанием arm-репозитория
и ссылающийся на него apt.conf (см. apt.conf.sample);
например:
--- sources.list.sisyphus.arm
rpm http://ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus arm classic
---
......@@ -48,6 +48,7 @@ COPY_TREE = ./files
# outdir shouldn't be wiped clean before use
CLEANUP_OUTDIR ?=
GLOBAL_TARGET := $(ARCH)
GLOBAL_HSH_APT_CONFIG := $(wildcard $(APTCONF))
# the lib/build-*.mk comes from features.in/build-*/lib
......@@ -88,4 +89,6 @@ debug:
@echo "TOPDIR=$(TOPDIR)"
@echo "IMAGEDIR=$(IMAGEDIR)"
@echo "ARCH=$(ARCH)"
@echo "GLOBAL_TARGET=$(GLOBAL_TARGET)"
@echo "GLOBAL_HSH_APT_CONFIG=$(GLOBAL_HSH_APT_CONFIG)"
@echo "GLOBAL_HSH_USE_QEMU=$(GLOBAL_HSH_USE_QEMU)"
......@@ -3,7 +3,7 @@ ANSI_OK ?= 1;32
ANSI_FAIL ?= 1;31
MAX_ERRORS = 3
GOTCHA := ^(((\*\* )?(E:|[Ee]rror|[Ww]arning).*)|(.* (conflicts|Depends:) .*)|(.* (Stop|failed)\.))$$
GOTCHA := ^(((\*\* )?(E:|[Ee]rror|[Ww]arning).*)|(.* (conflicts|Depends:) .*)|(.* (Stop|failed|not found)\.))$$
ifndef MKIMAGE_PROFILES
$(error this makefile is designed to be included in toplevel one)
......@@ -20,8 +20,13 @@ LOWSPACE = 1024
# it's also nice to know how long and much it takes
START += time -f "%E %PCPU %Mk"
ifneq (,$(wildcard $(subst :,/$(ARCH) ,$(PATH):)))
# /usr/bin/{i586,x86_64} are setarch(8) symlinks but arm is not
# /usr/bin/{i586,x86_64} are setarch(8) symlinks but arm is not;
# also check whether non-x86 build is running native
ifeq (,$(wildcard $(subst :,/$(ARCH) ,$(PATH):)))
ifeq (,$(findstring $(ARCH),$(shell uname -m)))
export GLOBAL_HSH_USE_QEMU=$(ARCH)
endif
else
START += $(ARCH)
endif
......
......@@ -52,13 +52,25 @@ profile/init: distclean
fi $(LOG); \
fi; \
{ \
eval `apt-config shell $${APTCONF:+-c=$(wildcard $(APTCONF))} \
APTCONF="$(wildcard $(APTCONF))"; \
echo "** using $${APTCONF:-system apt configuration}:"; \
eval `apt-config shell $${APTCONF:+-c=$$APTCONF} \
SOURCELIST Dir::Etc::sourcelist/f \
SOURCEPARTS Dir::Etc::sourceparts/d`; \
find "$$SOURCEPARTS" -name '*.list' \
| xargs egrep -Rhv '^#|^[[:blank:]]*$$' "$$SOURCELIST" && \
| xargs egrep -Rhv '^#|^[[:blank:]]*$$' "$$SOURCELIST" \
| tee $(BUILDDIR)/sources.list; \
echo; \
} $(LOG); \
if ! grep -q "[ ]$(ARCH)[ ]" $(BUILDDIR)/sources.list; then \
echo -n "requested arch '$$ARCH' unavailable" >&2; \
if [ -z "$(APTCONF)" ]; then \
echo " (no APTCONF)"; \
else \
echo; \
fi >&2; \
exit 1; \
fi; \
if type -t git >&/dev/null; then \
if cd $(BUILDDIR); then \
git init -q && \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment