]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - lfs/usb-stick
Forward Firewall: fixed layout of deleted host in custom group
[people/teissler/ipfire-2.x.git] / lfs / usb-stick
CommitLineData
4dc82852 1###############################################################################
4dc82852 2# #
70df8302 3# IPFire.org - A linux based firewall #
a35a0a4e 4# Copyright (C) 2007-2013 IPFire Team <info@ipfire.org> #
70df8302
MT
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###############################################################################
3c937429
MT
47IMGfdd := /install/images/$(SNAME)-$(VERSION)-install-usb-fdd.$(MACHINE)-full-core$(CORE).img
48IMGhdd := /install/images/$(SNAME)-$(VERSION)-install-usb-hdd.$(MACHINE)-full-core$(CORE).img
4dc82852
MT
49IMGfs := /install/images/fs
50
3c937429 51DISKSIZE=120000
dc2c6412 52
4dc82852
MT
53define COPY_TO_IMG
54 mkdosfs -n IPFIRE -F 16 -I $$IMAGE && \
eedc26d9 55 for i in /0 `seq 0 7`; do \
0abbeef6 56 [ -e /dev/loop$${i} ] || continue; \
4dc82852
MT
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 && \
a35a0a4e
AF
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 && \
4dc82852
MT
68 umount /install/mnt && \
69 losetup -d $$LOOPDEV && \
70 syslinux $$IMAGE
71endef
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
dc2c6412 85 dd bs=1k if=/dev/zero of=$(IMGfs) count=$(DISKSIZE)
4dc82852
MT
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
50b5d7ce 95 /usr/sbin/install-mbr -f $(IMGhdd)
4dc82852
MT
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)