gBootRoot pronounced "bOOtrOOt"
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

221 lines
8.8 KiB

# A Makefile going to a new dimension - a combination of stuff borrowed from
# buildroot, UML, and gbootroot.
VERSION=2.4.19
PATCH_VERSION=40
UTIL_VER=20021103
BASE_DIR=${shell pwd}
SOURCE_DIR=$(BASE_DIR)/sources
ROOT_FS_DIR=$(BASE_DIR)/root_filesystem
TMP=/tmp/gboot_non_root_`id -u`
KERNEL=$(BASE_DIR)/user-mode-linux/usr/bin/linuxbr
IMAGE=$(BASE_DIR)/root_filesystem/root_fs_helper
KERNEL_DIR=$(BASE_DIR)/linux-$(VERSION)
KERNEL_SOURCE=linux-$(VERSION).tar.bz2
KERNEL_1_SITE=http://www.uk.kernel.org/pub/linux/kernel/v2.4 http://www.us.kernel.org/pub/linux/kernel/v2.4 http://www.au.kernel.org/pub/linux/kernel/v2.4 http://www.at.kernel.org/pub/linux/kernel/v2.4 http://www.br.kernel.org/pub/linux/kernel/v2.4 http://www.hr.kernel.org/pub/linux/kernel/v2.4 http://www.fr.kernel.org/pub/linux/kernel/v2.4 http://www.de.kernel.org/pub/linux/kernel/v2.4 http://www.il.kernel.org/pub/linux/kernel/v2.4 http://www.kr.kernel.org/pub/linux/kernel/v2.4
PATCH_1_SITE=http://jdike.stearns.org/mirror http://uml-pub.ists.dartmouth.edu/uml http://ftp.nl.linux.org/pub/uml http://mirror.math.leidenuniv.nl/uml-pub.ists.dartmouth.edu
PATCH_1=uml-patch-$(VERSION)-$(PATCH_VERSION).bz2
PATCH_2=$(BASE_DIR)/user-mode-linux/usr/lib/uml/cramfs-vfs-order.patch
MODE=tt
KCONFIG_FILE=config
KCONFIG=$(BASE_DIR)/user-mode-linux/usr/lib/uml/$(KCONFIG_FILE)
# Genext2fs
GENEXT2_DIR=$(BASE_DIR)/genext2fs
# Utilities
UTILITIES=uml_utilities_$(UTIL_VER).tar.bz2
UTIL_DIR=$(BASE_DIR)/tools
TOOLS = $(UTIL_DIR)/mconsole $(UTIL_DIR)/port-helper $(UTIL_DIR)/moo $(UTIL_DIR)/uml_net $(UTIL_DIR)/uml_router $(UTIL_DIR)/tunctl
all: world
world: sources initrd
sources:
@if [ ! -e $(SOURCE_DIR)/$(KERNEL_SOURCE) ] ; then \
while [ ! -f $(SOURCE_DIR)/$(KERNEL_SOURCE) ] ; do \
for URL in $(KERNEL_1_SITE) ; do \
if [ ! -f $(SOURCE_DIR)/$(KERNEL_SOURCE) ] ; then \
wget -t1 -P $(SOURCE_DIR) --passive $$URL/$(KERNEL_SOURCE) ; \
fi; \
done; \
done; \
fi;
@if [ ! -e $(SOURCE_DIR)/$(UTILITIES) ] ; then \
while [ ! -f $(SOURCE_DIR)/$(UTILITIES) ] ; do \
for URL in $(PATCH_1_SITE) ; do \
if [ ! -f $(SOURCE_DIR)/$(UTILITIES) ] ; then \
wget -t2 -P $(SOURCE_DIR) --passive $$URL/$(UTILITIES) ; \
fi; \
done; \
done; \
fi;
@if [ ! -d $(UTIL_DIR) ] ; then \
tar xvfj $(SOURCE_DIR)/$(UTILITIES); \
fi;
@if [ ! -e $(SOURCE_DIR)/$(PATCH_1) ] ; then \
while [ ! -f $(SOURCE_DIR)/$(PATCH_1) ] ; do \
for URL in $(PATCH_1_SITE) ; do \
if [ ! -f $(SOURCE_DIR)/$(PATCH_1) ] ; then \
wget -t2 -P $(SOURCE_DIR) --passive $$URL/$(PATCH_1) ; \
fi; \
done; \
done; \
fi;
@if [ ! -d $(KERNEL_DIR) ] ; then \
tar xvfj $(SOURCE_DIR)/$(KERNEL_SOURCE); \
bzcat $(SOURCE_DIR)/$(PATCH_1) | patch -d $(KERNEL_DIR) -p1; \
patch -d $(KERNEL_DIR) -p1 < $(PATCH_2); \
perl -i -p -e "s/^ARCH :=.*/ARCH=um/g" $(KERNEL_DIR)/Makefile; \
fi;
kernel:
@if [ ! -f $(KERNEL_DIR)/.config ] ; then \
cp $(KCONFIG) $(KERNEL_DIR)/.config; \
(cd $(KERNEL_DIR); make oldconfig); \
fi;
@if [ ! -f $(KERNEL_DIR)/linux ] ; then \
(cd $(KERNEL_DIR); make linux); \
fi;
if [ -e $(KERNEL_DIR)/linux ] ; then \
objcopy --strip-all $(KERNEL_DIR)/linux $(KERNEL); \
fi;
cp $(KERNEL_DIR)/.config $(KCONFIG)
root_fs_helper: genext2fs
@if [ ! -f $(ROOT_FS_DIR)/root_fs_helper ] ; then \
perl -I . ./gbootroot --home . --template Helper.yard --root-filename root_fs_helper --filesystem-command "genext2fs -z -r0" --genext2fs-dir genext2fs/ --uml-options mode=$(MODE); \
cp -fa $(TMP)/root_fs_helper $(ROOT_FS_DIR) ; \
fi;
@if [ -f $(ROOT_FS_DIR)/root_fs_helper ] ; then \
perl -I. ./gbootroot --home . --template Helper.yard --root-filename root_fs_helper --filesystem-command mkcramfs --uml-exclusively on --expect-program ./expect_uml --uml-kernel user-mode-linux/usr/bin/linuxbr --root-fs-helper root_filesystem/root_fs_helper --uml-options mode=$(MODE); \
cp -fa $(TMP)/root_fs_helper_cramfs $(ROOT_FS_DIR)/root_fs_helper; \
fi;
initrd: modules root_fs_helper
@if [ ! -f $(ROOT_FS_DIR)/Initrd.gz ] ; then \
perl -I. ./gbootroot --home . --template Initrd.yard --root-filename Initrd --uml-exclusively on --expect-program ./expect_uml --uml-kernel user-mode-linux/usr/bin/linuxbr --root-fs-helper root_filesystem/root_fs_helper --filesystem-size 4096 --uml-options mode=$(MODE); \
gzip -c9 $(TMP)/Initrd > $(ROOT_FS_DIR)/Initrd.gz; \
fi;
modules: kernel
cd linux-$(VERSION) ; \
mkdir ../modules-2.4 ; \
make modules ARCH=um ; \
make modules_install ARCH=um \
INSTALL_MOD_PATH=`pwd`/../modules-2.4
cp -al modules-2.4 modules-2.2
dir=`echo modules-2.2/lib/modules/*` ;\
for pair in "kernel/fs fs" "kernel/drivers/net net"; \
do \
from=`echo $$pair | awk '{print $$1}'` ; \
to=`echo $$pair | awk '{print $$2}'` ; \
echo "pair = $$pair, from = $$from, to = $$to" ; \
mkdir $$dir/$$to ; \
cp `find $$dir/$$from -name "*.o" -print` $$dir/$$to ; \
done ; \
cd modules-2.4 ; tar cf ../modules-2.4.tar .
rm -rf modules-2.4
cd modules-2.2 ; tar cf ../modules-2.2.tar .
rm -rf modules-2.2
mv -f modules*tar $(BASE_DIR)/user-mode-linux/usr/lib/uml
cp -fa $(BASE_DIR)/linux-$(VERSION)/drivers/mtd/devices/blkmtd.o $(BASE_DIR)/yard/replacements/usr/src/linux-um/drivers/mtd/devices/blkmtd.o
cp -fa $(BASE_DIR)/linux-$(VERSION)/drivers/mtd/devices/mtdram.o $(BASE_DIR)/yard/replacements/usr/src/linux-um/drivers/mtd/devices/mtdram.o
tools:
for d in $(TOOLS) ; do $(MAKE) -C $$d all ; done
for d in $(TOOLS) ; do $(MAKE) -C $$d install DESTDIR=$(BASE_DIR)/user-mode-linux; done
genext2fs: tools
@if [ ! -f $(GENEXT2_DIR)/genext2fs ] ; then \
$(MAKE) -C $(GENEXT2_DIR); \
strip -s $(GENEXT2_DIR)/genext2fs; \
fi;
clean:
rm -rf $(KERNEL_DIR)
rm -rf $(UTIL_DIR)
rm -f $(GENEXT2_DIR)/{genext2fs,genext2fs.o}
rm -f $(ROOT_FS_DIR)/{root_fs_helper,Initrd.gz}
rm -f $(BASE_DIR)/user-mode-linux/usr/bin/*
rm -f $(BASE_DIR)/user-mode-linux/usr/lib/uml/{modules*,port-helper}
clean-sources:
rm -f $(SOURCE_DIR)/*
install:
24 years ago
install -d $(DESTDIR)/usr/bin
cp -fa gbootroot $(DESTDIR)/usr/bin/gbootroot
install -d $(DESTDIR)/usr/lib/bootroot
cp -fa yard_chrooted_tests $(DESTDIR)/usr/lib/bootroot/yard_chrooted_tests
23 years ago
cp -fa genext2fs/genext2fs $(DESTDIR)/usr/lib/bootroot/genext2fs
cp -fa expect_uml $(DESTDIR)/usr/lib/bootroot/expect_uml
install -d $(DESTDIR)/usr/lib/bootroot/root_filesystem
cp -fa root_filesystem/root_fs_helper $(DESTDIR)/usr/lib/bootroot/root_filesystem
cp -fa root_filesystem/Initrd.gz $(DESTDIR)/usr/lib/bootroot/root_filesystem
24 years ago
cp -fa yard/scripts/make_debian $(DESTDIR)/usr/bin/make_debian
install -d $(DESTDIR)/usr/share/perl5/BootRoot
cp -fa BootRoot/*.pm $(DESTDIR)/usr/share/perl5/BootRoot
install -d $(DESTDIR)/usr/share/gbootroot/yard/Replacements
cp -fa yard/replacements/* $(DESTDIR)/usr/share/gbootroot/yard/Replacements
23 years ago
install -d $(DESTDIR)/usr/lib/bootroot/yard/Replacements/lib/modules
cp -fa user-mode-linux/usr/lib/uml/modules* $(DESTDIR)/usr/lib/bootroot/yard/Replacements/lib/modules
cp -fa user-mode-linux/usr/lib/uml/$(KCONFIG_FILE) $(DESTDIR)/usr/lib/bootroot/yard/Replacements/lib/modules
cp -fa user-mode-linux/usr/lib/uml/CVS $(DESTDIR)/usr/lib/bootroot/yard/Replacements/lib/modules/CVS
install -d $(DESTDIR)/usr/lib/uml
cp -fa user-mode-linux/usr/lib/uml/port-helper $(DESTDIR)/usr/lib/uml/port-helper
install -d $(DESTDIR)/usr/share/gbootroot/yard/templates
cp -fa yard/templates/Example* $(DESTDIR)/usr/share/gbootroot/yard/templates
cp -fa yard/templates/Helper.yard $(DESTDIR)/usr/share/gbootroot/yard/templates
cp -fa yard/templates/Initrd.yard $(DESTDIR)/usr/share/gbootroot/yard/templates
install -d $(DESTDIR)/usr/share/gbootroot/genext2fs
cp -fa genext2fs/genext2fs.c $(DESTDIR)/usr/share/gbootroot/genext2fs
cp -fa genext2fs/Makefile $(DESTDIR)/usr/share/gbootroot/genext2fs
cp -fa genext2fs/dev* $(DESTDIR)/usr/share/gbootroot/genext2fs
24 years ago
cp -fa user-mode-linux/usr/bin/uml_* $(DESTDIR)/usr/bin
23 years ago
cp -fa user-mode-linux/usr/bin/tunctl $(DESTDIR)/usr/bin/tunctl
cp -fa user-mode-linux/usr/bin/linuxbr $(DESTDIR)/usr/bin/linuxbr
24 years ago
install -d $(DESTDIR)/etc/gbootroot
cp -fa gbootrootrc $(DESTDIR)/etc/gbootroot/gbootrootrc
install -d $(DESTDIR)/usr/X11R6/include/X11/pixmaps
cp -fa gbootroot.xpm $(DESTDIR)/usr/X11R6/include/X11/pixmaps/gbootroot.xpm
install -d $(DESTDIR)/usr/share/doc/gbootroot/html/images
cp -fa doc/html/{*html,*4} $(DESTDIR)/usr/share/doc/gbootroot/html
23 years ago
cp -fa doc/html/images/{*jpg,*gif} $(DESTDIR)/usr/share/doc/gbootroot/html/images
cp -fa Changes $(DESTDIR)/usr/share/doc/gbootroot/Changes
remove:
rm /usr/bin/gbootroot
rm -rf /usr/lib/bootroot
rm -rf /usr/lib/uml
rm /usr/bin/make_debian
rm /usr/share/perl5/BootRoot/*
rmdir /usr/share/perl5/BootRoot
rm -rf /usr/share/gbootroot
rm /usr/bin/uml_*
23 years ago
rm /usr/bin/tunctl
rm /usr/bin/linuxbr
rm /etc/gbootroot/gbootrootrc
rmdir /etc/gbootroot
rm /usr/X11R6/include/X11/pixmaps/gbootroot.xpm
rm -rf /usr/share/doc/gbootroot
.PHONY: tools sources genext2fs root_fs_helper