Add core version to all imagenames
[people/pmueller/ipfire-2.x.git] / lfs / usb-stick
CommitLineData
4dc82852 1###############################################################################
4dc82852 2# #
70df8302
MT
3# IPFire.org - A linux based firewall #
4# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
5# #
6# This program is free software: you can redistribute it and/or modify #
4dc82852 7# it under the terms of the GNU General Public License as published by #
70df8302 8# the Free Software Foundation, either version 3 of the License, or #
4dc82852
MT
9# (at your option) any later version. #
10# #
70df8302 11# This program is distributed in the hope that it will be useful, #
4dc82852
MT
12# but WITHOUT ANY WARRANTY; without even the implied warranty of #
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14# GNU General Public License for more details. #
15# #
16# You should have received a copy of the GNU General Public License #
70df8302 17# along with this program. If not, see <http://www.gnu.org/licenses/>. #
4dc82852
MT
18# #
19###############################################################################
20
21###############################################################################
22# Definitions
23###############################################################################
24
25include Config
26
9c16cd92
MT
27VER = ipfire
28
4dc82852
MT
29THISAPP = usb-stick
30TARGET = $(DIR_INFO)/$(THISAPP)
31
32###############################################################################
33# Top-level Rules
34###############################################################################
35
36install : $(TARGET)
37
38check :
39
40download :
41
42md5 :
43
44###############################################################################
45# Installation Details
46###############################################################################
a01fc474
AF
47IMGfdd := /install/images/$(SNAME)-$(VERSION)-install-usb-fdd.$(MACHINE)-$(ED)-core$(CORE).img
48IMGhdd := /install/images/$(SNAME)-$(VERSION)-install-usb-hdd.$(MACHINE)-$(ED)-core$(CORE).img
4dc82852
MT
49IMGfs := /install/images/fs
50
dc2c6412
AF
51ifeq "$(ED)" "devel"
52 DISKSIZE=480000
53else
54 DISKSIZE=120000
55endif
56
4dc82852
MT
57define COPY_TO_IMG
58 mkdosfs -n IPFIRE -F 16 -I $$IMAGE && \
eedc26d9 59 for i in /0 `seq 0 7`; do \
0abbeef6 60 [ -e /dev/loop$${i} ] || continue; \
4dc82852
MT
61 if (! losetup /dev/loop$${i} >/dev/null 2>&1 ); then \
62 LOOPDEV="/dev/loop$${i}"; \
63 break; \
64 fi; \
65 done; \
66 losetup $$LOOPDEV $$IMAGE && \
67 mount -t vfat $$LOOPDEV /install/mnt && \
68 cp -fR /install/cdrom/* /install/mnt && \
69 mv /install/mnt/boot/isolinux/{instroot,vmlinuz,*\.msg,memtest} /install/mnt && \
70 rm -rf /install/mnt/boot && \
71 cp $(DIR_SRC)/config/syslinux/syslinux.cfg /install/mnt/syslinux.cfg && \
72 umount /install/mnt && \
73 losetup -d $$LOOPDEV && \
74 syslinux $$IMAGE
75endef
76
77$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
78
79 # usb-fdd superfloppy (partitionless)
80 # compute size +32 blocks for bootsector/fat/etc...
81 dd bs=1024 count=$$((`du -k -s /install/cdrom | awk '{print $$1}'` + 2048 )) \
82 if=/dev/zero \
83 of=$(IMGfdd)
84 IMAGE=$(IMGfdd); $(COPY_TO_IMG)
85
86 # Partitionned images : make a file system bigger than iso size
87 # that fit on 128MB key to let free space available
88 # on the unique partition. Image will be compressed later
dc2c6412 89 dd bs=1k if=/dev/zero of=$(IMGfs) count=$(DISKSIZE)
4dc82852
MT
90 IMAGE=$(IMGfs); $(COPY_TO_IMG)
91
92 # usb-hdd (64 heads, 32 sectors geometry, on a partition 1)
93 # use 64 heads as 256 does not work on Award bios (Asus A7V8X-X Gilles)
94 # use 32 sectors a minima or device is not recognised as hard disk (Frank)
95 # add 32 to IMGfs as first partition start at 32
96 COUNT=$$((`du -k -s $(IMGfs) | awk '{print $$1}'` + 32 )); \
97 dd bs=1k if=/dev/zero of=$(IMGhdd) count=$$COUNT
98 # write mbr before partitioning save a 'not msdos fs' warning from sfdisk
99 /usr/local/sbin/install-mbr -f $(IMGhdd)
100 echo -e "0,,6,*\n;\n;\n;" | sfdisk -qLD -H 64 -S 32 $(IMGhdd)
101 # copy the entire partition, make the fs and dd back
102 dd if=$(IMGfs) of=$(IMGhdd) bs=512 seek=32
103
104 gzip -f9 $(IMGfdd) $(IMGhdd)
105 rm -rf $$LFS/tmp/* $(IMGfs)