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