Image type
This commit is contained in:
parent
58b37a35b9
commit
975de7039c
|
@ -50,6 +50,7 @@ VMDEBOOTSTRAP_REPO=git://git.liw.fi/vmdebootstrap
|
||||||
VMDEBOOTSTRAP_VERSION=0.8
|
VMDEBOOTSTRAP_VERSION=0.8
|
||||||
MAKEFILE=${PROJECT_NAME}-image-makefile
|
MAKEFILE=${PROJECT_NAME}-image-makefile
|
||||||
IMAGE_SIZE=4G
|
IMAGE_SIZE=4G
|
||||||
|
IMAGE_TYPE='full'
|
||||||
|
|
||||||
USERNAME=$(echo $USER)
|
USERNAME=$(echo $USER)
|
||||||
PASSWORD=
|
PASSWORD=
|
||||||
|
@ -258,6 +259,14 @@ rm -rf $BUILD_DIR/vendor
|
||||||
chown -R $CURR_USER:$CURR_USER $BUILD_DIR
|
chown -R $CURR_USER:$CURR_USER $BUILD_DIR
|
||||||
cd $BUILD_DIR
|
cd $BUILD_DIR
|
||||||
|
|
||||||
|
if [[ $MINIMAL_INSTALL == "yes" ]]; then
|
||||||
|
IMAGE_TYPE='min'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $ONION_ONLY != "no" ]]; then
|
||||||
|
IMAGE_TYPE='onion'
|
||||||
|
fi
|
||||||
|
|
||||||
cd $BUILD_DIR
|
cd $BUILD_DIR
|
||||||
make $IMAGE_TYPE \
|
make $IMAGE_TYPE \
|
||||||
USERNAME="$USERNAME" \
|
USERNAME="$USERNAME" \
|
||||||
|
@ -273,7 +282,8 @@ make $IMAGE_TYPE \
|
||||||
GENERIC_IMAGE="$GENERIC_IMAGE" \
|
GENERIC_IMAGE="$GENERIC_IMAGE" \
|
||||||
MINIMAL_INSTALL="$MINIMAL_INSTALL" \
|
MINIMAL_INSTALL="$MINIMAL_INSTALL" \
|
||||||
SSH_PORT="$SSH_PORT" \
|
SSH_PORT="$SSH_PORT" \
|
||||||
ONION_ONLY="$ONION_ONLY"
|
ONION_ONLY="$ONION_ONLY" \
|
||||||
|
IMAGE_TYPE="$IMAGE_TYPE"
|
||||||
|
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
echo $'Build failed'
|
echo $'Build failed'
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
MIRROR ?= http://httpredir.debian.org/debian
|
MIRROR ?= http://httpredir.debian.org/debian
|
||||||
BUILD_MIRROR ?= http://httpredir.debian.org/debian
|
BUILD_MIRROR ?= http://httpredir.debian.org/debian
|
||||||
IMAGE_SIZE ?= 8G
|
IMAGE_SIZE ?= 8G
|
||||||
|
IMAGE_TYPE ?= 'full'
|
||||||
SUITE ?= jessie
|
SUITE ?= jessie
|
||||||
# include source packages in image?
|
# include source packages in image?
|
||||||
SOURCE ?= false
|
SOURCE ?= false
|
||||||
|
@ -37,7 +38,7 @@ SOURCE ?= false
|
||||||
# yes no
|
# yes no
|
||||||
BUILD = $(MACHINE)-$(ARCHITECTURE)
|
BUILD = $(MACHINE)-$(ARCHITECTURE)
|
||||||
TODAY := $(shell date +%Y-%m-%d)
|
TODAY := $(shell date +%Y-%m-%d)
|
||||||
NAME = build/$(PROJECT_NAME)-$(TODAY)_$(BUILD)
|
NAME = build/$(PROJECT_NAME)-$(IMAGE_TYPE)-$(TODAY)_$(BUILD)
|
||||||
IMAGE = $(NAME).img
|
IMAGE = $(NAME).img
|
||||||
ARCHIVE = $(NAME).tar.bz2
|
ARCHIVE = $(NAME).tar.bz2
|
||||||
SIGNATURE = $(ARCHIVE).sig
|
SIGNATURE = $(ARCHIVE).sig
|
||||||
|
@ -79,144 +80,144 @@ MAKE_IMAGE = ARCHITECTURE=$(ARCHITECTURE) MACHINE=$(MACHINE) SOURCE=$(SOURCE) \
|
||||||
|
|
||||||
# build Beaglebone SD card image
|
# build Beaglebone SD card image
|
||||||
beaglebone: prep
|
beaglebone: prep
|
||||||
$(eval ARCHITECTURE = armhf)
|
$(eval ARCHITECTURE = armhf)
|
||||||
$(eval MACHINE = beaglebone)
|
$(eval MACHINE = beaglebone)
|
||||||
$(MAKE_IMAGE)
|
$(MAKE_IMAGE)
|
||||||
$(TAR) $(ARCHIVE) $(IMAGE)
|
$(TAR) $(ARCHIVE) $(IMAGE)
|
||||||
@echo ""
|
@echo ""
|
||||||
$(SIGN)
|
$(SIGN)
|
||||||
@echo "Build complete."
|
@echo "Build complete."
|
||||||
|
|
||||||
# build Cubieboard2 SD card image
|
# build Cubieboard2 SD card image
|
||||||
cubieboard2: prep
|
cubieboard2: prep
|
||||||
$(eval ARCHITECTURE = armhf)
|
$(eval ARCHITECTURE = armhf)
|
||||||
$(eval MACHINE = cubieboard2)
|
$(eval MACHINE = cubieboard2)
|
||||||
$(MAKE_IMAGE)
|
$(MAKE_IMAGE)
|
||||||
$(TAR) $(ARCHIVE) $(IMAGE)
|
$(TAR) $(ARCHIVE) $(IMAGE)
|
||||||
@echo ""
|
@echo ""
|
||||||
$(SIGN)
|
$(SIGN)
|
||||||
@echo "Build complete."
|
@echo "Build complete."
|
||||||
|
|
||||||
# build CubieTruck SD card image
|
# build CubieTruck SD card image
|
||||||
cubietruck: prep
|
cubietruck: prep
|
||||||
$(eval ARCHITECTURE = armhf)
|
$(eval ARCHITECTURE = armhf)
|
||||||
$(eval MACHINE = cubietruck)
|
$(eval MACHINE = cubietruck)
|
||||||
$(MAKE_IMAGE)
|
$(MAKE_IMAGE)
|
||||||
$(TAR) $(ARCHIVE) $(IMAGE)
|
$(TAR) $(ARCHIVE) $(IMAGE)
|
||||||
@echo ""
|
@echo ""
|
||||||
$(SIGN)
|
$(SIGN)
|
||||||
@echo "Build complete."
|
@echo "Build complete."
|
||||||
|
|
||||||
# build A20 OLinuXino Lime2 SD card image
|
# build A20 OLinuXino Lime2 SD card image
|
||||||
a20-olinuxino-lime2: prep
|
a20-olinuxino-lime2: prep
|
||||||
$(eval ARCHITECTURE = armhf)
|
$(eval ARCHITECTURE = armhf)
|
||||||
$(eval MACHINE = a20-olinuxino-lime2)
|
$(eval MACHINE = a20-olinuxino-lime2)
|
||||||
$(MAKE_IMAGE)
|
$(MAKE_IMAGE)
|
||||||
$(TAR) $(ARCHIVE) $(IMAGE)
|
$(TAR) $(ARCHIVE) $(IMAGE)
|
||||||
@echo ""
|
@echo ""
|
||||||
$(SIGN)
|
$(SIGN)
|
||||||
@echo "Build complete."
|
@echo "Build complete."
|
||||||
|
|
||||||
# build an i386 image
|
# build an i386 image
|
||||||
i386: prep
|
i386: prep
|
||||||
$(eval ARCHITECTURE = i386)
|
$(eval ARCHITECTURE = i386)
|
||||||
$(eval MACHINE = all)
|
$(eval MACHINE = all)
|
||||||
$(MAKE_IMAGE)
|
$(MAKE_IMAGE)
|
||||||
$(TAR) $(ARCHIVE) $(IMAGE)
|
$(TAR) $(ARCHIVE) $(IMAGE)
|
||||||
@echo ""
|
@echo ""
|
||||||
$(SIGN)
|
$(SIGN)
|
||||||
@echo "Build complete."
|
@echo "Build complete."
|
||||||
|
|
||||||
# build an amd64 image
|
# build an amd64 image
|
||||||
amd64: prep
|
amd64: prep
|
||||||
$(eval ARCHITECTURE = amd64)
|
$(eval ARCHITECTURE = amd64)
|
||||||
$(eval MACHINE = all)
|
$(eval MACHINE = all)
|
||||||
$(MAKE_IMAGE)
|
$(MAKE_IMAGE)
|
||||||
$(TAR) $(ARCHIVE) $(IMAGE)
|
$(TAR) $(ARCHIVE) $(IMAGE)
|
||||||
@echo ""
|
@echo ""
|
||||||
$(SIGN)
|
$(SIGN)
|
||||||
@echo "Build complete."
|
@echo "Build complete."
|
||||||
|
|
||||||
# build a virtualbox image
|
# build a virtualbox image
|
||||||
virtualbox: virtualbox-i386
|
virtualbox: virtualbox-i386
|
||||||
|
|
||||||
virtualbox-i386: prep
|
virtualbox-i386: prep
|
||||||
$(eval ARCHITECTURE = i386)
|
$(eval ARCHITECTURE = i386)
|
||||||
$(eval MACHINE = virtualbox)
|
$(eval MACHINE = virtualbox)
|
||||||
$(MAKE_IMAGE)
|
$(MAKE_IMAGE)
|
||||||
# Convert image to vdi hard drive
|
# Convert image to vdi hard drive
|
||||||
VBoxManage convertdd $(NAME).img $(NAME).vdi
|
VBoxManage convertdd $(NAME).img $(NAME).vdi
|
||||||
$(TAR) $(ARCHIVE) $(NAME).vdi
|
$(TAR) $(ARCHIVE) $(NAME).vdi
|
||||||
@echo ""
|
@echo ""
|
||||||
$(SIGN)
|
$(SIGN)
|
||||||
@echo "Build complete."
|
@echo "Build complete."
|
||||||
|
|
||||||
virtualbox-amd64: prep
|
virtualbox-amd64: prep
|
||||||
$(eval ARCHITECTURE = amd64)
|
$(eval ARCHITECTURE = amd64)
|
||||||
$(eval MACHINE = virtualbox)
|
$(eval MACHINE = virtualbox)
|
||||||
$(MAKE_IMAGE)
|
$(MAKE_IMAGE)
|
||||||
# Convert image to vdi hard drive
|
# Convert image to vdi hard drive
|
||||||
VBoxManage convertdd $(NAME).img $(NAME).vdi
|
VBoxManage convertdd $(NAME).img $(NAME).vdi
|
||||||
$(TAR) $(ARCHIVE) $(NAME).vdi
|
$(TAR) $(ARCHIVE) $(NAME).vdi
|
||||||
@echo ""
|
@echo ""
|
||||||
$(SIGN)
|
$(SIGN)
|
||||||
@echo "Build complete."
|
@echo "Build complete."
|
||||||
|
|
||||||
test: test-virtualbox
|
test: test-virtualbox
|
||||||
|
|
||||||
test-virtualbox: virtualbox
|
test-virtualbox: virtualbox
|
||||||
$(eval VM_NAME = $(PROJECT_NAME)-test)
|
$(eval VM_NAME = $(PROJECT_NAME)-test)
|
||||||
VBoxManage createvm --name $(VM_NAME) --ostype "Debian" --register
|
VBoxManage createvm --name $(VM_NAME) --ostype "Debian" --register
|
||||||
VBoxManage storagectl $(VM_NAME) --name "SATA Controller" --add sata \
|
VBoxManage storagectl $(VM_NAME) --name "SATA Controller" --add sata \
|
||||||
--controller IntelAHCI
|
--controller IntelAHCI
|
||||||
VBoxManage storageattach $(VM_NAME) --storagectl "SATA Controller" \
|
VBoxManage storageattach $(VM_NAME) --storagectl "SATA Controller" \
|
||||||
--port 0 --device 0 --type hdd --medium $(NAME).vdi
|
--port 0 --device 0 --type hdd --medium $(NAME).vdi
|
||||||
VBoxManage modifyvm $(VM_NAME) --pae on --memory 1024 --vram 128 \
|
VBoxManage modifyvm $(VM_NAME) --pae on --memory 1024 --vram 128 \
|
||||||
--nic1 nat --natpf1 ,tcp,,$(TEST_SSH_PORT),,22
|
--nic1 nat --natpf1 ,tcp,,$(TEST_SSH_PORT),,22
|
||||||
VBoxManage startvm $(VM_NAME) --type headless
|
VBoxManage startvm $(VM_NAME) --type headless
|
||||||
sleep $(TEST_FIRSTRUN_WAIT_TIME) # wait for first-run to complete
|
sleep $(TEST_FIRSTRUN_WAIT_TIME) # wait for first-run to complete
|
||||||
echo frdm |sshpass -p frdm ssh -o UserKnownHostsFile=/dev/null \
|
echo frdm |sshpass -p frdm ssh -o UserKnownHostsFile=/dev/null \
|
||||||
-o StrictHostKeyChecking=no -t -t \
|
-o StrictHostKeyChecking=no -t -t \
|
||||||
-p $(TEST_SSH_PORT) fbx@127.0.0.1 \
|
-p $(TEST_SSH_PORT) fbx@127.0.0.1 \
|
||||||
"sudo plinth --diagnose" \
|
"sudo plinth --diagnose" \
|
||||||
|tee build/$(VM_NAME)-results_$(TODAY).log
|
|tee build/$(VM_NAME)-results_$(TODAY).log
|
||||||
VBoxManage controlvm $(VM_NAME) poweroff
|
VBoxManage controlvm $(VM_NAME) poweroff
|
||||||
VBoxManage modifyvm $(VM_NAME) --hda none
|
VBoxManage modifyvm $(VM_NAME) --hda none
|
||||||
VBoxManage unregistervm $(VM_NAME) --delete
|
VBoxManage unregistervm $(VM_NAME) --delete
|
||||||
|
|
||||||
# build a qemu image
|
# build a qemu image
|
||||||
qemu: qemu-i386
|
qemu: qemu-i386
|
||||||
|
|
||||||
qemu-i386: prep
|
qemu-i386: prep
|
||||||
$(eval ARCHITECTURE = i386)
|
$(eval ARCHITECTURE = i386)
|
||||||
$(eval MACHINE = qemu)
|
$(eval MACHINE = qemu)
|
||||||
$(MAKE_IMAGE)
|
$(MAKE_IMAGE)
|
||||||
# Convert image to qemu format
|
# Convert image to qemu format
|
||||||
qemu-img convert -O qcow2 $(NAME).img $(NAME).qcow2
|
qemu-img convert -O qcow2 $(NAME).img $(NAME).qcow2
|
||||||
$(TAR) $(ARCHIVE) $(NAME).qcow2
|
$(TAR) $(ARCHIVE) $(NAME).qcow2
|
||||||
@echo ""
|
@echo ""
|
||||||
$(SIGN)
|
$(SIGN)
|
||||||
@echo "Build complete."
|
@echo "Build complete."
|
||||||
|
|
||||||
qemu-x86_64: prep
|
qemu-x86_64: prep
|
||||||
$(eval ARCHITECTURE = x86_64)
|
$(eval ARCHITECTURE = x86_64)
|
||||||
$(eval MACHINE = qemu)
|
$(eval MACHINE = qemu)
|
||||||
$(MAKE_IMAGE)
|
$(MAKE_IMAGE)
|
||||||
# Convert image to qemu format
|
# Convert image to qemu format
|
||||||
qemu-img convert -O qcow2 $(NAME).img $(NAME).qcow2
|
qemu-img convert -O qcow2 $(NAME).img $(NAME).qcow2
|
||||||
$(TAR) $(ARCHIVE) $(NAME).qcow2
|
$(TAR) $(ARCHIVE) $(NAME).qcow2
|
||||||
@echo ""
|
@echo ""
|
||||||
$(SIGN)
|
$(SIGN)
|
||||||
@echo "Build complete."
|
@echo "Build complete."
|
||||||
|
|
||||||
vendor/vmdebootstrap/vmdebootstrap: vendor-patches/vmdebootstrap/*.patch
|
vendor/vmdebootstrap/vmdebootstrap: vendor-patches/vmdebootstrap/*.patch
|
||||||
freedombone-image-vmdebootstrap
|
freedombone-image-vmdebootstrap
|
||||||
|
|
||||||
prep: vendor/vmdebootstrap/vmdebootstrap
|
prep: vendor/vmdebootstrap/vmdebootstrap
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm -f build/$(PROJECT_NAME).log
|
-rm -f build/$(PROJECT_NAME).log
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
sudo rm -rf build
|
sudo rm -rf build
|
||||||
|
|
Loading…
Reference in New Issue