Mail archive
alpine-devel

[alpine-devel] [PATCH] alpine-iso: add support to create Xen Dom0 LiveCD/USB

From: Roger Pau Monne <roger.pau_at_entel.upc.edu>
Date: Thu, 29 Dec 2011 14:08:00 +0100

A new profile has been added, called alpine-xen, that shoud be used
when trying to craft a Xen Dom0 LiveCD/USB.

Please review and comment.
---
 Makefile            |   67 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 alpine-xen.conf.mk  |    4 +++
 alpine-xen.packages |   10 +++++++
 3 files changed, 80 insertions(+), 1 deletions(-)
 create mode 100644 alpine-xen.conf.mk
 create mode 100644 alpine-xen.packages
diff --git a/Makefile b/Makefile
index 7fa36b2..5072a03 100755
--- a/Makefile
+++ b/Makefile
_at_@ -200,6 +200,47 @@ $(VSTEMPLATE):
 	_at_cd $(VSTEMPLATE_DIR) && $(TAR) -jcf $@ *
 
 #
+# apkovl rules
+#
+
+ifdef BUILD_APKOVL
+APKOVL_DEST	:= $(ISO_DIR)/$(BUILD_APKOVL).apkovl.tar.gz
+APKOVL_DIR	:= $(DESTDIR)/apkovl_$(BUILD_APKOVL)
+endif
+
+# Helper function to link a script to runlevel
+
+rc_add = \
+	_at_mkdir -p "$(APKOVL_DIR)"/etc/runlevels/"$(2)"; \
+	ln -sf /etc/init.d/"$(1)" "$(APKOVL_DIR)"/etc/runlevels/"$(2)"/"$(1)";
+
+$(ISO_DIR)/xen.apkovl.tar.gz:
+	_at_rm -rf "$(APKOVL_DIR)"
+	_at_mkdir -p "$(APKOVL_DIR)"
+	_at_mkdir -p "$(APKOVL_DIR)"/etc/apk
+	_at_mkdir -p "$(APKOVL_DIR)"/etc/network
+	_at_echo "auto lo" >> "$(APKOVL_DIR)"/etc/network/interfaces
+	_at_echo "iface lo inet loopback" >> "$(APKOVL_DIR)"/etc/network/interfaces
+	_at_echo "xen udev" >> "$(APKOVL_DIR)"/etc/apk/world
+	_at_echo "xen_netback" >> "$(APKOVL_DIR)"/etc/modules
+	_at_echo "xen_blkback" >> "$(APKOVL_DIR)"/etc/modules
+	$(call rc_add,devfs,sysinit)
+	$(call rc_add,dmesg,sysinit)
+	$(call rc_add,hwclock,boot)
+	$(call rc_add,modules,boot)
+	$(call rc_add,sysctl,boot)
+	$(call rc_add,hostname,boot)
+	$(call rc_add,bootmisc,boot)
+	$(call rc_add,syslog,boot)
+	$(call rc_add,mount-ro,shutdown)
+	$(call rc_add,killprocs,shutdown)
+	$(call rc_add,savecache,shutdown)
+	$(call rc_add,udev,sysinit)
+	$(call rc_add,udev-postmount,default)
+	$(call rc_add,xencommons,default)
+	_at_cd $(APKOVL_DIR) && $(TAR) -zcf $@ *
+	_at_echo "==> apkovl: built $@"
+#
 # ISO rules
 #
 
_at_@ -223,24 +264,42 @@ $(ISOLINUX_CFG):
 	_at_echo "$(SYSLINUX_SERIAL)" >$@
 	_at_echo "timeout 20" >>$@
 	_at_echo "prompt 1" >>$@
+ifeq ($(PROFILE), alpine-xen)
+	_at_echo "default xen-$(KERNEL_FLAVOR_DEFAULT)" >>$@
+	_at_for flavor in $(KERNEL_FLAVOR); do \
+		echo "label xen-$$flavor"; \
+		echo "	kernel /boot/mboot.c32"; \
+		echo "	append /boot/xen.gz --- /boot/$$flavor alpine_dev=cdrom:iso9660 modules=loop,squashfs,sd-mod,usb-storage,floppy,sr-mod modloop=/boot/$$flavor.modloop.squashfs $(BOOT_CONSOLE) --- /boot/$$flavor.gz"; \
+	done >>$_at_
+else
 	_at_echo "default $(KERNEL_FLAVOR_DEFAULT)" >>$@
 	_at_for flavor in $(KERNEL_FLAVOR); do \
 		echo "label $$flavor"; \
 		echo "	kernel /boot/$$flavor"; \
 		echo "	append initrd=/boot/$$flavor.gz alpine_dev=cdrom:iso9660 modules=loop,squashfs,sd-mod,usb-storage,floppy,sr-mod quiet $(BOOT_CONSOLE)"; \
 	done >>$_at_
+endif
 
 $(SYSLINUX_CFG): $(ALL_MODLOOP_DIRSTAMP)
 	_at_echo "==> iso: configure syslinux"
 	_at_echo "$(SYSLINUX_SERIAL)" >$@
 	_at_echo "timeout 20" >>$@
 	_at_echo "prompt 1" >>$@
+ifeq ($(PROFILE), alpine-xen)
+	_at_echo "default xen-$(KERNEL_FLAVOR_DEFAULT)" >>$@
+	_at_for flavor in $(KERNEL_FLAVOR); do \
+		echo "label xen-$$flavor"; \
+		echo "	kernel /boot/mboot.c32"; \
+		echo "	append /boot/xen.gz --- /boot/$$flavor alpine_dev=usbdisk:vfat modules=loop,squashfs,sd-mod,usb-storage modloop=/boot/$$flavor.modloop.squashfs $(BOOT_CONSOLE) --- /boot/$$flavor.gz"; \
+	done >>$_at_
+else
 	_at_echo "default $(KERNEL_FLAVOR_DEFAULT)" >>$@
 	_at_for flavor in $(KERNEL_FLAVOR); do \
 		echo "label $$flavor"; \
 		echo "	kernel /boot/$$flavor"; \
 		echo "	append initrd=/boot/$$flavor.gz alpine_dev=usbdisk:vfat modules=loop,squashfs,sd-mod,usb-storage quiet $(BOOT_CONSOLE)"; \
 	done >>$_at_
+endif
 
 clean-syslinux:
 	_at_rm -f $(SYSLINUX_CFG) $(ISOLINUX_CFG) $(ISOLINUX_BIN)
_at_@ -266,6 +325,12 @@ $(ISO_KERNEL_STAMP): $(MODLOOP_DIRSTAMP)
 	_at_mkdir -p $(dir $(ISO_KERNEL))
 	_at_apk fetch $(APK_OPTS) --stdout $(KERNEL_PKGNAME) \
 		| $(TAR) -C $(ISO_DIR) -xz boot
+ifeq ($(PROFILE), alpine-xen)
+	_at_apk fetch $(APK_OPTS) --stdout xen \
+		| $(TAR) -C $(ISO_DIR) -xz boot
+	_at_apk fetch $(APK_OPTS) --stdout syslinux \
+		| $(TAR) -xz usr/share/syslinux/mboot.c32 -O > $(ISO_DIR)/boot/mboot.c32
+endif
 	_at_rm -f $(ISO_KERNEL)
 	_at_ln -s vmlinuz-$(MODLOOP_KERNEL_RELEASE) $(ISO_KERNEL)
 	_at_rm -rf $(ISO_DIR)/.[A-Z]* $(ISO_DIR)/.[a-z]* $(ISO_DIR)/lib
_at_@ -281,7 +346,7 @@ $(APKOVL_STAMP):
 	fi
 	_at_touch $@
 
-$(ISOFS_DIRSTAMP): $(ALL_MODLOOP) $(ALL_INITFS) $(ISOLINUX_CFG) $(ISOLINUX_BIN) $(ALL_ISO_KERNEL) $(ISO_REPOS_DIRSTAMP) $(APKOVL_STAMP) $(SYSLINUX_CFG)
+$(ISOFS_DIRSTAMP): $(ALL_MODLOOP) $(ALL_INITFS) $(ISOLINUX_CFG) $(ISOLINUX_BIN) $(ALL_ISO_KERNEL) $(ISO_REPOS_DIRSTAMP) $(APKOVL_STAMP) $(SYSLINUX_CFG) $(APKOVL_DEST)
 	_at_echo "$(ALPINE_NAME)-$(ALPINE_RELEASE) $(BUILD_DATE)" \
 		> $(ISO_DIR)/.alpine-release
 	_at_touch $@
diff --git a/alpine-xen.conf.mk b/alpine-xen.conf.mk
new file mode 100644
index 0000000..016db33
--- /dev/null
+++ b/alpine-xen.conf.mk
_at_@ -0,0 +1,4 @@
+ALPINE_NAME     := alpine-xen
+MODLOOP_EXTRA   :=
+KERNEL_FLAVOR   := grsec
+BUILD_APKOVL    := xen
diff --git a/alpine-xen.packages b/alpine-xen.packages
new file mode 100644
index 0000000..b1cbd42
--- /dev/null
+++ b/alpine-xen.packages
_at_@ -0,0 +1,10 @@
+bkeymaps
+alpine-base
+alpine-mirrors
+wpa_supplicant
+wireless-tools
+openssl
+tzdata
+xen
+udev
+multipath-tools
-- 
1.7.7.1
---
Unsubscribe:  alpine-devel+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-devel+help_at_lists.alpinelinux.org
---
Received on Thu Dec 29 2011 - 14:08:00 UTC