some more cleanups. This one works pretty well
This commit is contained in:
parent
c79e99824e
commit
e1be1eadee
37
Makefile
37
Makefile
@ -76,7 +76,7 @@ TARGETS=
|
|||||||
-include busybox.mk
|
-include busybox.mk
|
||||||
-include boa.mk
|
-include boa.mk
|
||||||
|
|
||||||
world: $(TARGETS) root_fs
|
world: $(TARGETS) root_fs $(LINUX)
|
||||||
|
|
||||||
root_fs: $(GENEXT2FS_DIR)/genext2fs $(TARGET_DIR)
|
root_fs: $(GENEXT2FS_DIR)/genext2fs $(TARGET_DIR)
|
||||||
$(GENEXT2FS_DIR)/genext2fs \
|
$(GENEXT2FS_DIR)/genext2fs \
|
||||||
@ -85,11 +85,6 @@ root_fs: $(GENEXT2FS_DIR)/genext2fs $(TARGET_DIR)
|
|||||||
-d $(TARGET_DIR) \
|
-d $(TARGET_DIR) \
|
||||||
-D $(SOURCE_DIR)/device_table.txt root_fs
|
-D $(SOURCE_DIR)/device_table.txt root_fs
|
||||||
|
|
||||||
$(STAGING_DIR)/.i_exist:
|
|
||||||
rm -rf $(STAGING_DIR)
|
|
||||||
mkdir $(STAGING_DIR)
|
|
||||||
touch $(STAGING_DIR)/.i_exist
|
|
||||||
|
|
||||||
$(STAGING_DIR)/.target_dir_exists:
|
$(STAGING_DIR)/.target_dir_exists:
|
||||||
rm -rf $(TARGET_DIR)
|
rm -rf $(TARGET_DIR)
|
||||||
tar -xf $(SOURCE_DIR)/skel.tar
|
tar -xf $(SOURCE_DIR)/skel.tar
|
||||||
@ -104,6 +99,7 @@ $(SOURCE_DIR)/$(LINUX_SOURCE):
|
|||||||
done
|
done
|
||||||
|
|
||||||
$(LINUX_DIR)/.unpacked: $(SOURCE_DIR)/$(LINUX_SOURCE)
|
$(LINUX_DIR)/.unpacked: $(SOURCE_DIR)/$(LINUX_SOURCE)
|
||||||
|
rm -rf $(LINUX_DIR) # Keeps old versions from messing things up
|
||||||
bunzip2 -c $(SOURCE_DIR)/$(LINUX_SOURCE) | tar -xv
|
bunzip2 -c $(SOURCE_DIR)/$(LINUX_SOURCE) | tar -xv
|
||||||
touch $(LINUX_DIR)/.unpacked
|
touch $(LINUX_DIR)/.unpacked
|
||||||
|
|
||||||
@ -113,14 +109,21 @@ $(SOURCE_DIR)/$(USERMODELINUX_PATCH):
|
|||||||
done
|
done
|
||||||
|
|
||||||
$(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked $(SOURCE_DIR)/$(USERMODELINUX_PATCH)
|
$(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked $(SOURCE_DIR)/$(USERMODELINUX_PATCH)
|
||||||
|
# This step cannot gracefully recover from interruption
|
||||||
|
@if [ -f $(LINUX_DIR)/.started_patch ]; then \
|
||||||
|
echo "Something went wrong patching the kernel."; \
|
||||||
|
echo "Please rm -rf the kernel directory (\"$(LINUX_DIR)\") and type \"make\" again."; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
touch $(LINUX_DIR)/.started_patch
|
||||||
bzcat $(SOURCE_DIR)/$(USERMODELINUX_PATCH) | patch -d $(LINUX_DIR) -p1
|
bzcat $(SOURCE_DIR)/$(USERMODELINUX_PATCH) | patch -d $(LINUX_DIR) -p1
|
||||||
cp -f $(KCONFIG) $(LINUX_DIR)/.config
|
cp -f $(KCONFIG) $(LINUX_DIR)/.config
|
||||||
touch $(LINUX_DIR)/.patched
|
mv $(LINUX_DIR)/.started_patch $(LINUX_DIR)/.patched # Hah! Atomic
|
||||||
|
|
||||||
$(LINUX_DIR)/.um: $(LINUX_DIR)/.patched
|
$(LINUX_DIR)/.um: $(LINUX_DIR)/.patched
|
||||||
sed -e 's/^ARCH :=.*/ARCH=um/g' < $(LINUX_DIR)/Makefile > \
|
sed -e 's/^ARCH :=.*/ARCH=um/g' < $(LINUX_DIR)/Makefile > \
|
||||||
$(LINUX_DIR)/Makefile.new && mv -f \
|
$(LINUX_DIR)/Makefile.new
|
||||||
$(LINUX_DIR)/Makefile.new $(LINUX_DIR)/Makefile
|
mv -f $(LINUX_DIR)/Makefile.new $(LINUX_DIR)/Makefile
|
||||||
touch $(LINUX_DIR)/.um
|
touch $(LINUX_DIR)/.um
|
||||||
|
|
||||||
$(LINUX_DIR)/.configdone: $(LINUX_DIR)/.um
|
$(LINUX_DIR)/.configdone: $(LINUX_DIR)/.um
|
||||||
@ -144,14 +147,20 @@ $(SOURCE_DIR)/$(UCLIBC_SOURCE):
|
|||||||
done;
|
done;
|
||||||
|
|
||||||
$(UCLIBC_DIR)/Config: $(SOURCE_DIR)/$(UCLIBC_SOURCE)
|
$(UCLIBC_DIR)/Config: $(SOURCE_DIR)/$(UCLIBC_SOURCE)
|
||||||
tar -xzf $(SOURCE_DIR)/$(UCLIBC_SOURCE)
|
rm -rf $(UCLIBC_DIR) # Make sure no previous version interferes here
|
||||||
|
gzip -d -c $(SOURCE_DIR)/$(UCLIBC_SOURCE) | tar xf -
|
||||||
|
# The next step patches uClibc
|
||||||
|
# Place patches in the source directory, named uClibc-*.patch
|
||||||
for p in `find $(SOURCE_DIR) -name uClibc-*.patch | sort -g`;do \
|
for p in `find $(SOURCE_DIR) -name uClibc-*.patch | sort -g`;do \
|
||||||
patch -p0 < $$p ; \
|
patch -p0 < $$p ; \
|
||||||
done
|
done
|
||||||
-f $(SOURCE_DIR)/uClibc-Config.awk < \
|
# Finally, patch the Config file to our liking
|
||||||
$(UCLIBC_DIR)/extra/Configs/Config.$(ARCH) > $(UCLIBC_DIR)/Config;
|
# uClibc-Config.awk should be pretty staightforward
|
||||||
|
awk -f $(SOURCE_DIR)/uClibc-Config.awk < \
|
||||||
|
$(UCLIBC_DIR)/extra/Configs/Config.$(ARCH) > \
|
||||||
|
$(UCLIBC_DIR)/Config
|
||||||
|
|
||||||
$(UCLIBC_DIR)/lib/libc.a: $(STAGING_DIR)/.i_exist $(LINUX_DIR)/.dep $(UCLIBC_DIR)/Config
|
$(UCLIBC_DIR)/lib/libc.a: $(LINUX_DIR)/.dep $(UCLIBC_DIR)/Config
|
||||||
$(MAKE) CROSS=$(CROSS) \
|
$(MAKE) CROSS=$(CROSS) \
|
||||||
DEVEL_PREFIX=$(STAGING_DIR) \
|
DEVEL_PREFIX=$(STAGING_DIR) \
|
||||||
SYSTEM_DEVEL_PREFIX=$(STAGING_DIR)/usr \
|
SYSTEM_DEVEL_PREFIX=$(STAGING_DIR)/usr \
|
||||||
@ -166,7 +175,7 @@ $(TARGET_CC): $(UCLIBC_DIR)/lib/libc.a
|
|||||||
SHARED_LIB_LOADER_PATH=$(STAGING_DIR)/lib \
|
SHARED_LIB_LOADER_PATH=$(STAGING_DIR)/lib \
|
||||||
-C $(UCLIBC_DIR) install
|
-C $(UCLIBC_DIR) install
|
||||||
|
|
||||||
$(UCLIBC_DIR)/.installed_runtime: $(TARGET_CC)
|
$(UCLIBC_DIR)/.installed_runtime: $(STAGING_DIR)/.target_dir_exists $(TARGET_CC)
|
||||||
$(MAKE) CROSS=$(CROSS) \
|
$(MAKE) CROSS=$(CROSS) \
|
||||||
PREFIX=$(TARGET_DIR) \
|
PREFIX=$(TARGET_DIR) \
|
||||||
DEVEL_PREFIX=/ \
|
DEVEL_PREFIX=/ \
|
||||||
|
7
boa.mk
7
boa.mk
@ -34,12 +34,9 @@ $(BOA_WORKDIR)/Makefile: $(TARGET_CC) $(BOA_DIR)/.unpacked
|
|||||||
(cd $(BOA_WORKDIR) && CC=$(TARGET_CC) $(BOA_DIR)/src/configure); \
|
(cd $(BOA_WORKDIR) && CC=$(TARGET_CC) $(BOA_DIR)/src/configure); \
|
||||||
fi
|
fi
|
||||||
touch $(BOA_WORKDIR)/.depend
|
touch $(BOA_WORKDIR)/.depend
|
||||||
touch $(BOA_WORKDIR)/.unpacked
|
|
||||||
|
|
||||||
$(BOA_WORKDIR)/boa: $(BOA_WORKDIR)/Makefile
|
$(BOA_WORKDIR)/boa $(BOA_WORKDIR)/boa_indexer: $(BOA_WORKDIR)/Makefile
|
||||||
make VPATH=$(BOA_DIR)/src/ -C $(BOA_WORKDIR)
|
rm -f $@
|
||||||
|
|
||||||
$(BOA_WORKDIR)/boa_indexer: $(BOA_WORKDIR)/Makefile
|
|
||||||
make VPATH=$(BOA_DIR)/src/ -C $(BOA_WORKDIR)
|
make VPATH=$(BOA_DIR)/src/ -C $(BOA_WORKDIR)
|
||||||
|
|
||||||
$(BOA_WORKDIR)/.installed: $(BOA_WORKDIR)/boa $(BOA_WORKDIR)/boa_indexer
|
$(BOA_WORKDIR)/.installed: $(BOA_WORKDIR)/boa $(BOA_WORKDIR)/boa_indexer
|
||||||
|
12
busybox.mk
12
busybox.mk
@ -21,11 +21,12 @@ $(SOURCE_DIR)/$(BUSYBOX_SOURCE):
|
|||||||
done
|
done
|
||||||
|
|
||||||
$(BUSYBOX_DIR)/.unpacked: $(SOURCE_DIR)/$(BUSYBOX_SOURCE)
|
$(BUSYBOX_DIR)/.unpacked: $(SOURCE_DIR)/$(BUSYBOX_SOURCE)
|
||||||
|
rm -rf $(BUSYBOX_DIR) # Make sure no older version interferes
|
||||||
tar -xzf $(SOURCE_DIR)/$(BUSYBOX_SOURCE)
|
tar -xzf $(SOURCE_DIR)/$(BUSYBOX_SOURCE)
|
||||||
touch $(BUSYBOX_DIR)/.unpacked
|
touch $(BUSYBOX_DIR)/.unpacked
|
||||||
|
|
||||||
$(BUSYBOX_WORKDIR)/.config: $(BUSYBOX_DIR)/.unpacked
|
$(BUSYBOX_WORKDIR)/.config: $(BUSYBOX_DIR)/.unpacked
|
||||||
rm -rf $(BUSYBOX_WORKDIR)
|
rm -rf $(BUSYBOX_WORKDIR) # Make sure no half-configured busybox interferes
|
||||||
mkdir -p $(BUSYBOX_WORKDIR)
|
mkdir -p $(BUSYBOX_WORKDIR)
|
||||||
(cd $(BUSYBOX_WORKDIR) && sh $(BUSYBOX_DIR)/pristine_setup.sh)
|
(cd $(BUSYBOX_WORKDIR) && sh $(BUSYBOX_DIR)/pristine_setup.sh)
|
||||||
@perl -i -p \
|
@perl -i -p \
|
||||||
@ -40,13 +41,12 @@ $(BUSYBOX_WORKDIR)/.config: $(BUSYBOX_DIR)/.unpacked
|
|||||||
$(BUSYBOX_WORKDIR)/Config.h
|
$(BUSYBOX_WORKDIR)/Config.h
|
||||||
touch $(BUSYBOX_WORKDIR)/.config
|
touch $(BUSYBOX_WORKDIR)/.config
|
||||||
|
|
||||||
$(BUSYBOX_WORKDIR)/busybox: $(TARGET_CC) $(BUSYBOX_WORKDIR)/.config
|
$(BUSYBOX_WORKDIR)/.built: $(TARGET_CC) $(BUSYBOX_WORKDIR)/.config
|
||||||
rm -f $(BUSYBOX_WORKDIR)/busybox
|
|
||||||
make CROSS="$(TARGET_CROSS)" -C $(BUSYBOX_WORKDIR)
|
make CROSS="$(TARGET_CROSS)" -C $(BUSYBOX_WORKDIR)
|
||||||
|
touch $(BUSYBOX_WORKDIR)/.built
|
||||||
|
|
||||||
$(TARGET_DIR)/bin/busybox: $(BUSYBOX_WORKDIR)/busybox
|
$(TARGET_DIR)/bin/busybox: $(BUSYBOX_WORKDIR)/.built
|
||||||
make CROSS="$(TARGET_CROSS)" PREFIX=$(TARGET_DIR) \
|
make PREFIX=$(TARGET_DIR) -C $(BUSYBOX_WORKDIR) install
|
||||||
-C $(BUSYBOX_WORKDIR) install
|
|
||||||
|
|
||||||
busybox: $(TARGET_DIR)/bin/busybox
|
busybox: $(TARGET_DIR)/bin/busybox
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user