/[d-i]/trunk/build/Makefile
ViewVC logotype

Contents of /trunk/build/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4662 - (hide annotations) (download)
Fri Oct 10 19:35:40 2003 UTC (9 years, 7 months ago) by joeyh
File size: 18614 byte(s)
Use sudo for accessing a floppy. running sudo make is not a very good idea,
this avoids the need for it
1 joeyh 330 #!/usr/bin/make -f
2     #
3     # Debian Installer system makefile.
4 joeyh 4608 # Copyright 2001-2003 by Joey Hess <joeyh@debian.org> and the d-i team.
5 joeyh 330 # Licensed under the terms of the GPL.
6     #
7 joeyh 456 # This makefile builds a debian-installer system and bootable images from
8     # a collection of udebs which it downloads from a Debian archive. See
9     # README for details.
10 joeyh 330
11 waldi 2799 DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH)
12     DEB_HOST_GNU_CPU = $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
13     DEB_HOST_GNU_SYSTEM = $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
14 dwhedon 579
15 waldi 2799 # Include main config
16     include config/main
17 joeyh 440
18 waldi 2799 # Include arch configs
19     include config/arch/$(DEB_HOST_GNU_SYSTEM)
20     include config/arch/$(DEB_HOST_GNU_SYSTEM)-$(DEB_HOST_GNU_CPU)
21 waldi 2741
22 waldi 2799 # Include type configs
23     -include config/type/$(TYPE)
24     -include config/type/$(TYPE)-$(DEB_HOST_GNU_SYSTEM)
25 rhirst 4173 -include config/type/$(TYPE)-$(DEB_HOST_ARCH)
26 waldi 2741
27 waldi 2799 # Include directory config
28     include config/dir
29 waldi 2741
30 joeyh 4608 # Local config override.
31     -include config/local
32 dwhedon 579
33 joeyh 4608 # Add to PATH so dpkg will always work, and so local programs will be found.
34 joeyh 374 PATH:=$(PATH):/usr/sbin:/sbin:.
35    
36 joeyh 4608 # All these options make apt read the right sources list, and use APTDIR for
37     # everything so it need not run as root.
38 joeyh 440 CWD:=$(shell pwd)/
39 joeyh 324 APT_GET=apt-get --assume-yes \
40 dwhedon 387 -o Dir::Etc::sourcelist=$(CWD)$(SOURCES_LIST) \
41     -o Dir::State=$(CWD)$(APTDIR)/state \
42 joeyh 324 -o Debug::NoLocking=true \
43 joeyh 547 -o Dir::Cache=$(CWD)$(APTDIR)/cache
44 joeyh 324
45 joeyh 4608 # Get the list of udebs to install.
46     UDEBS = $(shell ./pkg-list $(TYPE) $(KERNELIMAGEVERSION)) $(EXTRAS)
47 joeyh 324
48 mckinstry 3450 ifeq ($(TYPE),floppy)
49 joeyh 4336 # List of additional udebs for driver floppys.
50 mckinstry 3450 DRIVERFD_UDEBS = \
51 joeyh 4608 $(shell for target in $(EXTRA_FLOPPIES) ; do \
52     ./pkg-list $$target $(KERNELIMAGEVERSION); \
53     done)
54 mckinstry 3450 endif
55    
56 joeyh 4608 # Sanity check TYPE against the list.
57     ifeq (,$(filter $(TYPE),type $(TYPES_SUPPORTED)))
58 waldi 3323 %:
59 waldi 2799 @echo "unsupported type"
60     @echo "type: $(TYPE)"
61 joeyh 4608 $(MAKE) listtypes
62 waldi 2799 @exit 1
63     endif
64 joeyh 338
65 waldi 3323 # Include arch targets
66     -include make/arch/$(DEB_HOST_GNU_SYSTEM)
67     include make/arch/$(DEB_HOST_GNU_SYSTEM)-$(DEB_HOST_GNU_CPU)
68    
69 joeyh 4608 build: tree_umount tree $(EXTRA_TARGETS) stats
70    
71     image: arch-image $(EXTRA_IMAGES)
72    
73 waldi 2799 tree_mount: tree
74 wouter 2882 -@sudo /bin/mount -t proc proc $(TREE)/proc
75     ifndef USERDEVFS
76 waldi 2799 -@sudo /bin/mount -t devfs dev $(TREE)/dev
77 wouter 2882 else
78     -@sudo chroot $(TREE) /usr/bin/update-dev
79     endif
80 waldi 2741
81 waldi 2799 tree_umount:
82 wouter 2882 ifndef USERDEVFS
83 waldi 4371 -@if [ -L $(TREE)/dev/fd ] ; then sudo /bin/umount $(TREE)/dev 2>/dev/null ; fi
84 wouter 2882 endif
85 waldi 4371 -@if [ -L $(TREE)/proc/self ] ; then sudo /bin/umount $(TREE)/proc 2>/dev/null ; fi
86 waldi 2799
87 joeyh 468 demo: tree
88 waldi 2799 $(MAKE) tree_mount
89 waldi 1311 -@[ -f questions.dat ] && cp -f questions.dat $(TREE)/var/lib/cdebconf/
90 joeyh 3507 -@sudo chroot $(TREE) bin/sh -c "export TERM=linux; export DEBCONF_DEBUG=5; /usr/bin/debconf-loadtemplate debian /var/lib/dpkg/info/*.templates; exec /usr/share/debconf/frontend /usr/bin/main-menu"
91 waldi 2799 $(MAKE) tree_umount
92 dwhedon 359
93 joeyh 468 shell: tree
94 waldi 2799 $(MAKE) tree_mount
95 waldi 1311 -@sudo chroot $(TREE) bin/sh
96 waldi 2799 $(MAKE) tree_umount
97 joeyh 325
98 waldi 3323 uml: $(INITRD)
99 mlang 1386 -linux initrd=$(INITRD) root=/dev/rd/0 ramdisk_size=8192 con=fd:0,fd:1 devfs=mount
100 mlang 1375
101 waldi 2799 demo_clean: tree_umount
102 dwhedon 359
103 mckinstry 2708 clean: demo_clean tmp_mount debian/control
104 joeyh 4608 rm -rf $(TREE) || sudo rm -rf $(TREE)
105 joeyh 342 dh_clean
106 joeyh 473 rm -f *-stamp
107 joeyh 3507 rm -rf $(UDEBDIR) $(EXTRAUDEBDIR) $(TMP_MNT) debian/build
108 sjogren 1390 rm -rf $(DEST)/$(TYPE)-* || sudo rm -rf $(DEST)/$(TYPE)-*
109 joeyh 3519 rm -f unifont-reduced-$(TYPE).bdf
110 joeyh 3539 $(foreach NAME,$(KERNELNAME), \
111     rm -f $(TEMP)/$(NAME); )
112 joeyh 324
113 sjogren 1390 reallyclean: clean
114 joeyh 4608 rm -rf $(APTDIR) $(DEST) $(BASE_TMP) $(SOURCEDIR) $(DEBUGUDEBDIR)
115 mckinstry 3597 rm -f diskusage*.txt missing.txt all-*.utf *.bdf
116 ley 4412 rm -f sources.list
117 mckinstry 2707
118 joeyh 4608 # Auto-generate a sources.list.
119 ley 4433 sources.list:
120 joeyh 4608 ( \
121     echo "# This file is automatically generated, edit sources.list.local instead."; \
122 joeyh 4486 if [ "$(MIRROR)x" != "x" ]; then \
123 joeyh 4608 echo "deb $(MIRROR) $(SUITE) main/debian-installer"; \
124 ley 4433 else \
125 joeyh 4608 cat $(SYSTEM_SOURCES_LIST) | grep ^deb\ |grep -v file:/ | grep -v debian-non-US | grep ' main' | \
126     awk '{print $$1 " " $$2}' | sed s/\\/*\ *$$/\ $(SUITE)\ main\\/debian-installer/ | uniq; \
127     fi; \
128     ) > sources.list
129 ley 4412
130 joeyh 332 # Get all required udebs and put in UDEBDIR.
131 joeyh 1045 get_udebs: $(TYPE)-get_udebs-stamp
132 ley 4412 $(TYPE)-get_udebs-stamp: sources.list
133 joeyh 324 mkdir -p $(APTDIR)/state/lists/partial
134     mkdir -p $(APTDIR)/cache/archives/partial
135 joeyh 4608 -$(APT_GET) update
136 joeyh 355 $(APT_GET) autoclean
137 joeyh 328 # If there are local udebs, remove them from the list of things to
138     # get. Then get all the udebs that are left to get.
139 joeyh 3539 # Note that the trailing blank on the next line is significant. It
140     # makes the sed below always work.
141     needed="$(UDEBS) $(DRIVERFD_UDEBS) "; \
142 joeyh 400 for file in `find $(LOCALUDEBDIR) -name "*_*" -printf "%f\n" 2>/dev/null`; do \
143 joeyh 328 package=`echo $$file | cut -d _ -f 1`; \
144 joeyh 3539 needed=`echo " $$needed " | sed "s/ $$package / /"`; \
145 joeyh 328 done; \
146 pere 2940 if [ "$(DEBUG)" = y ] ; then \
147 joeyh 456 mkdir -p $(DEBUGUDEBDIR); \
148     cd $(DEBUGUDEBDIR); \
149     export DEB_BUILD_OPTIONS="debug"; \
150     $(APT_GET) source --build --yes $$needed; \
151     cd ..; \
152 dwhedon 387 else \
153 hertzog 592 echo Need to download : $$needed; \
154     if [ -n "$$needed" ]; then \
155 joeyh 456 $(APT_GET) -dy install $$needed; \
156 hertzog 592 fi; \
157 dwhedon 387 fi; \
158    
159 porridge 950 # Now the udebs are in APTDIR/cache/archives/ and maybe LOCALUDEBDIR
160     # or DEBUGUDEBDIR, but there may be other udebs there too besides those
161 joeyh 4608 # we asked for. So link those we asked for to UDEBDIR, renaming them
162 porridge 950 # to more useful names. Watch out for duplicates and missing files
163     # while doing that.
164 joeyh 324 rm -rf $(UDEBDIR)
165     mkdir -p $(UDEBDIR)
166 mckinstry 3465 rm -rf $(EXTRAUDEBDIR)
167     mkdir -p $(EXTRAUDEBDIR)
168 tfheen 961 lnpkg() { \
169 mckinstry 3465 local pkg=$$1; local dir=$$2 debdir=$$3; \
170 porridge 950 local L1="`echo $$dir/$$pkg\_*`"; \
171     local L2="`echo $$L1 | sed -e 's, ,,g'`"; \
172     if [ "$$L1" != "$$L2" ]; then \
173     echo "Duplicate package $$pkg in $$dir/"; \
174     exit 1; \
175 joeyh 328 fi; \
176 porridge 950 if [ -e $$L1 ]; then \
177 mckinstry 3465 ln -f $$dir/$$pkg\_* $$debdir/$$pkg.udeb; \
178 joeyh 328 fi; \
179 porridge 950 }; \
180 mckinstry 3465 for package in $(UDEBS) ; do \
181     lnpkg $$package $(APTDIR)/cache/archives $(UDEBDIR); \
182     lnpkg $$package $(LOCALUDEBDIR) $(UDEBDIR); \
183     lnpkg $$package $(DEBUGUDEBDIR) $(UDEBDIR); \
184 porridge 950 if ! [ -e $(UDEBDIR)/$$package.udeb ]; then \
185     echo "Needed $$package not found (looked in $(APTDIR)/cache/archives/, $(LOCALUDEBDIR)/, $(DEBUGUDEBDIR)/)"; \
186     exit 1; \
187 dwhedon 387 fi; \
188 mckinstry 3465 done ; \
189     for package in $(DRIVERFD_UDEBS) ; do \
190     lnpkg $$package $(APTDIR)/cache/archives $(EXTRAUDEBDIR); \
191     lnpkg $$package $(LOCALUDEBDIR) $(EXTRAUDEBDIR); \
192     lnpkg $$package $(DEBUGUDEBDIR) $(EXTRAUDEBDIR); \
193     if ! [ -e $(EXTRAUDEBDIR)/$$package.udeb ]; then \
194     echo "Needed $$package not found (looked in $(APTDIR)/cache/archives/, $(LOCALUDEBDIR)/, $(DEBUGUDEBDIR)/)"; \
195     exit 1; \
196     fi; \
197     done
198 joeyh 324
199 joeyh 1045 touch $(TYPE)-get_udebs-stamp
200 joeyh 470
201 joeyh 324 # Build the installer tree.
202 waldi 3323 tree: $(TYPE)-tree-stamp
203     $(TYPE)-tree-stamp: $(TYPE)-get_udebs-stamp debian/control
204 joeyh 328 dh_testroot
205    
206 joeyh 615 dpkg-checkbuilddeps
207    
208 joeyh 324 # This build cannot be restarted, because dpkg gets confused.
209 joeyh 4608 rm -rf $(TREE)
210 joeyh 324 # Set up the basic files [u]dpkg needs.
211     mkdir -p $(DPKGDIR)/info
212     touch $(DPKGDIR)/status
213 hertzog 592 # Create a tmp tree
214     mkdir -p $(TREE)/tmp
215 joeyh 324 # Only dpkg needs this stuff, so it can be removed later.
216     mkdir -p $(DPKGDIR)/updates/
217     touch $(DPKGDIR)/available
218 pere 2305
219     # Unpack the udebs with dpkg. This command must run as root
220     # or fakeroot.
221 pere 2307 echo -n > diskusage-$(TYPE).txt
222 pere 2498 oldsize=0; oldblocks=0; oldcount=0; for udeb in $(UDEBDIR)/*.udeb ; do \
223 pere 2305 pkg=`basename $$udeb` ; \
224     dpkg --force-overwrite --root=$(TREE) --unpack $$udeb ; \
225 pere 2498 newsize=`du -bs $(TREE) | awk '{print $$1}'` ; \
226     newblocks=`du -s $(TREE) | awk '{print $$1}'` ; \
227 pere 2329 newcount=`find $(TREE) -type f | wc -l | awk '{print $$1}'` ; \
228 pere 2305 usedsize=`echo $$newsize - $$oldsize | bc`; \
229 pere 2498 usedblocks=`echo $$newblocks - $$oldblocks | bc`; \
230 pere 2329 usedcount=`echo $$newcount - $$oldcount | bc`; \
231 mckinstry 2585 version=`dpkg-deb --info $$udeb | grep Version: | awk '{print $$2}'` ; \
232     echo " $$usedsize B - $$usedblocks blocks - $$usedcount files used by pkg $$pkg (version $$version )" >>diskusage-$(TYPE).txt;\
233 pere 2305 oldsize=$$newsize ; \
234 pere 2498 oldblocks=$$newblocks ; \
235 pere 2329 oldcount=$$newcount ; \
236 pere 2305 done
237 pere 2307 sort -n < diskusage-$(TYPE).txt > diskusage-$(TYPE).txt.new && \
238 pere 2465 mv diskusage-$(TYPE).txt.new diskusage-$(TYPE).txt
239 pere 2305
240 joeyh 324 # Clean up after dpkg.
241     rm -rf $(DPKGDIR)/updates
242 joeyh 332 rm -f $(DPKGDIR)/available $(DPKGDIR)/*-old $(DPKGDIR)/lock
243 joeyh 4608
244     # Set up modules.dep, ensure there is at least one standard dir (kernel
245     # in this case), so depmod will use its prune list for archs with no
246     # modules.
247     $(foreach VERSION,$(KERNELVERSION), \
248     mkdir -p $(TREE)/lib/modules/$(VERSION)/kernel; \
249     depmod -q -a -b $(TREE)/ $(VERSION); )
250     # These files depmod makes are used by hotplug, and we shouldn't
251     # need them, yet anyway.
252     find $(TREE)/lib/modules/ -name 'modules*' \
253     -not -name modules.dep -not -type d | xargs rm -f
254    
255     # Create a dev tree
256     mkdir -p $(TREE)/dev
257 wouter 2219 ifdef USERDEVFS
258     # Create initial /dev entries -- only those that are absolutely
259     # required to boot sensibly, though.
260     mknod $(TREE)/dev/console c 5 1
261 wouter 3866 mkdir -p $(TREE)/dev/vc
262     mknod $(TREE)/dev/vc/0 c 4 0
263     mknod $(TREE)/dev/vc/1 c 4 1
264     mknod $(TREE)/dev/vc/2 c 4 2
265     mknod $(TREE)/dev/vc/3 c 4 3
266     mknod $(TREE)/dev/vc/4 c 4 4
267     mknod $(TREE)/dev/vc/5 c 4 5
268     mkdir -p $(TREE)/dev/rd
269     mknod $(TREE)/dev/rd/0 b 1 0
270 wouter 2219 endif
271 tfheen 617
272 joeyh 440 # Move the kernel image out of the way, into a temp directory
273 joeyh 4608 # for use later.
274 waldi 2799 $(foreach NAME,$(KERNELNAME), \
275     mv -f $(TREE)/boot/$(NAME) $(TEMP); )
276 joeyh 456 -rmdir $(TREE)/boot/
277 joeyh 324
278 joeyh 4608 ifndef NO_TERMINFO
279 hertzog 588 # Copy terminfo files for slang frontend
280 joeyh 611 # TODO: terminfo.udeb?
281 hertzog 588 for file in /etc/terminfo/a/ansi /etc/terminfo/l/linux \
282     /etc/terminfo/v/vt102; do \
283     mkdir -p $(TREE)/`dirname $$file`; \
284     cp -a $$file $(TREE)/$$file; \
285     done
286 joeyh 4608 endif
287 hertzog 588
288 joeyh 519 ifdef EXTRAFILES
289     # Copy in any extra files
290     for file in $(EXTRAFILES); do \
291 hertzog 588 mkdir -p $(TREE)/`dirname $$file`; \
292 joeyh 519 cp -a $$file $(TREE)/$$file; \
293     done
294     endif
295 joeyh 517
296 joeyh 521 ifdef EXTRALIBS
297 joeyh 4608 # Copy in any extra libs.
298 joeyh 521 cp -a $(EXTRALIBS) $(TREE)/lib/
299     endif
300    
301 joeyh 3514 ifeq ($(TYPE),floppy)
302     # Unpack additional driver disks, so mklibs runs on them too.
303     rm -rf $(DRIVEREXTRASDIR)
304     mkdir -p $(DRIVEREXTRASDIR)
305     mkdir -p $(DRIVEREXTRASDPKGDIR)/info $(DRIVEREXTRASDPKGDIR)/updates
306     touch $(DRIVEREXTRASDPKGDIR)/status $(DRIVEREXTRASDPKGDIR)/available
307     for udeb in $(EXTRAUDEBDIR)/*.udeb ; do \
308     dpkg --force-overwrite --root=$(DRIVEREXTRASDIR) --unpack $$udeb; \
309     done
310     endif
311    
312 joeyh 468 # Library reduction.
313     mkdir -p $(TREE)/lib
314 joeyh 3514 $(MKLIBS) -v -d $(TREE)/lib --root=$(TREE) `find $(TEMP) -type f -perm +0111 -o -name '*.so'`
315 joeyh 530
316 tfheen 617 # Add missing symlinks for libraries
317     # (Needed for mklibs.py)
318 walters 769 /sbin/ldconfig -n $(TREE)/lib $(TREE)/usr/lib
319 tfheen 617
320 joeyh 530 # Remove any libraries that are present in both usr/lib and lib,
321     # from lib. These were unnecessarily copied in by mklibs, and
322     # we want to use the ones in usr/lib instead since they came
323     # from udebs. Only libdebconf has this problem so far.
324     for lib in `find $(TREE)/usr/lib/lib* -type f -printf "%f\n" | cut -d . -f 1 | sort | uniq`; do \
325 joeyh 568 rm -f $(TREE)/lib/$$lib.*; \
326 joeyh 530 done
327 tfheen 617
328 joeyh 468 # Now we have reduced libraries installed .. but they are
329     # not listed in the status file. This nasty thing puts them in,
330     # and alters their names to end in -reduced to indicate that
331     # they have been modified.
332 joeyh 4608 for package in $$(dpkg -S `find $(TREE)/lib -type f -not -name '*.o' -not -name '*.dep' | \
333 joeyh 520 sed s:$(TREE)::` | cut -d : -f 1 | \
334 joeyh 468 sort | uniq); do \
335 joeyh 520 dpkg -s $$package | sed "s/$$package/$$package-reduced/g" \
336     >> $(DPKGDIR)/status; \
337 joeyh 468 done
338    
339     # Reduce status file to contain only the elements we care about.
340 sjogren 1153 egrep -i '^((Status|Provides|Depends|Package|Version|Description|installer-menu-item|Description-..):|$$)' \
341 hertzog 588 $(DPKGDIR)/status > $(DPKGDIR)/status.udeb
342     rm -f $(DPKGDIR)/status
343     ln -sf status.udeb $(DPKGDIR)/status
344 tfheen 617
345 joeyh 4202 ifdef NO_I18N
346     # Remove all internationalization from the templates.
347     # Not ideal, but useful if you're very tight on space.
348     for FILE in $$(find $(TREE) -name "*.templates"); do \
349     perl -e 'my $$status = 0; while (<>) { if (/^[A-Z]/ || /^$$/) { if (/^(Choices|Description)-/) { $$status = 0; } else { $$status = 1; } } print if ($$status); }' < $$FILE > temp; \
350     mv temp $$FILE; \
351     done
352     endif
353 joeyh 4608
354     # If the image has pcmcia, reduce the config file to list only
355     # entries that there are modules on the image. This saves ~30k.
356     if [ -e $(TREE)/etc/pcmcia/config ]; then \
357     ./pcmcia-config-reduce.pl $(TREE)/etc/pcmcia/config \
358     `if [ -d "$(DRIVEREXTRASDIR)" ]; then find $(DRIVEREXTRASDIR)/lib/modules -name \*.o; fi` \
359     `find $(TREE)/lib/modules/ -name \*.o` > \
360     $(TREE)/etc/pcmcia/config.reduced; \
361     mv -f $(TREE)/etc/pcmcia/config.reduced $(TREE)/etc/pcmcia/config; \
362     fi
363 joeyh 4202
364 hertzog 588 # Strip all kernel modules, just in case they haven't already been
365     for module in `find $(TREE)/lib/modules/ -name '*.o'`; do \
366 kraai 1046 strip -R .comment -R .note -g $$module; \
367 hertzog 588 done
368 tfheen 617
369 joeyh 612 # Remove some unnecessary dpkg files.
370 hertzog 588 for file in `find $(TREE)/var/lib/dpkg/info -name '*.md5sums' -o \
371 joeyh 612 -name '*.postrm' -o -name '*.prerm' -o -name '*.preinst' -o \
372     -name '*.list'`; do \
373 hertzog 588 rm $$file; \
374     done
375 joeyh 611
376 joeyh 3514 # Collect the used UTF-8 strings, to know which glyphs to include in
377 joeyh 4608 # the font. Using strings is not the best way, but no better
378     # suggestion has been made yet.
379 pere 2468 cp graphic.utf all-$(TYPE).utf
380 mckinstry 3504 ifeq ($(TYPE),floppy)
381 joeyh 4290 if [ -n "`find $(DRIVEREXTRASDPKGDIR)/info/ -name \\*.templates`" ]; then \
382     cat $(DRIVEREXTRASDPKGDIR)/info/*.templates >> all-$(TYPE).utf; \
383     fi
384 joeyh 3543 endif
385 joeyh 4225 if [ -n "`find $(DPKGDIR)/info/ -name \\*.templates`" ]; then \
386     cat $(DPKGDIR)/info/*.templates >> all-$(TYPE).utf; \
387     fi
388 pere 2468 find $(TREE) -type f | xargs strings >> all-$(TYPE).utf
389 pere 2461
390 joeyh 3514 ifeq ($(TYPE),floppy)
391     # Remove additional driver disk contents now that we're done with
392     # them.
393     rm -rf $(DRIVEREXTRASDIR)
394     endif
395 joeyh 4608
396 joeyh 3514 # Tree target ends here. Whew!
397 joeyh 4608 touch $(TYPE)-tree-stamp
398 joeyh 3514
399 pere 2468 unifont-reduced-$(TYPE).bdf: all-$(TYPE).utf
400 sjogren 3864 # Use the UTF-8 locale in rootskel-locale. This target shouldn't
401     # be called when it is not present anyway.
402 pere 2461 # reduce-font is part of package libbogl-dev
403     # unifont.bdf is part of package bf-utf-source
404 pere 2468 # The locale must be generated after installing the package locales
405 sjogren 3864 CHARMAP=`LOCPATH=$(LOCALE_PATH) LC_ALL=C.UTF-8 locale charmap`; \
406 pere 3707 if [ UTF-8 != "$$CHARMAP" ]; then \
407 sjogren 3864 echo "error: Trying to build unifont.bgf without rootskel-locale!"; \
408 pere 3707 exit 1; \
409     fi
410 sjogren 3864 LOCPATH=$(LOCALE_PATH) LC_ALL=C.UTF-8 reduce-font /usr/src/unifont.bdf < all-$(TYPE).utf > $@.tmp
411 mckinstry 3590 mv $@.tmp $@
412 pere 2461
413 mckinstry 3516 $(TREE)/unifont.bgf: unifont-reduced-$(TYPE).bdf
414 pere 2461 # bdftobogl is part of package libbogl-dev
415 mckinstry 3590 bdftobogl -b unifont-reduced-$(TYPE).bdf > $@.tmp
416     mv $@.tmp $@
417 pere 2461
418 mckinstry 3691 # Build the driver floppy image
419 mlang 3877 $(EXTRA_TARGETS) : %-stamp : $(TYPE)-get_udebs-stamp
420 mckinstry 3691 mkdir -p ${TEMP}/$*
421     for file in $(shell grep --no-filename -v ^\# pkg-lists/$*/common \
422     `if [ -f pkg-lists/$*/$(DEB_HOST_ARCH) ]; then echo pkg-lists/$*/$(DEB_HOST_ARCH); fi` \
423     | sed -e 's/^\(.*\)$${kernel:Version}\(.*\)$$/$(foreach VERSION,$(KERNELIMAGEVERSION),\1$(VERSION)\2\n)/g' ) ; do \
424 sjogren 4205 cp $(EXTRAUDEBDIR)/$$file* ${TEMP}/$* ; \
425     echo $$file >> ${TEMP}/$*/udeb_include; \
426     done
427 mckinstry 3691 touch $@
428    
429     $(EXTRA_IMAGES) : $(DEST)/%-image.img : $(EXTRA_TARGETS)
430     rm -f $@
431     install -d $(TEMP)
432     install -d $(DEST)
433     set -e; if [ $(INITRD_FS) = ext2 ]; then \
434     genext2fs -d $(TEMP)/$* -b $(FLOPPY_SIZE) -r 0 $@; \
435     elif [ $(INITRD_FS) = romfs ]; then \
436     genromfs -d $(TEMP)/$* -f $@; \
437     else \
438     echo "Unsupported filesystem type"; \
439     exit 1; \
440     fi;
441    
442 joeyh 468 tarball: tree
443 joeyh 473 tar czf $(DEST)/$(TYPE)-debian-installer.tar.gz $(TREE)
444 dwhedon 407
445 joeyh 446 # Make sure that the temporary mountpoint exists and is not occupied.
446 joeyh 435 tmp_mount:
447 joeyh 446 if mount | grep -q $(TMP_MNT) && ! umount $(TMP_MNT) ; then \
448 joeyh 435 echo "Error unmounting $(TMP_MNT)" 2>&1 ; \
449     exit 1; \
450     fi
451     mkdir -p $(TMP_MNT)
452    
453 tfheen 617 # Create a compressed image of the root filesystem by way of genext2fs.
454 waldi 3323 initrd: $(INITRD)
455 joeyh 468 $(INITRD): TMP_FILE=$(TEMP)/image.tmp
456 sjogren 3864 $(INITRD): $(TYPE)-tree-stamp
457 joeyh 4608 # Only build the font if we have rootskel-locale
458 sjogren 3864 if [ -d "$(LOCALE_PATH)/C.UTF-8" ]; then \
459     $(MAKE) $(TREE)/unifont.bgf; \
460     fi
461 dwhedon 419 rm -f $(TMP_FILE)
462 joeyh 457 install -d $(TEMP)
463 joeyh 473 install -d $(DEST)
464 joeyh 4202
465 bug1 1710 if [ $(INITRD_FS) = ext2 ]; then \
466     genext2fs -d $(TREE) -b `expr $$(du -s $(TREE) | cut -f 1) + $$(expr $$(find $(TREE) | wc -l) \* 2)` $(TMP_FILE); \
467     elif [ $(INITRD_FS) = romfs ]; then \
468     genromfs -d $(TREE) -f $(TMP_FILE); \
469     else \
470     echo "Unsupported filesystem type"; \
471     exit 1; \
472     fi;
473 mckinstry 3590 gzip -vc9 $(TMP_FILE) > $(INITRD).tmp
474     mv $(INITRD).tmp $(INITRD)
475 dwhedon 407
476 joeyh 457 # Write image to floppy
477 joeyh 4268 floppy: boot_floppy
478 bcollins 3339 boot_floppy: $(IMAGE)
479 joeyh 473 install -d $(DEST)
480 joeyh 4662 sudo dd if=$(IMAGE) of=$(FLOPPYDEV) bs=$(FLOPPY_SIZE)k
481 joeyh 457
482 mckinstry 3691 # Write drivers floppy
483     %_floppy: $(DEST)/%-image.img
484 joeyh 4662 sudo dd if=$< of=$(FLOPPYDEV)
485 mckinstry 3465
486 joeyh 547 # If you're paranoid (or things are mysteriously breaking..),
487     # you can check the floppy to make sure it wrote properly.
488     # This target will fail if the floppy doesn't match the floppy image.
489 joeyh 4658 floppy_check: $(IMAGE)
490 joeyh 4662 sudo cmp $(FLOPPYDEV) $(IMAGE)
491 joeyh 471
492 joeyh 4608 listtypes:
493     @echo "supported types: $(TYPES_SUPPORTED)"
494    
495    
496 mckinstry 3691 stats: tree $(EXTRA_TARGETS) general-stats $(EXTRA_STATS)
497    
498 wouter 2732 COMPRESSED_SZ=$(shell expr $(shell tar czf - $(TREE) | wc -c) / 1024)
499 joeyh 4332 KERNEL_SZ=$(shell expr \( $(foreach NAME,$(KERNELNAME),$(shell du -b $(TEMP)/$(NAME) 2>/dev/null | cut -f 1) +) 0 \) / 1024)
500 mckinstry 3691 general-stats:
501 joeyh 326 @echo
502 pere 2498 @echo "System stats for $(TYPE)"
503     @echo "-------------------------"
504 joeyh 522 @echo "Installed udebs: $(UDEBS)"
505 joeyh 563 @echo -n "Total system size: $(shell du -h -s $(TREE) | cut -f 1)"
506     @echo -n " ($(shell du -h --exclude=modules -s $(TREE)/lib | cut -f 1) libs, "
507     @echo "$(shell du -h -s $(TREE)/lib/modules | cut -f 1) kernel modules)"
508     @echo "Initrd size: $(COMPRESSED_SZ)k"
509     @echo "Kernel size: $(KERNEL_SZ)k"
510 waldi 2799 ifneq (,$(FLOPPY_SIZE))
511 joeyh 563 @echo "Free space: $(shell expr $(FLOPPY_SIZE) - $(KERNEL_SZ) - $(COMPRESSED_SZ))k"
512 waldi 2799 endif
513 pere 2307 @echo "Disk usage per package:"
514     @sed 's/^/ /' < diskusage-$(TYPE).txt
515 joeyh 326 # Add your interesting stats here.
516 mckinstry 3465
517 mckinstry 3691 SZ=$(shell expr $(shell du -b $(TEMP)/$* | cut -f 1 ) / 1024)
518 joeyh 4608 $(EXTRA_STATS) : %-stats:
519 pere 2498 @echo
520 mckinstry 3691 @echo "$* size: $(SZ)k"
521 joeyh 3518 ifneq (,$(FLOPPY_SIZE))
522 mckinstry 3691 @echo "Free space: $(shell expr $(FLOPPY_SIZE) - $(SZ))k"
523 joeyh 3518 endif
524 joeyh 4281 @echo "Disk usage per package:"
525 mckinstry 3691 @ls -l $(TEMP)/$*/*.udeb
526 joeyh 332
527 joeyh 4312 # These tagets build all available types.
528     all_build:
529     set -e; for type in $(TYPES_SUPPORTED); do \
530     $(MAKE) build TYPE=$$type; \
531     done
532     all_images:
533     set -e; for type in $(TYPES_SUPPORTED); do \
534     $(MAKE) image TYPE=$$type; \
535     done
536     # Suitable for a cron job, you'll only see the stats unless a build fails.
537     all_stats:
538     @echo "Image size stats"
539     @echo
540     @(set -e; $(MAKE) all_build >tmp/log 2>&1 || \
541     (echo "build failure!"; cat tmp/log; false))
542     @rm -f tmp/log
543     @for type in $(TYPES_SUPPORTED); do \
544     $(MAKE) -s stats TYPE=$$type; \
545     done

  ViewVC Help
Powered by ViewVC 1.1.5