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

Contents of /trunk/build/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.5