Erste Teile der neuen Netzwerkscripte.
[people/pmueller/ipfire-2.x.git] / lfs / usb-stick
CommitLineData
4dc82852
MT
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
27include Config
28
9c16cd92
MT
29VER = ipfire
30
4dc82852
MT
31THISAPP = usb-stick
32TARGET = $(DIR_INFO)/$(THISAPP)
33
34###############################################################################
35# Top-level Rules
36###############################################################################
37
38install : $(TARGET)
39
40check :
41
42download :
43
44md5 :
45
46###############################################################################
47# Installation Details
48###############################################################################
49IMGfdd := /install/images/$(SNAME)-$(VERSION)-install-usb-fdd.$(MACHINE).img
50IMGhdd := /install/images/$(SNAME)-$(VERSION)-install-usb-hdd.$(MACHINE).img
51IMGfs := /install/images/fs
52
53define COPY_TO_IMG
54 mkdosfs -n IPFIRE -F 16 -I $$IMAGE && \
55 for i in `seq 0 7`; do \
56 if (! losetup /dev/loop$${i} >/dev/null 2>&1 ); then \
57 LOOPDEV="/dev/loop$${i}"; \
58 break; \
59 fi; \
60 done; \
61 losetup $$LOOPDEV $$IMAGE && \
62 mount -t vfat $$LOOPDEV /install/mnt && \
63 cp -fR /install/cdrom/* /install/mnt && \
64 mv /install/mnt/boot/isolinux/{instroot,vmlinuz,*\.msg,memtest} /install/mnt && \
65 rm -rf /install/mnt/boot && \
66 cp $(DIR_SRC)/config/syslinux/syslinux.cfg /install/mnt/syslinux.cfg && \
67 umount /install/mnt && \
68 losetup -d $$LOOPDEV && \
69 syslinux $$IMAGE
70endef
71
72$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
73
74 # usb-fdd superfloppy (partitionless)
75 # compute size +32 blocks for bootsector/fat/etc...
76 dd bs=1024 count=$$((`du -k -s /install/cdrom | awk '{print $$1}'` + 2048 )) \
77 if=/dev/zero \
78 of=$(IMGfdd)
79 IMAGE=$(IMGfdd); $(COPY_TO_IMG)
80
81 # Partitionned images : make a file system bigger than iso size
82 # that fit on 128MB key to let free space available
83 # on the unique partition. Image will be compressed later
84 dd bs=1k if=/dev/zero of=$(IMGfs) count=120000
85 IMAGE=$(IMGfs); $(COPY_TO_IMG)
86
87 # usb-hdd (64 heads, 32 sectors geometry, on a partition 1)
88 # use 64 heads as 256 does not work on Award bios (Asus A7V8X-X Gilles)
89 # use 32 sectors a minima or device is not recognised as hard disk (Frank)
90 # add 32 to IMGfs as first partition start at 32
91 COUNT=$$((`du -k -s $(IMGfs) | awk '{print $$1}'` + 32 )); \
92 dd bs=1k if=/dev/zero of=$(IMGhdd) count=$$COUNT
93 # write mbr before partitioning save a 'not msdos fs' warning from sfdisk
94 /usr/local/sbin/install-mbr -f $(IMGhdd)
95 echo -e "0,,6,*\n;\n;\n;" | sfdisk -qLD -H 64 -S 32 $(IMGhdd)
96 # copy the entire partition, make the fs and dd back
97 dd if=$(IMGfs) of=$(IMGhdd) bs=512 seek=32
98
99 gzip -f9 $(IMGfdd) $(IMGhdd)
100 rm -rf $$LFS/tmp/* $(IMGfs)