]> git.ipfire.org Git - ipfire-2.x.git/blob - lfs/usb-stick
Forgot to change the md5
[ipfire-2.x.git] / lfs / usb-stick
1 ###############################################################################
2 # #
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 #
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).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 /0 `seq 0 7`; do \
54 [ -e /dev/loop$${i} ] || continue; \
55 if (! losetup /dev/loop$${i} >/dev/null 2>&1 ); then \
56 LOOPDEV="/dev/loop$${i}"; \
57 break; \
58 fi; \
59 done; \
60 losetup $$LOOPDEV $$IMAGE && \
61 mount -t vfat $$LOOPDEV /install/mnt && \
62 cp -fR /install/cdrom/* /install/mnt && \
63 mv /install/mnt/boot/isolinux/{instroot,vmlinuz,*\.msg,memtest} /install/mnt && \
64 rm -rf /install/mnt/boot && \
65 cp $(DIR_SRC)/config/syslinux/syslinux.cfg /install/mnt/syslinux.cfg && \
66 umount /install/mnt && \
67 losetup -d $$LOOPDEV && \
68 syslinux $$IMAGE
69 endef
70
71 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
72
73 # usb-fdd superfloppy (partitionless)
74 # compute size +32 blocks for bootsector/fat/etc...
75 dd bs=1024 count=$$((`du -k -s /install/cdrom | awk '{print $$1}'` + 2048 )) \
76 if=/dev/zero \
77 of=$(IMGfdd)
78 IMAGE=$(IMGfdd); $(COPY_TO_IMG)
79
80 # Partitionned images : make a file system bigger than iso size
81 # that fit on 128MB key to let free space available
82 # on the unique partition. Image will be compressed later
83 dd bs=1k if=/dev/zero of=$(IMGfs) count=120000
84 IMAGE=$(IMGfs); $(COPY_TO_IMG)
85
86 # usb-hdd (64 heads, 32 sectors geometry, on a partition 1)
87 # use 64 heads as 256 does not work on Award bios (Asus A7V8X-X Gilles)
88 # use 32 sectors a minima or device is not recognised as hard disk (Frank)
89 # add 32 to IMGfs as first partition start at 32
90 COUNT=$$((`du -k -s $(IMGfs) | awk '{print $$1}'` + 32 )); \
91 dd bs=1k if=/dev/zero of=$(IMGhdd) count=$$COUNT
92 # write mbr before partitioning save a 'not msdos fs' warning from sfdisk
93 /usr/local/sbin/install-mbr -f $(IMGhdd)
94 echo -e "0,,6,*\n;\n;\n;" | sfdisk -qLD -H 64 -S 32 $(IMGhdd)
95 # copy the entire partition, make the fs and dd back
96 dd if=$(IMGfs) of=$(IMGhdd) bs=512 seek=32
97
98 gzip -f9 $(IMGfdd) $(IMGhdd)
99 rm -rf $$LFS/tmp/* $(IMGfs)