# sources/kernel-patches/031-lowlatency-fixes-5.bz2
# sources/kernel-patches/099-shutup.bz2
#
-# these patched will all be applied by the patch-kernel.sh
+# these patches will all be applied by the patch-kernel.sh
# script (which will also abort the build if it finds rejects)
# -Erik
#
#############################################################
ifneq ($(filter $(TARGETS),linux),)
-LINUX_DIR=$(BUILD_DIR)/linux-2.4.20
-LINUX_FORMAT=bzImage
-#LINUX_FORMAT=zImage.prep
-LINUX_BINLOC=arch/$(ARCH)/boot/$(LINUX_FORMAT)
-#LINUX_BINLOC=arch/ppc/boot/images/$(LINUX_FORMAT)
-LINUX_KERNEL=$(BUILD_DIR)/buildroot-kernel
-LINUX_SOURCE=linux-2.4.20.tar.bz2
+LINUX_VERSION=2.4.20
+LINUX_DIR=$(BUILD_DIR)/linux-$(LINUX_VERSION)
+#LINUX_FORMAT=bzImage
+LINUX_FORMAT=zImage
+#LINUX_BINLOC=arch/$(ARCH)/boot/$(LINUX_FORMAT)
+LINUX_BINLOC=arch/ppc/boot/images/zImage.prep
+LINUX_SOURCE=linux-$(LINUX_VERSION).tar.bz2
LINUX_SITE=http://ftp.us.kernel.org/pub/linux/kernel/v2.4
LINUX_KCONFIG=$(SOURCE_DIR)/linux.config
-LINUX_VERSION=$(shell grep -s UTS_RELEASE $(LINUX_DIR)/include/linux/version.h | cut -f 2 -d \" || echo \"2.4.20\" )
+LINUX_KERNEL=$(BUILD_DIR)/buildroot-kernel
$(DL_DIR)/$(LINUX_SOURCE):
$(WGET) -P $(DL_DIR) $(LINUX_SITE)/$(LINUX_SOURCE)
-$(LINUX_DIR)/.dist: $(DL_DIR)/$(LINUX_SOURCE)
+$(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
rm -rf $(LINUX_DIR)
bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(BUILD_DIR) -xvf -
mkdir -p $(SOURCE_DIR)/kernel-patches
$(SOURCE_DIR)/patch-kernel.sh $(LINUX_DIR) $(SOURCE_DIR)/kernel-patches
- touch $(LINUX_DIR)/.dist
+ -(cd $(BUILD_DIR); ln -sf $(LINUX_DIR) linux)
+ touch $(LINUX_DIR)/.unpacked
$(LINUX_KCONFIG):
@if [ ! -f "$(LINUX_KCONFIG)" ] ; then \
sleep 5; \
fi;
-$(LINUX_DIR)/.configured: $(LINUX_DIR)/.dist $(LINUX_KCONFIG)
+$(LINUX_DIR)/.configured: $(LINUX_DIR)/.unpacked $(LINUX_KCONFIG)
#perl -i -p -e "s,^CROSS_COMPILE.*,\
# CROSS_COMPILE=$(STAGING_DIR)/bin/$(ARCH)-uclibc-,g;" \
# $(LINUX_DIR)/Makefile
linux-dirclean:
rm -rf $(LINUX_DIR)
-#############################################################
-#
-# Setup the kernel headers, but don't compile anything for the target yet,
-# since we still need to build a cross-compiler to do that little task for
-# us... Try to work around this little chicken-and-egg problem..
-#
-#############################################################
-linux_headers: $(LINUX_DIR)/.configured
-
endif
LINUX_DIR:=$(BUILD_DIR)/linux
endif
+linux_headers: $(LINUX_DIR)/.configured
+
+
$(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.unpacked
perl -i -p -e 's,^CROSS=.*,TARGET_ARCH=$(ARCH)\nCC=$(HOSTCC),g' $(UCLIBC_DIR)/Rules.mak
cp $(SOURCE_DIR)/uClibc.config $(UCLIBC_DIR)/.config
$(TARGET_DIR)/usr/bin/ldd: $(TARGET_DIR)/lib/libc.so.0
$(MAKE) -C $(UCLIBC_DIR) PREFIX=$(TARGET_DIR) install_target_utils
-uclibc: $(LINUX_KERNEL) $(STAGING_DIR)/lib/libc.a $(TARGET_DIR)/lib/libc.so.0 $(TARGET_DIR)/usr/bin/ldd
+uclibc: linux_headers $(STAGING_DIR)/lib/libc.a $(TARGET_DIR)/lib/libc.so.0 $(TARGET_DIR)/usr/bin/ldd
uclibc-clean:
rm -f $(TARGET_DIR)/lib/libc.so.0
$(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) $(SOURCE_DIR) gcc-*.patch
touch $(GCC_DIR)/.patched
+$(GCC_DIR)/.gcc_build_hacks: $(GCC_DIR)/.patched
+ #
+ # Hack things to use the correct shared lib loader
+ #
+ (cd $(GCC_DIR); set -e; export LIST=`grep -lr -- "-dynamic-linker.*\.so[\.0-9]*" *`;\
+ if [ -n "$$LIST" ] ; then \
+ perl -i -p -e "s,-dynamic-linker.*\.so[\.0-9]*},\
+ -dynamic-linker /lib/ld-uClibc.so.0},;" $$LIST; fi);
+ #
+ # Prevent system glibc start files from leaking in uninvited...
+ #
+ perl -i -p -e "s,standard_startfile_prefix_1 = \".*,standard_startfile_prefix_1=\
+ \"$(STAGING_DIR)/lib/\";,;" $(GCC_DIR)/gcc/gcc.c;
+ perl -i -p -e "s,standard_startfile_prefix_2 = \".*,standard_startfile_prefix_2=\
+ \"$(STAGING_DIR)/usr/lib/\";,;" $(GCC_DIR)/gcc/gcc.c;
+ #
+ # Prevent system glibc include files from leaking in uninvited...
+ #
+ perl -i -p -e "s,^NATIVE_SYSTEM_HEADER_DIR.*,\
+ NATIVE_SYSTEM_HEADER_DIR=$(STAGING_DIR)/usr/include,;" $(GCC_DIR)/gcc/Makefile.in;
+ perl -i -p -e "s,^CROSS_SYSTEM_HEADER_DIR.*,\
+ CROSS_SYSTEM_HEADER_DIR=$(STAGING_DIR)/usr/include,;" $(GCC_DIR)/gcc/Makefile.in;
+ #
+ # Prevent gcc from using the unwind-dw2-fde-glibc code
+ #
+ perl -i -p -e "s,^#ifndef inhibit_libc,#define inhibit_libc\n\
+ #ifndef inhibit_libc,g;" $(GCC_DIR)/gcc/unwind-dw2-fde-glibc.c;
+ touch $(GCC_DIR)/.gcc_build_hacks
+
# The --without-headers option stopped working with gcc 3.0 and has never been
# # fixed, so we need to actually have working C library header files prior to
# # the step or libgcc will not build...
-$(GCC_BUILD_DIR1)/.configured: $(GCC_DIR)/.patched
+$(GCC_BUILD_DIR1)/.configured: $(GCC_DIR)/.gcc_build_hacks
mkdir -p $(GCC_BUILD_DIR1)
(cd $(GCC_BUILD_DIR1); PATH=$(STAGING_DIR)/bin:$$PATH AR=$(ARCH)-uclibc-ar \
RANLIB=$(ARCH)-uclibc-ranlib CC=$(HOSTCC) $(GCC_DIR)/configure \
--datadir=$(STAGING_DIR)/share --includedir=$(STAGING_DIR)/include \
--libdir=$(STAGING_DIR)/lib --localstatedir=$(STAGING_DIR)/var \
--mandir=$(STAGING_DIR)/man --infodir=$(STAGING_DIR)/info \
+ --with-local-prefix=$(STAGING_DIR)/usr/local \
+ --oldincludedir=$(STAGING_DIR)/usr/include \
--enable-target-optspace --disable-nls --with-gnu-ld \
--disable-shared --enable-languages=c --disable-__cxa_atexit \
--program-prefix=$(ARCH)-uclibc-);
- -perl -i -p -e "s,ac_cv_prog_cc_cross=no,ac_cv_prog_cc_cross=yes,g;" $(GCC_BUILD_DIR1)/config.cache
touch $(GCC_BUILD_DIR1)/.configured
$(GCC_BUILD_DIR1)/.compiled: $(GCC_BUILD_DIR1)/.configured
bzcat $(DL_DIR)/$(UCLIBC_SOURCE) | tar -C $(BUILD_DIR) -xvf -
touch $(UCLIBC_DIR)/.unpacked
-$(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.unpacked linux_headers
+$(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.unpacked $(BUILD_DIR)/linux/.configured
perl -i -p -e 's,^CROSS=.*,TARGET_ARCH=$(ARCH)\nCROSS=$(TARGET_CROSS),g' \
$(UCLIBC_DIR)/Rules.mak
cp $(SOURCE_DIR)/uClibc.config $(UCLIBC_DIR)/.config
#
#############################################################
GCC_BUILD_DIR2:=$(BUILD_DIR)/gcc-final
-$(GCC_DIR)/.ldso_hacks: $(GCC_DIR)/.patched
- #
- # Hack things to use the correct shared lib loader
- #
- (cd $(GCC_DIR); set -e; export LIST=`grep -lr -- "-dynamic-linker.*\.so[\.0-9]*" *`;\
- if [ -n "$$LIST" ] ; then \
- perl -i -p -e "s,-dynamic-linker.*\.so[\.0-9]*},\
- -dynamic-linker /lib/ld-uClibc.so.0},;" $$LIST; fi);
- #
- # Prevent glibc start files from ever leaking in uninvited...
- #
- perl -i -p -e "s,standard_startfile_prefix_1 = \".*,standard_startfile_prefix_1=\
- \"$(STAGING_DIR)/lib/\";,;" $(GCC_DIR)/gcc/gcc.c;
- perl -i -p -e "s,standard_startfile_prefix_2 = \".*,standard_startfile_prefix_2=\
- \"$(STAGING_DIR)/usr/lib/\";,;" $(GCC_DIR)/gcc/gcc.c;
+$(GCC_DIR)/.g++_build_hacks: $(GCC_DIR)/.patched
#
# Hack up the soname for libstdc++
#
$(GCC_DIR)/libstdc++-v3/config/os/gnu-linux/bits/
cp $(GCC_DIR)/libstdc++-v3/config/os/generic/bits/ctype_noninline.h \
$(GCC_DIR)/libstdc++-v3/config/os/gnu-linux/bits/
- #
- # Prevent gcc from using the unwind-dw2-fde-glibc code
- #
- perl -i -p -e "s,^#ifndef inhibit_libc,#define inhibit_libc\n\
- #ifndef inhibit_libc,g;" $(GCC_DIR)/gcc/unwind-dw2-fde-glibc.c;
- touch $(GCC_DIR)/.ldso_hacks
+ touch $(GCC_DIR)/.g++_build_hacks
-$(GCC_BUILD_DIR2)/.configured: $(GCC_DIR)/.ldso_hacks
+$(GCC_BUILD_DIR2)/.configured: $(GCC_DIR)/.g++_build_hacks
mkdir -p $(GCC_BUILD_DIR2)
(cd $(GCC_BUILD_DIR2); PATH=$(STAGING_DIR)/bin:$$PATH AR=$(ARCH)-uclibc-ar \
RANLIB=$(ARCH)-uclibc-ranlib CC=$(HOSTCC) $(GCC_DIR)/configure \
--datadir=$(STAGING_DIR)/share --includedir=$(STAGING_DIR)/include \
--libdir=$(STAGING_DIR)/lib --localstatedir=$(STAGING_DIR)/var \
--mandir=$(STAGING_DIR)/man --infodir=$(STAGING_DIR)/info \
+ --with-local-prefix=$(STAGING_DIR)/usr/local \
+ --oldincludedir=$(STAGING_DIR)/usr/include \
--enable-target-optspace --disable-nls --with-gnu-ld \
--disable-shared --enable-languages=$(TARGET_LANGUAGES) --disable-__cxa_atexit \
--program-prefix=$(ARCH)-uclibc-);
- perl -i -p -e "s,ac_cv_prog_cc_cross=no,ac_cv_prog_cc_cross=yes,g;" $(GCC_BUILD_DIR2)/config.cache
touch $(GCC_BUILD_DIR2)/.configured
$(GCC_BUILD_DIR2)/.compiled: $(GCC_BUILD_DIR2)/.configured
#############################################################
ifneq ($(filter $(TARGETS),user-mode-linux),)
+LINUX_VERSION=2.4.19
+LINUX_DIR=$(BUILD_DIR)/linux-$(LINUX_VERSION)
+LINUX_SOURCE=linux-$(LINUX_VERSION).tar.bz2
+LINUX_SITE=http://ftp.us.kernel.org/pub/linux/kernel/v2.4
+LINUX_PATCH_1:=uml-patch-$(LINUX_VERSION)-5.bz2
+LINUX_PATCH_1_SITE:=http://telia.dl.sourceforge.net/sourceforge/user-mode-linux
+LINUX_KCONFIG=$(SOURCE_DIR)/linux-uml.config
LINUX_KERNEL=$(BASE_DIR)/UMlinux
-UMLINUX_DIR=$(BUILD_DIR)/linux-2.4.19
-LINUX_DIR=$(UMLINUX_DIR)
-UMLINUX_SOURCE=linux-2.4.19.tar.bz2
-UMLINUX_SITE=http://ftp.us.kernel.org/pub/linux/kernel/v2.4
-UMLINUX_PATCH_1:=uml-patch-2.4.19-5.bz2
-UMLINUX_PATCH_1_SITE:=http://telia.dl.sourceforge.net/sourceforge/user-mode-linux
-UMLINUX_KCONFIG=$(SOURCE_DIR)/linux-uml.config
-$(DL_DIR)/$(UMLINUX_SOURCE):
- $(WGET) -P $(DL_DIR) $(UMLINUX_SITE)/$(UMLINUX_SOURCE)
+$(DL_DIR)/$(LINUX_SOURCE):
+ $(WGET) -P $(DL_DIR) $(LINUX_SITE)/$(LINUX_SOURCE)
-$(DL_DIR)/$(UMLINUX_PATCH_1):
- $(WGET) -P $(DL_DIR) $(UMLINUX_PATCH_1_SITE)/$(UMLINUX_PATCH_1)
+$(DL_DIR)/$(LINUX_PATCH_1):
+ $(WGET) -P $(DL_DIR) $(LINUX_PATCH_1_SITE)/$(LINUX_PATCH_1)
-user-mode-linux-source: $(DL_DIR)/$(UMLINUX_SOURCE) $(DL_DIR)/$(UMLINUX_PATCH_1)
+user-mode-linux-source: $(DL_DIR)/$(LINUX_SOURCE) $(DL_DIR)/$(LINUX_PATCH_1)
-$(UMLINUX_DIR)/.unpacked: $(DL_DIR)/$(UMLINUX_SOURCE) $(DL_DIR)/$(UMLINUX_PATCH_1)
- bzcat $(DL_DIR)/$(UMLINUX_SOURCE) | tar -C $(BUILD_DIR) -xvf -
- touch $(UMLINUX_DIR)/.unpacked
+$(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE) $(DL_DIR)/$(LINUX_PATCH_1)
+ bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(BUILD_DIR) -xvf -
+ -(cd $(BUILD_DIR); ln -sf $(LINUX_DIR) linux)
+ touch $(LINUX_DIR)/.unpacked
-$(UMLINUX_DIR)/.patched: $(UMLINUX_DIR)/.unpacked
- bzcat $(DL_DIR)/$(UMLINUX_PATCH_1) | patch -d $(UMLINUX_DIR) -p1
- touch $(UMLINUX_DIR)/.patched
+$(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked
+ bzcat $(DL_DIR)/$(LINUX_PATCH_1) | patch -d $(LINUX_DIR) -p1
+ touch $(LINUX_DIR)/.patched
-$(UMLINUX_DIR)/.set_arch: $(UMLINUX_DIR)/.patched
- perl -i -p -e "s/^ARCH :=.*/ARCH:=um/g;" $(UMLINUX_DIR)/Makefile
- touch $(UMLINUX_DIR)/.set_arch
+$(LINUX_DIR)/.set_arch: $(LINUX_DIR)/.patched
+ perl -i -p -e "s/^ARCH :=.*/ARCH:=um/g;" $(LINUX_DIR)/Makefile
+ touch $(LINUX_DIR)/.set_arch
-$(UMLINUX_DIR)/.configured: $(UMLINUX_DIR)/.set_arch $(UMLINUX_KCONFIG)
- cp $(UMLINUX_KCONFIG) $(UMLINUX_DIR)/.config
- make -C $(UMLINUX_DIR) oldconfig include/linux/version.h
- touch $(UMLINUX_DIR)/.configured
+$(LINUX_DIR)/.configured: $(LINUX_DIR)/.set_arch $(LINUX_KCONFIG)
+ cp $(LINUX_KCONFIG) $(LINUX_DIR)/.config
+ make -C $(LINUX_DIR) oldconfig include/linux/version.h
+ touch $(LINUX_DIR)/.configured
-$(UMLINUX_DIR)/.depend_done: $(UMLINUX_DIR)/.configured
- make -C $(UMLINUX_DIR) dep
- touch $(UMLINUX_DIR)/.depend_done
+$(LINUX_DIR)/.depend_done: $(LINUX_DIR)/.configured
+ make -C $(LINUX_DIR) dep
+ touch $(LINUX_DIR)/.depend_done
-$(UMLINUX_DIR)/linux: $(UMLINUX_DIR)/.depend_done
- make -C $(UMLINUX_DIR) linux
+$(LINUX_DIR)/linux: $(LINUX_DIR)/.depend_done
+ make -C $(LINUX_DIR) linux
-$(LINUX_KERNEL): $(UMLINUX_DIR)/linux
- cp -fa $(UMLINUX_DIR)/linux $(LINUX_KERNEL)
+$(LINUX_KERNEL): $(LINUX_DIR)/linux
+ cp -fa $(LINUX_DIR)/linux $(LINUX_KERNEL)
user-mode-linux: $(LINUX_KERNEL)
# Renamed so it is not cleaned by default on a make clean
user-mode-linux_clean: clean
rm -f $(LINUX_KERNEL)
- -make -C $(UMLINUX_DIR) clean
+ -make -C $(LINUX_DIR) clean
user-mode-linux-dirclean:
- rm -rf $(UMLINUX_DIR)
-
-#############################################################
-#
-# Setup the kernel headers, but don't compile anything for the target yet,
-# since we still need to build a cross-compiler to do that little task for
-# us... Try to work around this little chicken-and-egg problem..
-#
-#############################################################
-linux_headers: $(UMLINUX_DIR)/.configured
+ rm -rf $(LINUX_DIR)
endif