[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH 3/4] Add support for building for other architectures



Hey,

Hmm, this didn't actually work, as it turns out. I'd only ever used
this method for building i386 on amd64, which does work. Trying to use
it for other architectures blew up.

I am working on a better approach using the second-stage mode in
debootstrap and qemu, but it's after 00:30 my time, so I'll continue
work on this tomorrow.

The main reason I'm adding this feature is I was talking to friend at
the OpenStack Summit a few days ago who complained that people don't
tend to support architectures which aren't amd64. The context was
Docker, but I think extending that to cloud images is fair.

Cheers,
Andrew

On Thu, 2017-11-09 at 23:28 +1300, andrew@etc.gen.nz wrote:
> From: Andrew Ruthven <puck@catalyst.net.nz>
> 
> ---
>  Makefile | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 9f4a6d7..21962e1 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -5,6 +5,8 @@ UPPER_CLOUD = $(shell echo $(CLOUD) | tr '[:lower:]'
> '[:upper:]')
>  UPPER_DIST = $(shell echo $(DIST) | tr '[:lower:]' '[:upper:]')
>  PWD := $(shell readlink -f .)
>  SPACE = 8
> +ARCH = $(shell dpkg --print-architecture)
> +UPPER_ARCH = $(shell echo $(ARCH) | tr '[:lower:]' '[:upper:]')
>  
>  VALID_CLOUDS = (azure|ec2|gce|openstack|vm|vagrant)
>  VALID_DISTS = (stretch|buster)
> @@ -23,7 +25,7 @@ help:
>  	@echo "  WHERE <DIST> is buster or stretch"
>  	@echo "    And <CLOUD> is azure, ec2, gce, openstack,
> vagrant"
>  
> -_image.raw: config_space/basefiles/$(UPPER_DIST).tar.gz
> +_image.raw:
> config_space/basefiles/$(UPPER_DIST)_$(UPPER_ARCH).tar.gz
>  	@echo $(CLOUD) | egrep -q "$(VALID_CLOUDS)" || { \
>  		 echo "$(CLOUD) is an invalid. Valid clouds are
> $(VALID_CLOUDS)"; exit 1; }
>  	@echo $(DIST) | egrep -q "$(VALID_DISTS)" || { \
> @@ -31,11 +33,11 @@ _image.raw:
> config_space/basefiles/$(UPPER_DIST).tar.gz
>  	sudo fai-diskimage -v \
>  		--hostname debian-$(DIST) \
>  		--size $(SPACE)G \
> -		--class
> DEBIAN,$(UPPER_DIST),AMD64,GRUB_PC,CLOUD,$(UPPER_CLOUD) \
> -		--cspace $(PWD)/config_space $(CLOUD)-$(DIST)-
> image.raw
> +		--class
> DEBIAN,$(UPPER_DIST),$(UPPER_ARCH),$(UPPER_DIST)_$(UPPER_ARCH),GRUB_P
> C,CLOUD,$(UPPER_CLOUD) \
> +		--cspace $(PWD)/config_space $(CLOUD)-$(DIST)-
> $(ARCH)-image.raw
>  	if [ "$(FORMAT_NEEDED)" = "vhd" ]; then \
>  		qemu-img convert -f raw -o
> subformat=fixed,force_size -O vpc \
> -		$(CLOUD)-$(DIST)-image.raw $(CLOUD)-$(DIST)-
> image.vhd; fi
> +		$(CLOUD)-$(DIST)-$(ARCH)-image.raw $(CLOUD)-$(DIST)-
> $(ARCH)-image.vhd; fi
>  buster-image-%:
>  	find config_space/basefiles -type f -atime +1 -print0 |
> xargs -0 -r rm
>  	${MAKE} _image.raw CLOUD=$* DIST=buster
> @@ -44,9 +46,9 @@ stretch-image-%:
>  	find config_space/basefiles -type f -atime +1 -print0 |
> xargs -0 -r rm
>  	${MAKE} _image.raw CLOUD=$* DIST=stretch
>  
> -config_space/basefiles/$(UPPER_DIST).tar.gz:
> +config_space/basefiles/$(UPPER_DIST)_$(UPPER_ARCH).tar.gz:
>  	$(eval DIR := $(shell mktemp -d))
> -	sudo debootstrap $(DIST) $(DIR) http://deb.debian.org/debian
> +	sudo debootstrap --arch=$(ARCH) $(DIST) $(DIR) http://deb.de
> bian.org/debian
>  	(cd $(DIR); sudo tar cfz $(PWD)/$@ *)
>  	sudo chown $(USER) $@
>  	rm -rf $(DIR)
-- 
Andrew Ruthven, Wellington, New Zealand
andrew@etc.gen.nz             | linux.conf.au 2018, Sydney, AU 
  New Zealand's only Cloud:   |  Just a little bit of history
https://catalyst.net.nz/cloud |     http://linux.conf.au


Reply to: