###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
+# Copyright (C) 2007-2011 IPFire Team <info@ipfire.org> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
###############################################################################
# Installation Details
###############################################################################
-IMGinst := /install/images/$(SNAME)-$(VERSION).1gb-ext2.$(MACHINE)-$(ED)-core$(CORE).img
-IMGinsts := /install/images/$(SNAME)-$(VERSION).1gb-ext2-scon.$(MACHINE)-$(ED)-core$(CORE).img
+IMGinst := /install/images/$(SNAME)-$(VERSION).2gb-ext2.$(MACHINE)-full-core$(CORE).img
+IMGinsts := /install/images/$(SNAME)-$(VERSION).2gb-ext2-scon.$(MACHINE)-full-core$(CORE).img
MNThdd := /install/harddisk
IMGpart := /install/images/part_area
IMGboot := /install/images/bootfs
# don't change SIZEboot this without checking Image size
SIZEboot := 20
IMGroot := /install/images/rootfs
-SIZEroot := 500
+SIZEroot := 1400
IMGvar := /install/images/varfs
SIZEvar := 430
dd bs=1M if=/dev/zero of=$(IMGvar) count=$(SIZEvar)
# Format them
+ifeq "$(MACHINE_TYPE)" "arm"
+ mkfs.vfat $(IMGboot)
+else
mkfs.ext2 -F $(IMGboot)
+endif
mkfs.ext2 -F $(IMGroot)
mkfs.ext2 -F $(IMGvar)
mount -o loop $(IMGvar) $(MNThdd)/var
# Install IPFire
- tar -C $(MNThdd)/ -xvf /install/cdrom/$(SNAME)-$(VERSION).tlz --lzma
+ tar -C $(MNThdd)/ -xvaf /install/cdrom/$(SNAME)-$(VERSION).tlz
echo "LANGUAGE=en" >> $(MNThdd)/var/ipfire/main/settings
echo "HOSTNAME=$(SNAME)" >> $(MNThdd)/var/ipfire/main/settings
echo "THEME=ipfire" >> $(MNThdd)/var/ipfire/main/settings
- touch $(MNThdd)/lib/modules/$(KVER)-ipfire/modules.dep
- mv $(MNThdd)/bin/uname.bak $(MNThdd)/bin/uname
+ -touch $(MNThdd)/lib/modules/$(KVER)-ipfire/modules.dep
mkdir $(MNThdd)/proc
mount --bind /proc $(MNThdd)/proc
mount --bind /dev $(MNThdd)/dev
mount --bind /sys $(MNThdd)/sys
chroot $(MNThdd) /usr/bin/perl -e "require '/var/ipfire/lang.pl'; &Lang::BuildCacheLang"
+ sed -i -e "s|DEVICE1|UUID=$$(blkid -sUUID $(IMGboot) | cut -d'"' -f2)|g" $(MNThdd)/etc/fstab
+ifeq "$(MACHINE_TYPE)" "arm"
+ # ARM flash images have a VFAT partition for /boot.
+ sed -i -e "s|ext2|vfat|" $(MNThdd)/etc/fstab
+endif
+ sed -i -e "s|DEVICE2|#DEVICE2|g" $(MNThdd)/etc/fstab
+ sed -i -e "s|DEVICE3|UUID=$$(blkid -sUUID $(IMGroot) | cut -d'"' -f2)|g" $(MNThdd)/etc/fstab
+ sed -i -e "s|DEVICE4|UUID=$$(blkid -sUUID $(IMGvar) | cut -d'"' -f2)|g" $(MNThdd)/etc/fstab
+ sed -i -e "s|FSTYPE|ext2|g" $(MNThdd)/etc/fstab
+
+ifneq "$(MACHINE_TYPE)" "arm"
sed -i -e "s|MOUNT|ro|g" $(MNThdd)/boot/grub/grub.conf
sed -i -e "s|KVER|$(KVER)|g" $(MNThdd)/boot/grub/grub.conf
- sed -i -e "s|ROOT|/dev/sda3|g" $(MNThdd)/boot/grub/grub.conf
+ sed -i -e "s|ROOT|UUID=$$(blkid -sUUID $(IMGroot) | cut -d'"' -f2)|g" $(MNThdd)/boot/grub/grub.conf
ln -s grub.conf $(MNThdd)/boot/grub/menu.lst
- sed -i -e "s|DEVICE2|#DEVICE2|g" $(MNThdd)/etc/fstab
- sed -i -e "s|DEVICE|/dev/sda|g" $(MNThdd)/etc/fstab
- sed -i -e "s|FSTYPE|ext2|g" $(MNThdd)/etc/fstab
-# chroot $(MNThdd) /sbin/dracut --force --verbose /boot/ipfirerd-$(KVER) $(KVER)-ipfire
# Copy grub files manually
cp -f $(MNThdd)/usr/share/grub/i386-pc/* $(MNThdd)/boot/grub/
- #chroot $(MNThdd) /usr/sbin/grub-set-default 0
-
- # Create a script for rebuild-initrd and setup
- echo "#!/bin/bash" > $(MNThdd)/etc/rc.d/rcsysinit.d/S75firstsetup
- echo "/bin/rm -f /boot/ipfirerd-$(KVER).img" >> $(MNThdd)/etc/rc.d/rcsysinit.d/S75firstsetup
- echo "/usr/local/bin/rebuild-initrd" >> $(MNThdd)/etc/rc.d/rcsysinit.d/S75firstsetup
- echo "/usr/local/sbin/setup /dev/null INSTALL" >> $(MNThdd)/etc/rc.d/rcsysinit.d/S75firstsetup
- echo "rm -f /etc/rc.d/rcsysinit.d/S75firstsetup \\" >> $(MNThdd)/etc/rc.d/rcsysinit.d/S75firstsetup
- echo "&& /sbin/reboot" >> $(MNThdd)/etc/rc.d/rcsysinit.d/S75firstsetup
+endif
- chmod +x $(MNThdd)/etc/rc.d/rcsysinit.d/S75firstsetup
+ # Setup symlink for partresize at first boot...
+ ln -sf ../init.d/partresize $(MNThdd)/etc/rc.d/rcsysinit.d/S25partresize
+ # Setup symlink for fsresize at second boot...
+ ln -sf ../init.d/fsresize $(MNThdd)/etc/rc.d/rcsysinit.d/S26fsresize
# Unmount
umount $(MNThdd)/proc
umount $(MNThdd)/var
umount $(MNThdd)
- # zerofree the ext3 images to get better compression
+ # zerofree the ext2 images to get better compression
+ifneq "$(MACHINE_TYPE)" "arm"
zerofree $(IMGboot)
+ -fsck.ext2 -f -y $(IMGboot)
+ fsck.ext2 -f -y $(IMGboot)
+endif
zerofree $(IMGroot)
+ -fsck.ext2 -f -y $(IMGroot)
+ fsck.ext2 -f -y $(IMGroot)
zerofree $(IMGvar)
+ -fsck.ext2 -f -y $(IMGvar)
+ fsck.ext2 -f -y $(IMGvar)
# Cat to an image
cat $(IMGpart) $(IMGboot) $(IMGroot) $(IMGvar) > $(IMGinst)
echo -e ",$(SIZEboot),L,*\n,0,0\n,$(SIZEroot),L\n,$(SIZEvar),L\n" \
| sfdisk -D -uM -H 64 -S 32 $(IMGinst)
+ifneq "$(MACHINE_TYPE)" "arm"
# Install grub
echo "device (hd0) $(IMGinst)" > /tmp/grubinst.tmp
echo "root (hd0,0)" >> /tmp/grubinst.tmp
echo "quit" >> /tmp/grubinst.tmp
grub < /tmp/grubinst.tmp
rm -f /tmp/grubinst.tmp
+endif
# Compress Image
gzip -f9 $(IMGinst)
mount -o loop $(IMGroot) $(MNThdd)
mount -o loop $(IMGboot) $(MNThdd)/boot
+ifneq "$(MACHINE_TYPE)" "arm"
sed -i -e "s|splashimage|#splashimage|g" $(MNThdd)/boot/grub/grub.conf
sed -i -e "s|#serial|serial|g" $(MNThdd)/boot/grub/grub.conf
sed -i -e "s|#terminal|terminal|g" $(MNThdd)/boot/grub/grub.conf
- sed -i -e "s| panic=10 | console=ttyS0,38400n8 panic=10 |g" $(MNThdd)/boot/grub/grub.conf
+ sed -i -e "s| panic=10 | console=ttyS0,115200n8 panic=10 |g" $(MNThdd)/boot/grub/grub.conf
+endif
sed -i -e "s|1:2345:respawn:|#1:2345:respawn:|g" $(MNThdd)/etc/inittab
sed -i -e "s|2:2345:respawn:|#2:2345:respawn:|g" $(MNThdd)/etc/inittab
umount $(MNThdd)
# zerofree the ext3 images to get better compression
+ifneq "$(MACHINE_TYPE)" "arm"
zerofree $(IMGboot)
+ -fsck.ext2 -f -y $(IMGboot)
+ fsck.ext2 -f -y $(IMGboot)
+endif
zerofree $(IMGroot)
+ -fsck.ext2 -f -y $(IMGroot)
+ fsck.ext2 -f -y $(IMGroot)
zerofree $(IMGvar)
+ -fsck.ext2 -f -y $(IMGvar)
+ fsck.ext2 -f -y $(IMGvar)
# Cat to an image
cat $(IMGpart) $(IMGboot) $(IMGroot) $(IMGvar) > $(IMGinsts)
echo -e ",$(SIZEboot),L,*\n,0,0\n,$(SIZEroot),L\n,$(SIZEvar),L\n" \
| sfdisk -D -uM -H 64 -S 32 $(IMGinsts)
+ifneq "$(MACHINE_TYPE)" "arm"
# Install grub
echo "device (hd0) $(IMGinsts)" > /tmp/grubinst.tmp
echo "root (hd0,0)" >> /tmp/grubinst.tmp
echo "quit" >> /tmp/grubinst.tmp
grub < /tmp/grubinst.tmp
rm -f /tmp/grubinst.tmp
+endif
# Compress Image
gzip -f9 $(IMGinsts)