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

Contents of /trunk/build/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.5