it forks!

Initial profile lacking any real stuff but presenting the idea;
autoconf-based like m-p-d.
This commit is contained in:
Michael Shigorin 2010-08-24 12:48:35 +03:00
parent e660566b07
commit 8dc5159e9b
19 changed files with 602 additions and 16 deletions

1
.mki/topdir Normal file
View File

@ -0,0 +1 @@
this directory marks profile topdir, see mkimage README

View File

@ -1,2 +1,7 @@
distro/%:
make -C distro $(@:distro/%=%)
# 1. configure distro
# 2. configure subprofiles, prepare package lists
# 3. build subprofiles
# 4. build image
include clean.mk
include distro.mk

3
clean.mk Normal file
View File

@ -0,0 +1,3 @@
clean distclean:
@find -type f -name .config -delete 2>/dev/null ||:
make -C image $@

64
configure.ac Normal file
View File

@ -0,0 +1,64 @@
AC_INIT( [mkimage-profiles], [0.1], [http://bugzilla.altlinux.org] )
AC_ARG_WITH(aptconf,
AC_HELP_STRING([--with-aptconf=file],
[custom apt.conf location, e.g '--with-aptconf=/home/me/apt.conf']),
[
AC_MSG_CHECKING([apt.conf file])
if test -r "$with_aptconf" ; then
APTCONF="$with_aptconf"
AC_MSG_RESULT([** $with_aptconf exists])
else
echo "WARNING: $with_aptconf missing, ignoring"
fi
],
[
APTCONF=/etc/apt/apt.conf
])
AC_ARG_WITH(distro,
AC_HELP_STRING([--with-distro=distro],
[base distro, e.g '--with-distro=desktop' (implies branding/docs)]),
[
if test -n "$with_distro" ; then
# conditional distro config file inclusion?
DISTRO="$with_distro"
case "$DISTRO" in
desktop*)
LABEL="Desktop"
;;
server-light)
# TODO: docs, kernel...
LABEL="Server"
;;
# TODO: default case
esac
# FIXME: branding
fi
AC_MSG_RESULT([** distro: $DISTRO])
])
AC_ARG_WITH(mkimage,
AC_HELP_STRING([--with-mkimage=dir],
[custom mkimage prefix, e.g '--with-mkimage=/home/me/mkimage']),
[
AC_MSG_CHECKING([mkimage])
if test -d "$with_mkimage/usr/share/mkimage"; then
MKI_PREFIX="$with_mkimage"
AC_MSG_RESULT([** $with_mkimage/usr/share/mkimage exists])
fi
],
[
MKI_PREFIX=''
])
AC_SUBST(APTCONF)
AC_SUBST(MKI_PREFIX)
AC_SUBST(DISTRO)
AC_SUBST(LABEL)
AC_CONFIG_FILES([
globals.mk
])
AC_OUTPUT

16
distro.mk Normal file
View File

@ -0,0 +1,16 @@
sub/%:
echo SUBDIRS+=$(@:sub/%=%) >> .config
init:
:> .config
distro/bare: init sub/install2
echo BASE_LISTS='base kernel' >> .config
distro/server-base: distro/bare sub/main
echo BASE_LISTS+='server-base kernel-server' >> .config
@#echo DISTRO_TRACE+=$@ >> .config
distro/server-light: distro/server-base sub/disk
echo BASE_LISTS+='kernel-wifi' >> .config
@#echo DISTRO_TRACE+=$@ >> .config

View File

@ -1,14 +0,0 @@
clean:
@:> config.mk
distclean:
@rm config.mk
bare: clean
@echo BASE_LISTS='base kernel' >> config.mk
server-base: bare
@echo BASE_LISTS+='server-base' >> config.mk
server-light: server-base
@echo BASE_LISTS+='kernel-wifi' >> config.mk

21
image/Makefile Normal file
View File

@ -0,0 +1,21 @@
include /usr/share/mkimage/config.mk
SUBDIRS = stage2
CHROOT_PACKAGES = kernel-image-un-def apt-utils
MKI_PACK_RESULTS = boot:mkimage-profiles.iso
COPY_TREE = ./isodata
BOOT_TYPE = isolinux
PROPAGATOR_VERSION = mkimage-profiles 2.0
PROPAGATOR_MAR_MODULES = ./modules
PROPAGATOR_INITFS = ./initfs
include /usr/share/mkimage/targets.mk
all: initfs copy-tree copy-subdirs run-scripts pack-image
initfs:
echo "file /.VERSION @TMPDIR@/.VERSION 0644 0 0" > initfs
#[ -z "$(BRANDING)" ] || \
# echo "file /bootsplash /bootsplash/bootsplash 0644 0 0" >> initfs

3
image/functions.mk Normal file
View File

@ -0,0 +1,3 @@
# prefix pkglist name with its directory to form a path
#list = $(1:%=$(GLOBAL_PKGDIR)/lists/%)
list = $(1:%=pkg/lists/%)

1
image/initfs Normal file
View File

@ -0,0 +1 @@
file /.VERSION @TMPDIR@/.VERSION 0644 0 0

View File

@ -0,0 +1,21 @@
#default harddisk
default linux
prompt 1
timeout 200
gfxboot bootlogo
display boot.msg
implicit 1
#label harddisk
# localboot 0x80
label linux
kernel alt0/vmlinuz
append initrd=alt0/full.cz changedisk vga=0x314 quiet=1 showopts automatic=metod:cdrom
label noapic
kernel alt0/vmlinuz
append initrd=alt0/full.cz changedisk vga=0x314 showopts nolapic noapic acpi=off
label rescue
kernel alt0/vmlinuz
append initrd=alt0/full.cz live fastboot stagename=rescue
label memtest
kernel memtest

255
image/modules Normal file
View File

@ -0,0 +1,255 @@
kernel/drivers/ata
kernel/drivers/block
kernel/drivers/hid
kernel/drivers/md
kernel/drivers/net/\([^w]\|w[^i]\).\+\.ko
kernel/drivers/rtc
kernel/drivers/scsi
kernel/drivers/usb/host
kernel/drivers/usb/storage
3c501.ko
3c503.ko
3c505.ko
3c507.ko
3c509.ko
3c515.ko
3c574_cs.ko
3c589_cs.ko
3c59x.ko
3w-9xxx.ko
3w-xxxx.ko
8139too.ko
82596.ko
8390.ko
a100u2w.ko
aacraid.ko
ac3200.ko
acenic.ko
advansys.ko
af_packet.ko
aha152x_cs.ko
aha152x.ko
aha1542.ko
aic7xxx.ko
aic7xxx_old.ko
amd8111e.ko
at1700.ko
ata_piix.ko
atl1.ko
atl1e.ko
atl2.ko
atp870u.ko
atp.ko
axnet_cs.ko
b44.ko
bnx2.ko
bsd_comp.ko
BusLogic.ko
cassini.ko
catc.ko
cciss.ko
cdrom.ko
ch.ko
cpqarray.ko
cs5535.ko
cs89x0.ko
cy82c693.ko
DAC960.ko
dc395x.ko
de4x5.ko
de600.ko
de620.ko
defxx.ko
depca.ko
dgrs.ko
dl2k.ko
dmfe.ko
dmx3191d.ko
dpt_i2o.ko
dtc.ko
dummy.ko
e1000.ko
e1000e.ko
e100.ko
e2100.ko
eata.ko
eepro100.ko
eepro.ko
eexpress.ko
ehci-hcd.ko
epic100.ko
eql.ko
eth16i.ko
ewrk3.ko
ext2
ext3.ko
fat.ko
fdomain_cs.ko
fdomain.ko
fealnx.ko
fmvj18x_cs.ko
forcedeth.ko
gdth.ko
g_NCR5380.ko
g_NCR5380_mmio.ko
hamachi.ko
hp100.ko
hp.ko
hp-plus.ko
hpt34x.ko
hptiop.ko
i82092.ko
i82365.ko
ibmtr_cs.ko
ifb.ko
imm.ko
in2000.ko
initio.ko
ipr.ko
ips.ko
iscsi_tcp.ko
isofs.ko
kaweth.ko
lance.ko
libata.ko
libiscsi.ko
lockd.ko
loop.ko
lp486e.ko
megaraid.ko
megaraid_mbox.ko
mii.ko
natsemi.ko
NCR53c406a.ko
ne2k-pci.ko
ne.ko
netconsole.ko
netwave_cs.ko
nfs.ko
ni52.ko
ni65.ko
nls_cp866.ko
nls_koi8-r.ko
nmclan_cs.ko
ns83820.ko
nsp32.ko
ohci-hcd.ko
osst.ko
pas16.ko
pata_it8213.ko
pata_marvell.ko
pcmcia_core.ko
pcmcia.ko
pcnet32.ko
pcnet_cs.ko
pd6729.ko
pdc_adma.ko
pegasus.ko
plip.ko
ppa.ko
ppp_async.ko
ppp_deflate.ko
ppp_generic.ko
ppp_mppe.ko
pppoe.ko
pppox.ko
ppp_synctty.ko
psi240i.ko
qla1280.ko
qlogic_cs.ko
qlogicfas408.ko
qlogicfas.ko
qlogicfc.ko
qlogicisp.ko
r8169.ko
raid_class.ko
reiserfs.ko
rrunner.ko
rsrc_nonstatic.ko
s2io.ko
sata_mv.ko
sata_nv.ko
sata_promise.ko
sata_qstor.ko
sata_sil24.ko
sata_sil.ko
sata_sis.ko
sata_svw.ko
sata_sx4.ko
sata_uli.ko
sata_via.ko
sata_vsc.ko
sb1000.ko
scsi_mod.ko
scsi_transport_fc.ko
scsi_transport_iscsi.ko
scsi_transport_sas.ko
scsi_transport_spi.ko
sd_mod.ko
seeq8005.ko
serial_cs.ko
sg.ko
shaper.ko
sis190.ko
sis900.ko
sk98lin.ko
skge.ko
sky2.ko
slhc.ko
slip.ko
smc9194.ko
smc91c92_cs.ko
smc-ultra.ko
squashfs.ko
sr_mod.ko
starfire.ko
stex.ko
st.ko
sundance.ko
sungem.ko
sungem_phy.ko
sunhme.ko
sunrpc.ko
sym53c416.ko
sym53c8xx.ko
t128.ko
tcic.ko
tg3.ko
tlan.ko
tmscsim.ko
tulip.ko
tun.ko
typhoon.ko
u14-34f.ko
uhci-hcd.ko
ultrastor.ko
usbcore.ko
usbhid.ko
usbnet.ko
usb-storage.ko
vfat.ko
via-rhine.ko
via-velocity.ko
wavelan_cs.ko
wd7000.ko
wd.ko
winbond-840.ko
xirc2ps_cs.ko
xircom_cb.ko
yellowfin.ko
yenta_socket.ko
znet.ko
ahci.ko
dm-mod.ko
evdev.ko
ext2.ko
libusual.ko
mbcache.ko
nls_base.ko
nls_cp866.ko
nls_koi8-r.ko
nls_utf8.ko
scsi_mod.ko
sd_mod.ko
serio_raw.ko
sr_mod.ko

19
image/stage1/Makefile Normal file
View File

@ -0,0 +1,19 @@
include /usr/share/mkimage/config.mk
GLOBAL_VERBOSE=1
#CHROOT_PACKAGES=kernel-image-un-def
CHROOT_PACKAGES = kernel-image-un-def apt-utils
#SUBDIR = /boot
MKI_IMAGESUBDIR = /boot
MKI_PACK_RESULTS = data
PROPAGATOR_VERSION = mkimage-profiles 2.0
PROPAGATOR_MAR_MODULES = ./modules
PROPAGATOR_INITFS = ./initfs
include /usr/share/mkimage/targets.mk
#all: build-propagator pack-image
all: build-propagator

16
image/stage2/Makefile Normal file
View File

@ -0,0 +1,16 @@
CONFIGDIR = /usr/share/mkimage
include $(CONFIGDIR)/config.mk
IMAGE_PACKAGES = kernel-image-un-def \
udev \
e2fsprogs \
glibc-nss \
installer-distro-server-light-stage2
MKI_PACK_RESULTS = squash:altinst
#MKI_PACK_RESULTS = squash:live
include $(CONFIGDIR)/targets.mk
all: build-image run-image-scripts pack-image

View File

@ -0,0 +1,9 @@
#!/bin/sh
# for udev, "FATAL ERROR IN INIT: overmounting /image" otherwise
ln -sf /proc/mounts /etc/mtab
# pam_console_apply is harmful during install
find /etc/udev/rules.d/ -type f -print0 |
xargs -r0 fgrep -Zl pam_console_apply -- |
xargs -r0 rm -fv --

View File

@ -0,0 +1,27 @@
#!/bin/sh
# remove unused fonts
cd /usr/share/fonts/bitmap/misc/
rm -f *ja.* *ko.* han* gb* jis* k14* rk* *rk.* *kana* cl*
rm -f *ISO* *JIS* *KOI*
# TODO: sort out the rest of *x*
# drop unneeded translation
cd /usr/share/qt4/translations/
rm -f *_zh* *_ja*
# ...l10n...
cd /usr/share/X11/locale
rm -rf *[^C8]/ ja* ko* th* vi* zh* iso*
# xkb
cd /usr/share/X11/xkb/symbols
rm -rf *_vndr jp kr th vn cn
# gconv
cd /usr/lib*/gconv
rm -f CP* ISO* KOI* *JIS* T* HP* MAC*
# locales
cd /usr/lib*/locale
rm -rf ja_* ko_* th_* zh_*

View File

@ -0,0 +1,122 @@
#!/bin/sh
# remove all docs
rpmquery -adl |grep ^/ |xargs -r rm -f --
rm -rf /usr/share/{doc,man,info,license,gfxboot}
# remove unused icons
rm -rf /usr/share/icons/{hicolor,large,mini}
# remove PAM plugins
rm -rf /lib*/security
# remove some unused files
rm -rf /usr/share/ca-certificates
rm -rf /usr/lib/qt4/plugins/codecs
rm -f /usr/lib*/gconv/IBM*
rm -f /usr/lib*/gconv/BIG5*
rm -f /usr/lib*/gconv/EBCDIC*
# remove unneeded timezones
rm -rf /usr/share/zoneinfo/{posix,right}/
# remove unneeded l10n
find /usr/share/locale/ -type f \! -name 'alterator*' -delete
# remove non-utf8 locales
find /usr/lib*/locale -mindepth 1 -maxdepth 1 -type d \! -name '*.utf8' -print0 |
xargs -r0 rm -rf --
# xorg modules
rm -r /usr/lib*/X11/modules/dri
# remove ogfs
rm -f /lib*/evms/*/ogfs*
# remove cpp, gcc and perl
rpmquery -a cpp\* gcc\* perl-base |
xargs -r rpmi -e --nodeps --
# remove unneeded kernel modules
rm -rf /lib/modules/*/kernel/arch
rm -rf /lib/modules/*/kernel/drivers/atm
rm -rf /lib/modules/*/kernel/drivers/char/ipmi
rm -rf /lib/modules/*/kernel/drivers/char/watchdog
rm -rf /lib/modules/*/kernel/drivers/cpufreq
rm -rf /lib/modules/*/kernel/drivers/edac
rm -rf /lib/modules/*/kernel/drivers/firmware ###
rm -rf /lib/modules/*/kernel/drivers/hwmon
rm -rf /lib/modules/*/kernel/drivers/infiniband ###
rm -rf /lib/modules/*/kernel/drivers/input/{gameport,joy*}
rm -rf /lib/modules/*/kernel/drivers/isdn
rm -rf /lib/modules/*/kernel/drivers/media
rm -rf /lib/modules/*/kernel/drivers/mmc
rm -rf /lib/modules/*/kernel/drivers/mtd*
rm -rf /lib/modules/*/kernel/drivers/net/irda
rm -rf /lib/modules/*/kernel/drivers/staging
rm -rf /lib/modules/*/kernel/drivers/spi
rm -rf /lib/modules/*/kernel/drivers/telephony
rm -rf /lib/modules/*/kernel/drivers/usb/{misc,mon}
rm -rf /lib/modules/*/kernel/drivers/w1
rm -rf /lib/modules/*/kernel/fs/9p
rm -rf /lib/modules/*/kernel/fs/adfs
rm -rf /lib/modules/*/kernel/fs/affs
rm -rf /lib/modules/*/kernel/fs/afs
rm -rf /lib/modules/*/kernel/fs/autofs
rm -rf /lib/modules/*/kernel/fs/autofs4
rm -rf /lib/modules/*/kernel/fs/befs
rm -rf /lib/modules/*/kernel/fs/bfs
rm -rf /lib/modules/*/kernel/fs/btrfs
rm -rf /lib/modules/*/kernel/fs/cifs
rm -rf /lib/modules/*/kernel/fs/coda
rm -rf /lib/modules/*/kernel/fs/configfs
rm -rf /lib/modules/*/kernel/fs/cramfs
rm -rf /lib/modules/*/kernel/fs/efs
rm -rf /lib/modules/*/kernel/fs/freevxfs
rm -rf /lib/modules/*/kernel/fs/fuse
rm -rf /lib/modules/*/kernel/fs/hfs
rm -rf /lib/modules/*/kernel/fs/hfsplus
rm -rf /lib/modules/*/kernel/fs/hpfs
rm -rf /lib/modules/*/kernel/fs/jffs
rm -rf /lib/modules/*/kernel/fs/jffs2
rm -rf /lib/modules/*/kernel/fs/lockd
rm -rf /lib/modules/*/kernel/fs/minix
rm -rf /lib/modules/*/kernel/fs/ncpfs
rm -rf /lib/modules/*/kernel/fs/nilfs2
rm -rf /lib/modules/*/kernel/fs/ocfs2
rm -rf /lib/modules/*/kernel/fs/qnx4
rm -rf /lib/modules/*/kernel/fs/smbfs
rm -rf /lib/modules/*/kernel/fs/sysv
rm -rf /lib/modules/*/kernel/fs/udf
rm -rf /lib/modules/*/kernel/fs/ufs
rm -rf /lib/modules/*/kernel/net/*/netfilter
rm -rf /lib/modules/*/kernel/net/appletalk
rm -rf /lib/modules/*/kernel/net/ax25
rm -rf /lib/modules/*/kernel/net/bluetooth
rm -rf /lib/modules/*/kernel/net/dccp
rm -rf /lib/modules/*/kernel/net/decnet
rm -rf /lib/modules/*/kernel/net/econet
rm -rf /lib/modules/*/kernel/net/ipv6
rm -rf /lib/modules/*/kernel/net/ipx
rm -rf /lib/modules/*/kernel/net/irda
rm -rf /lib/modules/*/kernel/net/netfilter
rm -rf /lib/modules/*/kernel/net/netrom
rm -rf /lib/modules/*/kernel/net/rose
rm -rf /lib/modules/*/kernel/net/sctp
rm -rf /lib/modules/*/kernel/net/tipc
rm -rf /lib/modules/*/kernel/net/x25
rm -rf /lib/modules/*/kernel/sound
# remove blacklisted kernel modules
sed -n 's/^blacklist[[:space:]]\+\([^[:space:]]\+\).*/\1/p' /etc/modprobe.d/* |
while read i; do
find /lib/modules/ -type f -name "$i.ko" -delete
done
# run depmod after kernel modules removal
for i in /lib*/modules/*; do
/sbin/depmod -a -F /boot/System.map-${i##*/} ${i##*/}
done
# remove kernel images
rm -rf /boot/*

View File

@ -0,0 +1,7 @@
#!/bin/sh
# stage1 needs this
mkdir -p /image
# setup stage2 as init
mv -f /usr/sbin/install2-init /sbin/init

View File

@ -0,0 +1,6 @@
# remove rpm database
rm -rf /var/lib/rpm/*
# remove apt data files
rm -rf /var/cache/apt /var/lib*/apt

4
iso.mk Normal file
View File

@ -0,0 +1,4 @@
cd:
# setup GLOBAL_BOOT_TYPE, etc
make -C image
# check iso size