]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - lfs/usb-stick
Domainkonfiguration neu gemacht.
[people/pmueller/ipfire-2.x.git] / lfs / usb-stick
1 ###############################################################################
2 # This file is part of the IPCop Firewall. #
3 # #
4 # IPCop is free software; you can redistribute it and/or modify #
5 # it under the terms of the GNU General Public License as published by #
6 # the Free Software Foundation; either version 2 of the License, or #
7 # (at your option) any later version. #
8 # #
9 # IPCop is distributed in the hope that it will be useful, #
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
12 # GNU General Public License for more details. #
13 # #
14 # You should have received a copy of the GNU General Public License #
15 # along with IPCop; if not, write to the Free Software #
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
17 # #
18 # Makefiles are based on LFSMake, which is #
19 # Copyright (C) 2002 Rod Roard <rod@sunsetsystems.com> #
20 # #
21 ###############################################################################
22
23 ###############################################################################
24 # Definitions
25 ###############################################################################
26
27 include Config
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).img
48 IMGhdd := /install/images/$(SNAME)-$(VERSION)-install-usb-hdd.$(MACHINE).img
49 IMGfs := /install/images/fs
50
51 define COPY_TO_IMG
52 mkdosfs -n IPFIRE -F 16 -I $$IMAGE && \
53 for i in `seq 0 7`; do \
54 if (! losetup /dev/loop$${i} >/dev/null 2>&1 ); then \
55 LOOPDEV="/dev/loop$${i}"; \
56 break; \
57 fi; \
58 done; \
59 losetup $$LOOPDEV $$IMAGE && \
60 mount -t vfat $$LOOPDEV /install/mnt && \
61 cp -fR /install/cdrom/* /install/mnt && \
62 mv /install/mnt/boot/isolinux/{instroot,vmlinuz,*\.msg,memtest} /install/mnt && \
63 rm -rf /install/mnt/boot && \
64 cp $(DIR_SRC)/config/syslinux/syslinux.cfg /install/mnt/syslinux.cfg && \
65 umount /install/mnt && \
66 losetup -d $$LOOPDEV && \
67 syslinux $$IMAGE
68 endef
69
70 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
71
72 # usb-fdd superfloppy (partitionless)
73 # compute size +32 blocks for bootsector/fat/etc...
74 dd bs=1024 count=$$((`du -k -s /install/cdrom | awk '{print $$1}'` + 2048 )) \
75 if=/dev/zero \
76 of=$(IMGfdd)
77 IMAGE=$(IMGfdd); $(COPY_TO_IMG)
78
79 # Partitionned images : make a file system bigger than iso size
80 # that fit on 128MB key to let free space available
81 # on the unique partition. Image will be compressed later
82 dd bs=1k if=/dev/zero of=$(IMGfs) count=120000
83 IMAGE=$(IMGfs); $(COPY_TO_IMG)
84
85 # usb-hdd (64 heads, 32 sectors geometry, on a partition 1)
86 # use 64 heads as 256 does not work on Award bios (Asus A7V8X-X Gilles)
87 # use 32 sectors a minima or device is not recognised as hard disk (Frank)
88 # add 32 to IMGfs as first partition start at 32
89 COUNT=$$((`du -k -s $(IMGfs) | awk '{print $$1}'` + 32 )); \
90 dd bs=1k if=/dev/zero of=$(IMGhdd) count=$$COUNT
91 # write mbr before partitioning save a 'not msdos fs' warning from sfdisk
92 /usr/local/sbin/install-mbr -f $(IMGhdd)
93 echo -e "0,,6,*\n;\n;\n;" | sfdisk -qLD -H 64 -S 32 $(IMGhdd)
94 # copy the entire partition, make the fs and dd back
95 dd if=$(IMGfs) of=$(IMGhdd) bs=512 seek=32
96
97 gzip -f9 $(IMGfdd) $(IMGhdd)
98 rm -rf $$LFS/tmp/* $(IMGfs)