From e55744bb195f0d665332ceb48acb57b4a4e186b5 Mon Sep 17 00:00:00 2001 From: ficus Date: Tue, 11 Sep 2012 01:16:38 +0200 Subject: update to FBx public-0.1 freedom-maker Snapshot commit with no torouter-specific changes re-applied. Updated freedom-maker image to a significantly more recent version, used by the FreedomBox project. This includes a shift from debian "stable" to "testing" (wheezy), which has a Linux 3.2 kernel. date Fri, 24 Aug 2012 03:50:41 +0000 repo git://anonscm.debian.org/freedombox/freedom-maker.git commit de1f66f0651a3a7c306331eeda1db93535b1470a (public-0.1) --- freedom-maker/Makefile | 124 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 112 insertions(+), 12 deletions(-) (limited to 'freedom-maker/Makefile') diff --git a/freedom-maker/Makefile b/freedom-maker/Makefile index e8fc80a..5adc490 100644 --- a/freedom-maker/Makefile +++ b/freedom-maker/Makefile @@ -1,17 +1,117 @@ -# copy DreamPlug root filesystem to a usb stick with an ext3 partition -dreamstick: stamp-dreamplug-rootfs - mount /media/freedom - sudo rsync -atvz --progress --delete build/dreamplug/ /media/freedom/ - umount /media/freedom +# /usr/bin/make + +# armel amd64 i386 +ARCHITECTURE = armel +# dreamplug guruplug +MACHINE = dreamplug +# card usb +DESTINATION = card +BUILD = $(MACHINE)-$(ARCHITECTURE)-$(DESTINATION) +BUILD_DIR = build/$(ARCHITECTURE) +MOUNTPOINT = /media/freedom +BOOTPOINT = $(MOUNTPOINT)/boot +DEVICE = /dev/sdb +TODAY = `date +%Y.%m%d` +NAME = freedombox-unstable_$(TODAY)_$(BUILD) +IMAGE = $(NAME).img +ARCHIVE = $(NAME).tar.bz2 +LOOP = /dev/loop0 # populate a tree with DreamPlug root filesystem -stamp-dreamplug-rootfs: fbx-armel.conf fbx-base.conf mk_dreamplug_rootfs - sudo ./mk_dreamplug_rootfs - touch stamp-dreamplug-rootfs +rootfs: rootfs-$(ARCHITECTURE) +rootfs-$(ARCHITECTURE): multistrap-configs/fbx-base.conf \ + multistrap-configs/fbx-$(ARCHITECTURE).conf \ + mk_dreamplug_rootfs \ + bin/projects bin/finalize bin/projects-chroot + -sudo umount `pwd`/$(BUILD_DIR)/var/cache/apt/ + sudo ./mk_dreamplug_rootfs $(ARCHITECTURE) multistrap-configs/fbx-$(ARCHITECTURE).conf + touch rootfs-$(ARCHITECTURE) + +# copy DreamPlug root filesystem to a usb stick or microSD card +# stick assumed to have 2 partitions, 128meg FAT and the rest ext3 partition +image: rootfs-$(ARCHITECTURE) + -umount $(BOOTPOINT) + -umount $(MOUNTPOINT) + mount $(MOUNTPOINT) + sudo mkdir -p $(BOOTPOINT) + mount $(BOOTPOINT) + sudo rsync -atvz --progress --delete --exclude=boot $(BUILD_DIR)/ $(MOUNTPOINT)/ + cp $(BUILD_DIR)/boot/* $(BOOTPOINT)/ +ifeq ($(DESTINATION),usb) +# prevent the first-run script from running during boot. +# we'll do this during copy2dream. + rm $(MOUNTPOINT)/etc/rc1.d/S01first-run $(MOUNTPOINT)/etc/rc2.d/S01first-run +# add u-boot binary for the DreamPlug to the FAT partition for easy access + cp -r $(MOUNTPOINT)/usr/lib/u-boot/dreamplug $(MOUNTPOINT)/boot +endif +ifeq ($(DESTINATION),card) +# we don't need to copy2dream, this is the microSD card. + sudo rm $(MOUNTPOINT)/sbin/copy2dream +# fix fstab for the SD card. + sudo sh -c "sed -e 's/sdc1/sda1/g' < $(BUILD_DIR)/etc/fstab > $(MOUNTPOINT)/etc/fstab" +endif +ifeq ($(MACHINE),guruplug) +# we can't flash the guru plug's kernel + mkdir -p $(MOUNTPOINT)/var/freedombox/ + touch $(MOUNTPOINT)/var/freedombox/dont-tweak-kernel +endif + sync + sleep 1 + umount $(BOOTPOINT) + umount $(MOUNTPOINT) + @echo "Build complete." + +# build a virtualbox image +virtualbox-image: stamp-vbox-predepend + ./mk_virtualbox_image freedombox-unstable_$(TODAY)_virtualbox-i386-hdd + +# build the weekly test image +weekly-image: image +# if we aren't installing to an armel system, assume we need a bootloader. +ifneq ($(ARCHITECTURE),armel) +# also, try my best to protect users from themselves: +ifneq ($(DEVICE),/dev/sda) + sudo grub-install $(DEVICE) +endif +endif + dd if=$(DEVICE) of=$(IMAGE) bs=1M + @echo "Image copied. The microSD card may now be removed." + tar -cjvf $(ARCHIVE) $(IMAGE) + +# +# meta +# + +# install required files so users don't need to do it themselves. +stamp-predepend: + sudo sh -c "apt-get install multistrap qemu-user-static u-boot-tools git mercurial" + touch stamp-predepend + +stamp-vbox-predepend: + sudo sh -c "apt-get install debootstrap extlinux qemu-utils parted mbr kpartx python-cliapp" + touch stamp-vbox-predepend clean: - rm -f stamp-dreamplug-rootfs - sudo rm -rf build/dreamplug +# just in case I tried to build before plugging in the USB drive. + -sudo umount `pwd`/$(BUILD_DIR)/var/cache/apt/ + sudo rm -rf $(BUILD_DIR) + -rm -f $(IMAGE) $(ARCHIVE) + -rm -f rootfs-* stamp-* + +distclean: clean + sudo rm -rf build + +# remove all data from the microSD card to repopulate it with a pristine image. +clean-card: + -umount $(BOOTPOINT) + -umount $(MOUNTPOINT) + + sudo mkdir -p $(BOOTPOINT) + mount $(BOOTPOINT) + sudo rm -rf $(BOOTPOINT)/* + umount $(BOOTPOINT) -distclean: clean - rm -rf build + sudo mkdir -p $(MOUNTPOINT) + mount $(MOUNTPOINT) + sudo rm -rf $(MOUNTPOINT)/* + umount $(MOUNTPOINT) -- cgit v1.2.3