mirror of https://github.com/fspc/gbootroot.git
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.
184 lines
6.7 KiB
184 lines
6.7 KiB
# A Makefile going to a new dimension - a combination of stuff borrowed from
|
|
# buildroot, UML, and gbootroot.
|
|
|
|
VERSION=2.4.19
|
|
PATCH_VERSION=35
|
|
UTIL_VER=20021103
|
|
|
|
BASE_DIR=${shell pwd}
|
|
TARGET_DIR=$(BASE_DIR)/root
|
|
BUILD_DIR=$(BASE_DIR)/staging_dir
|
|
SOURCE_DIR=$(BASE_DIR)/sources
|
|
|
|
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_SITE=http://www.uk.kernel.org/pub/linux/kernel/v2.4
|
|
|
|
# Choose a site with works best
|
|
PATCH_1_SITE=http://jdike.stearns.org/mirror
|
|
#PATCH_1_SITE=http://uml-pub.ists.dartmouth.edu/uml
|
|
#PATCH_1_SITE=http://ftp.nl.linux.org/pub/uml
|
|
#PATCH_1_SITE=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
|
|
KCONFIG=$(BASE_DIR)/user-mode-linux/usr/lib/uml/config
|
|
|
|
# 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
|
|
|
|
##TARGET_CC=$(BUILD_DIR)/bin/gcc
|
|
##TARGET_CC1=$(BUILD_DIR)/usr/bin/$(ARCH)-uclibc-gcc
|
|
##TARGET_CROSS=$(BUILD_DIR)/usr/bin/$(ARCH)-uclibc-
|
|
##TARGET_PATH=$(BUILD_DIR)/usr/bin:$(BUILD_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin
|
|
##UCLIBC_DIR=$(BASE_DIR)/uClibc
|
|
##UCLIBC_SOURCE=uClibc-snapshot.tar.gz
|
|
##UCLIBC_PATCH=$(SOURCE_DIR)/uClibc.patch
|
|
##UCLIBC_SITE=ftp://oss.lineo.com
|
|
##BUSYBOX_DIR=$(BASE_DIR)/busybox
|
|
##BUSYBOX_SOURCE=busybox.tar.gz
|
|
##BUSYBOX_PATCH=$(SOURCE_DIR)/busybox.patch
|
|
##BUSYBOX_SITE=http://busybox.lineo.com
|
|
|
|
all: world
|
|
world: kernel target
|
|
|
|
sources: $(BASE_DIR)
|
|
@if [ ! -e $(SOURCE_DIR)/$(KERNEL_SOURCE) ] ; then \
|
|
while [ ! -f $(SOURCE_DIR)/$(KERNEL_SOURCE) ] ; do \
|
|
wget -P $(SOURCE_DIR) --passive $(KERNEL_SITE)/$(KERNEL_SOURCE); \
|
|
done; \
|
|
fi;
|
|
@if [ ! -e $(SOURCE_DIR)/$(UTILITIES) ] ; then \
|
|
while [ ! -f $(SOURCE_DIR)/$(UTILITIES) ] ; do \
|
|
wget -P $(SOURCE_DIR) --passive $(PATCH_1_SITE)/$(UTILITIES); \
|
|
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 \
|
|
wget -P $(SOURCE_DIR) --passive $(PATCH_1_SITE)/$(PATCH_1); \
|
|
done; \
|
|
if [ ! -d $(KERNEL_DIR) ] ; then \
|
|
tar xvfj $(SOURCE_DIR)/$(KERNEL_SOURCE); \
|
|
fi; \
|
|
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;
|
|
|
|
modules:
|
|
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 modules*tar $(BASE_DIR)/user-mode-linux/usr/lib/uml
|
|
|
|
|
|
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
|
|
|
|
mkfs:
|
|
@if [ ! -f $(GENEXT2_DIR)/genext2fs ] ; then \
|
|
$(MAKE) -C $(GENEXT2_DIR); \
|
|
fi;
|
|
|
|
|
|
install:
|
|
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
|
|
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
|
|
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
|
|
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/config $(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
|
|
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
|
|
cp -fa user-mode-linux/usr/bin/uml_* $(DESTDIR)/usr/bin
|
|
cp -fa user-mode-linux/usr/bin/tunctl $(DESTDIR)/usr/bin/tunctl
|
|
cp -fa user-mode-linux/usr/bin/linuxbr $(DESTDIR)/usr/bin/linuxbr
|
|
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
|
|
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_*
|
|
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
|