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