X-Git-Url: http://git.ipfire.org/?p=people%2Fteissler%2Fipfire-2.x.git;a=blobdiff_plain;f=lfs%2Fflash-images;h=f74c7e1e4eaf21bc0e162754a04a0ed92992405c;hp=7888423b671378d36b74c144d9f8a74adbdd4aef;hb=36d809efb637c618359f40c1ecd8d820fcb2c882;hpb=920b610fa0f0b404bb323c06b4f2e43105ce57c6 diff --git a/lfs/flash-images b/lfs/flash-images index 7888423b6..f74c7e1e4 100644 --- a/lfs/flash-images +++ b/lfs/flash-images @@ -1,7 +1,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2007-2011 IPFire Team # +# Copyright (C) 2007-2012 IPFire Team # # # # 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 # @@ -44,37 +44,52 @@ md5 : ############################################################################### # Installation Details ############################################################################### -IMGinst := /install/images/$(SNAME)-$(VERSION).1gb-ext2.$(MACHINE)-full-core$(CORE).img -IMGinsts := /install/images/$(SNAME)-$(VERSION).1gb-ext2-scon.$(MACHINE)-full-core$(CORE).img +IMGinst := /install/images/$(SNAME)-$(VERSION).1gb-ext4.$(MACHINE)-full-core$(CORE).img +IMGinsts := /install/images/$(SNAME)-$(VERSION).1gb-ext4-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 -IMGvar := /install/images/varfs -SIZEvar := 430 + +# All sizes in blocks +ifeq "$(MACHINE_TYPE)" "arm" + S_OFFSET = 8192 + + # FAT32 + PART_TYPE = c +else + S_OFFSET = 32 + + # Logical + PART_TYPE = L +endif + +# /boot: 64MB - OFFSET +# / : 600MB +S_BOOT := $(shell echo $$(( 131072 - $(S_OFFSET) ))) +S_ROOT := 1228800 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) - rm -rf $(MNThdd) $(IMGinst) $(IMGpart) $(IMGboot) $(IMGroot) $(IMGvar) && mkdir -p $(MNThdd) + rm -rf $(MNThdd) $(IMGinst) $(IMGpart) $(IMGboot) $(IMGroot) && mkdir -p $(MNThdd) # Create first 32 sectors of image - dd bs=1k if=/dev/zero of=$(IMGpart) count=16 + dd if=/dev/zero of=$(IMGpart) bs=512 count=$(S_OFFSET) # Create images for filesystems - dd bs=1K if=/dev/zero of=$(IMGboot) count=20464 # 20MB-16K - dd bs=1M if=/dev/zero of=$(IMGroot) count=$(SIZEroot) - dd bs=1M if=/dev/zero of=$(IMGvar) count=$(SIZEvar) + dd if=/dev/zero of=$(IMGboot) bs=512 count=$(S_BOOT) + dd if=/dev/zero of=$(IMGroot) bs=512 count=$(S_ROOT) # Format them -ifeq "$(MACHINE_TYPE)" "arm" +ifeq "$(PART_TYPE)" "c" mkfs.vfat $(IMGboot) else mkfs.ext2 -F $(IMGboot) endif - mkfs.ext2 -F $(IMGroot) - mkfs.ext2 -F $(IMGvar) + mkfs.ext4 -O ^has_journal,extent -F $(IMGroot) + + # Most systems that use Flashimages has no RTC at boot + # so the interval check should disables + tune2fs -i0 $(IMGroot) # Mount Images mount -o loop $(IMGroot) $(MNThdd) @@ -82,7 +97,16 @@ endif mkdir $(MNThdd)/var mkdir $(MNThdd)/var/log mount -o loop $(IMGboot) $(MNThdd)/boot - mount -o loop $(IMGvar) $(MNThdd)/var + + # Install MLO and uboot first +ifeq "$(MACHINE_TYPE)" "arm" + cp -v /boot/MLO $(MNThdd)/boot/ + cp -v /boot/u-boot.img $(MNThdd)/boot/ + cp -v /boot/zImage-ipfire-multi $(MNThdd)/boot/ + sync + umount $(MNThdd)/boot + mount -o loop $(IMGboot) $(MNThdd)/boot +endif # Install IPFire tar -C $(MNThdd)/ -xvaf /install/cdrom/$(SNAME)-$(VERSION).tlz @@ -96,14 +120,14 @@ endif 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" +ifeq "$(PART_TYPE)" "c" # 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 + sed -i -e "s|DEVICE4|#DEVICE4|g" $(MNThdd)/etc/fstab + sed -i -e "s|FSTYPE|ext4|g" $(MNThdd)/etc/fstab ifneq "$(MACHINE_TYPE)" "arm" sed -i -e "s|MOUNT|ro|g" $(MNThdd)/boot/grub/grub.conf @@ -112,29 +136,37 @@ ifneq "$(MACHINE_TYPE)" "arm" ln -s grub.conf $(MNThdd)/boot/grub/menu.lst # Copy grub files manually - cp -f $(MNThdd)/usr/share/grub/i386-pc/* $(MNThdd)/boot/grub/ + cp -f $(MNThdd)/usr/lib/grub/i386-pc/* $(MNThdd)/boot/grub/ endif + # 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/S42fsresize + # Unmount umount $(MNThdd)/proc umount $(MNThdd)/dev umount $(MNThdd)/sys umount $(MNThdd)/boot - umount $(MNThdd)/var umount $(MNThdd) - # zerofree the ext3 images to get better compression -ifneq "$(MACHINE_TYPE)" "arm" + # zerofree the ext2 images to get better compression +ifneq "$(PART_TYPE)" "c" zerofree $(IMGboot) + -fsck.ext2 -f -y $(IMGboot) + fsck.ext2 -f -y $(IMGboot) endif zerofree $(IMGroot) - zerofree $(IMGvar) + -fsck.ext4 -f -y $(IMGroot) + fsck.ext4 -f -y $(IMGroot) # Cat to an image - cat $(IMGpart) $(IMGboot) $(IMGroot) $(IMGvar) > $(IMGinst) + cat $(IMGpart) $(IMGboot) $(IMGroot) > $(IMGinst) + # Write Partition table - echo -e ",$(SIZEboot),L,*\n,0,0\n,$(SIZEroot),L\n,$(SIZEvar),L\n" \ - | sfdisk -D -uM -H 64 -S 32 $(IMGinst) + echo -e "$(S_OFFSET),$(S_BOOT),$(PART_TYPE),*\n,0,0\n$$(( $(S_BOOT) + $(S_OFFSET) )),$(S_ROOT),L\n,0,0\n" \ + | sfdisk -D -uS -H 64 -S 32 $(IMGinst) ifneq "$(MACHINE_TYPE)" "arm" # Install grub @@ -159,6 +191,10 @@ ifneq "$(MACHINE_TYPE)" "arm" 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,115200n8 panic=10 |g" $(MNThdd)/boot/grub/grub.conf +else + sed -i -e "s| console=tty1 | console=ttyAMA0,115200n8 |g" $(MNThdd)/boot/cmdline.txt + sed -i -e "s| console=tty1 | console=ttyO2,115200n8 |g" $(MNThdd)/boot/boot.script + cd $(MNThdd)/boot && ./convert_bootscript endif sed -i -e "s|1:2345:respawn:|#1:2345:respawn:|g" $(MNThdd)/etc/inittab @@ -173,18 +209,22 @@ endif umount $(MNThdd) # zerofree the ext3 images to get better compression -ifneq "$(MACHINE_TYPE)" "arm" +ifneq "$(PART_TYPE)" "c" zerofree $(IMGboot) + -fsck.ext2 -f -y $(IMGboot) + fsck.ext2 -f -y $(IMGboot) endif zerofree $(IMGroot) - zerofree $(IMGvar) + -fsck.ext4 -f -y $(IMGroot) + fsck.ext4 -f -y $(IMGroot) # Cat to an image - cat $(IMGpart) $(IMGboot) $(IMGroot) $(IMGvar) > $(IMGinsts) - rm -vf $(IMGpart) $(IMGboot) $(IMGroot) $(IMGvar) + cat $(IMGpart) $(IMGboot) $(IMGroot) > $(IMGinsts) + rm -vf $(IMGpart) $(IMGboot) $(IMGroot) + # Write Partition table - echo -e ",$(SIZEboot),L,*\n,0,0\n,$(SIZEroot),L\n,$(SIZEvar),L\n" \ - | sfdisk -D -uM -H 64 -S 32 $(IMGinsts) + echo -e "$(S_OFFSET),$(S_BOOT),$(PART_TYPE),*\n,0,0\n$$(( $(S_BOOT) + $(S_OFFSET) )),$(S_ROOT),L\n,0,0\n" \ + | sfdisk -D -uS -H 64 -S 32 $(IMGinsts) ifneq "$(MACHINE_TYPE)" "arm" # Install grub @@ -199,5 +239,4 @@ endif # Compress Image gzip -f9 $(IMGinsts) - rm -rf $(MNThdd) $(IMGpart) $(IMGboot) $(IMGroot) $(IMGvar) - + rm -rf $(MNThdd) $(IMGpart) $(IMGboot) $(IMGroot)