Commit 27c73a4b authored by Ryan Jackson's avatar Ryan Jackson

Use MFS_ARCH makefile variable to determine build arch

parent 83850bb9
MFS_ARCH = x86_64
SOURCE_PATH = $(PWD)/source
TARGET_PATH = $(PWD)/target
TARGET_BUILD_PATH = $(PWD)/build
......@@ -5,7 +6,7 @@ SCRIPTS_PATH = $(PWD)/scripts
INITRAMFS_PATH = $(PWD)/initramfs.tmp
BUILDROOT_PATH = $(PWD)/buildroot
FAKEROOT_ENVIRONMENT = $(PWD)/fs_fakeroot.env
STAGING_DIR = $(PWD)/buildroot/build_x86_64/staging_dir
STAGING_DIR = $(PWD)/buildroot/build_$(MFS_ARCH)/staging_dir
BOOT_PATH = $(PWD)/boot
INITRAMFS = $(BOOT_PATH)/initramfs.gz
......@@ -53,7 +54,7 @@ $(INSTALL_MODULES):
$(TARGET_PATH)/lib/libc.so.0:
mkdir -p $(TARGET_PATH)/lib
cp -dpR $(BUILDROOT_PATH)/project_build_x86_64/uclibc/root/lib/* $(TARGET_PATH)/lib
cp -dpR $(BUILDROOT_PATH)/project_build_$(MFS_ARCH)/uclibc/root/lib/* $(TARGET_PATH)/lib
uclibc-install: $(TARGET_PATH)/lib/libc.so.0
......
......@@ -35,8 +35,8 @@ $(DROPBEAR_PATH)/.config-stamp: $(DROPBEAR_PATH)/.patch-stamp
cd $(DROPBEAR_PATH); \
$(HOST_CONFIGURE_OPTS) \
./configure --prefix=/usr \
--target=x86_64-linux-uclibc \
--host=x86_64-linux-uclibc \
--target=$(MFS_ARCH)-linux-uclibc \
--host=$(MFS_ARCH)-linux-uclibc \
--sysconfdir=/etc \
--localstatedir=/var \
--libdir=$(STAGING_DIR)/usr/lib \
......@@ -46,7 +46,7 @@ $(DROPBEAR_PATH)/.config-stamp: $(DROPBEAR_PATH)/.patch-stamp
$(DROPBEAR_PATH)/dropbearmulti: $(DROPBEAR_PATH)/.config-stamp
PATH=$(STAGING_DIR)/usr/bin:$(PATH) $(MAKE) -C $(DROPBEAR_PATH) \
$(TARGET_CONFIGURE_OPTS) LD=x86_64-linux-uclibc-gcc \
$(TARGET_CONFIGURE_OPTS) LD=$(MFS_ARCH)-linux-uclibc-gcc \
PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp" \
MULTI=1 SCPPROGRESS=1
touch $@
......
......@@ -43,8 +43,8 @@ $(E2FSPROGS_PATH)/.config-stamp: $(E2FSPROGS_PATH)/.patch-stamp
PATH=$(STAGING_DIR)/usr/bin:$(PATH) \
$(HOST_CONFIGURE_OPTS) \
./configure \
--target=x86_64-linux-uclibc \
--host=x86_64-linux-uclibc \
--target=$(MFS_ARCH)-linux-uclibc \
--host=$(MFS_ARCH)-linux-uclibc \
--with-cc=$(CROSS_COMPILER_PREFIX)gcc \
--with-linker=$(CROSS_COMPILER_PREFIX)ld \
--prefix=/usr \
......@@ -73,27 +73,27 @@ $(E2FSPROGS_PATH)/.config-stamp: $(E2FSPROGS_PATH)/.patch-stamp
$(E2FSPROGS_PATH)/misc/mke2fs: $(E2FSPROGS_PATH)/.config-stamp
LDFLAGS="-rpath ../lib" PATH=$(STAGING_DIR)/usr/bin:$(PATH) $(MAKE) -C $(E2FSPROGS_PATH) \
$(TARGET_CONFIGURE_OPTS) LD=x86_64-linux-uclibc-gcc
$(TARGET_CONFIGURE_OPTS) LD=$(MFS_ARCH)-linux-uclibc-gcc
touch $@
$(E2FSPROGS_PATH)/e2fsck/e2fsck: $(E2FSPROGS_PATH)/.config-stamp
LDFLAGS="-rpath ../lib" PATH=$(STAGING_DIR)/usr/bin:$(PATH) $(MAKE) -C $(E2FSPROGS_PATH) \
$(TARGET_CONFIGURE_OPTS) LD=x86_64-linux-uclibc-gcc
$(TARGET_CONFIGURE_OPTS) LD=$(MFS_ARCH)-linux-uclibc-gcc
touch $@
$(E2FSPROGS_PATH)/misc/tune2fs: $(E2FSPROGS_PATH)/.config-stamp
LDFLAGS="-rpath ../lib" PATH=$(STAGING_DIR)/usr/bin:$(PATH) $(MAKE) -C $(E2FSPROGS_PATH) \
$(TARGET_CONFIGURE_OPTS) LD=x86_64-linux-uclibc-gcc
$(TARGET_CONFIGURE_OPTS) LD=$(MFS_ARCH)-linux-uclibc-gcc
touch $@
$(E2FSPROGS_PATH)/misc/uuidgen: $(E2FSPROGS_PATH)/.config-stamp
LDFLAGS="-rpath ../lib" PATH=$(STAGING_DIR)/usr/bin:$(PATH) $(MAKE) -C $(E2FSPROGS_PATH) \
$(TARGET_CONFIGURE_OPTS) LD=x86_64-linux-uclibc-gcc
$(TARGET_CONFIGURE_OPTS) LD=$(MFS_ARCH)-linux-uclibc-gcc
touch $@
$(E2FSPROGS_PATH)/lib/%.so: $(E2FSPROGS_PATH)/.config-stamp
LDFLAGS="-rpath ../lib" PATH=$(STAGING_DIR)/usr/bin:$(PATH) $(MAKE) -C $(E2FSPROGS_PATH) \
$(TARGET_CONFIGURE_OPTS) LD=x86_64-linux-uclibc-gcc
$(TARGET_CONFIGURE_OPTS) LD=$(MFS_ARCH)-linux-uclibc-gcc
touch $@
$(TARGET_PATH)/lib/%.so: $(E2FSPROGS_PATH)/lib/%.so
......
......@@ -38,9 +38,9 @@ $(FILE_PATH)/.config-stamp: $(FILE_PATH)/.patch-stamp
PATH=$(STAGING_DIR)/usr/bin:$(PATH) \
$(HOST_CONFIGURE_OPTS) \
./configure \
--target=x86_64-linux-uclibc \
--host=x86_64-linux-uclibc \
--build=x86_64-linux-gnu \
--target=$(MFS_ARCH)-linux-uclibc \
--host=$(MFS_ARCH)-linux-uclibc \
--build=$(MFS_ARCH)-linux-gnu \
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
......@@ -63,7 +63,7 @@ $(FILE_PATH)/src/.libs/file: $(FILE_PATH)/.config-stamp
PATH=$(STAGING_DIR)/usr/bin:$(PATH) \
CC=$(TARGET_CC) \
$(MAKE) -C $(FILE_PATH) \
$(TARGET_CONFIGURE_OPTS) LD=x86_64-linux-uclibc-gcc
$(TARGET_CONFIGURE_OPTS) LD=$(MFS_ARCH)-linux-uclibc-gcc
touch $@
$(TARGET_PATH)/usr/share/misc/magic:
......
......@@ -42,7 +42,7 @@ $(HDPARM_PATH)/hdparm: $(HDPARM_PATH)/.config-stamp
PATH=$(STAGING_DIR)/usr/bin:$(PATH) \
CC=$(TARGET_CC) \
$(MAKE) -C $(HDPARM_PATH) \
$(TARGET_CONFIGURE_OPTS) LD=x86_64-linux-uclibc-gcc
$(TARGET_CONFIGURE_OPTS) LD=$(MFS_ARCH)-linux-uclibc-gcc
touch $@
$(TARGET_PATH)/sbin/hdparm: $(HDPARM_PATH)/hdparm
......
......@@ -8,7 +8,7 @@ TARGET_MODULE_PATH = $(TARGET_PATH)/lib/modules/$(LINUX_VERSION)
MODULE_TARBALL_PATH = $(TOPDIR)/boot/modules-$(LINUX_VERSION).tar.gz
export ARCH=x86_64
export ARCH=$(MFS_ARCH)
export INSTALL_MOD_PATH=$(TARGET_PATH)
.PHONY: extract patch config bzImage \
......@@ -35,7 +35,7 @@ install: bzImage-install modules-install
bzImage-install: bzImage
mkdir -p $(TOPDIR)/boot
cp $(LINUX_PATH)/arch/x86_64/boot/bzImage $(TOPDIR)/boot/vmlinuz-$(LINUX_VERSION)
cp $(LINUX_PATH)/arch/$(MFS_ARCH)/boot/bzImage $(TOPDIR)/boot/vmlinuz-$(LINUX_VERSION)
cp $(LINUX_PATH)/System.map $(TOPDIR)/boot/System.map-$(LINUX_VERSION)
cp $(LINUX_PATH)/.config $(TOPDIR)/boot/config-$(LINUX_VERSION)
......
......@@ -45,18 +45,18 @@ $(OPENSSL_PATH)/.config-stamp: $(OPENSSL_PATH)/.patch-stamp
(cd $(OPENSSL_PATH); \
CFLAGS="-DOPENSSL_NO_KRB5 -DOPENSSL_NO_IDEA -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5 $(TARGET_CFLAGS)" \
PATH=$(STAGING_DIR)/usr/bin:$(PATH) \
./Configure linux-x86_64 --prefix=/ \
./Configure linux-$(MFS_ARCH) --prefix=/ \
--openssldir=/lib/ssl -L$(STAGING_DIR)/lib -ldl \
-I$(STAGING_DIR)/usr/include $(OPENSSL_OPTS) threads \
shared no-idea no-mdc2 no-rc5)
touch $@
$(OPENSSL_PATH)/apps/openssl: $(OPENSSL_PATH)/.config-stamp
PATH=$(STAGING_DIR)/usr/bin:$(PATH) $(MAKE) CC=x86_64-linux-uclibc-gcc -C $(OPENSSL_PATH) all build-shared
PATH=$(STAGING_DIR)/usr/bin:$(PATH) $(MAKE) CC=$(MFS_ARCH)-linux-uclibc-gcc -C $(OPENSSL_PATH) all build-shared
# Work around openssl build bug to link libssl.so with libcrypto.so.
-rm $(OPENSSL_PATH)/libssl.so.*.*.*
$(MAKE) PATH=$(PATH):$(STAGING_DIR)/usr/bin \
CC=x86_64-linux-uclibc-gcc -C $(OPENSSL_PATH) do_linux-shared
CC=$(MFS_ARCH)-linux-uclibc-gcc -C $(OPENSSL_PATH) do_linux-shared
touch $@
$(STAGING_DIR)/usr/lib/libcrypto.a: $(OPENSSL_PATH)/apps/openssl
......
......@@ -22,7 +22,7 @@ $(PORTMAP_PATH)/portmap: config
NO_TCP_WRAPPER=true \
$(MAKE) -C $(PORTMAP_PATH) \
LDFLAGS=-fPIE
$(TARGET_CONFIGURE_OPTS) LD=x86_64-linux-uclibc-gcc
$(TARGET_CONFIGURE_OPTS) LD=$(MFS_ARCH)-linux-uclibc-gcc
install: $(PORTMAP_PATH)/portmap
install -m 755 $(PORTMAP_PATH)/portmap $(TARGET_PATH)/sbin
......
......@@ -37,9 +37,9 @@ $(SUDO_PATH)/.config-stamp: $(SUDO_PATH)/.patch-stamp
PATH=$(STAGING_DIR)/usr/bin:$(PATH) \
$(HOST_CONFIGURE_OPTS) \
./configure \
--target=x86_64-linux-uclibc \
--host=x86_64-linux-uclibc \
--build=x86_64-linux-gnu \
--target=$(MFS_ARCH)-linux-uclibc \
--host=$(MFS_ARCH)-linux-uclibc \
--build=$(MFS_ARCH)-linux-gnu \
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
......@@ -69,7 +69,7 @@ $(SUDO_PATH)/sudo: $(SUDO_PATH)/.config-stamp
PATH=$(STAGING_DIR)/usr/bin:$(PATH) \
CC=$(TARGET_CC) \
$(MAKE) -C $(SUDO_PATH) \
$(TARGET_CONFIGURE_OPTS) LD=x86_64-linux-uclibc-gcc
$(TARGET_CONFIGURE_OPTS) LD=$(MFS_ARCH)-linux-uclibc-gcc
touch $@
$(TARGET_PATH)/usr/bin/sudo: $(SUDO_PATH)/sudo
......
......@@ -37,9 +37,9 @@ $(WGET_PATH)/.config-stamp: $(WGET_PATH)/.patch-stamp
PATH=$(STAGING_DIR)/usr/bin:$(PATH) \
$(HOST_CONFIGURE_OPTS) \
./configure \
--target=x86_64-linux-uclibc \
--host=x86_64-linux-uclibc \
--build=x86_64-linux-gnu \
--target=$(MFS_ARCH)-linux-uclibc \
--host=$(MFS_ARCH)-linux-uclibc \
--build=$(MFS_ARCH)-linux-gnu \
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
......@@ -62,7 +62,7 @@ $(WGET_PATH)/src/wget: $(WGET_PATH)/.config-stamp
PATH=$(STAGING_DIR)/usr/bin:$(PATH) \
CC=$(TARGET_CC) \
$(MAKE) -C $(WGET_PATH) \
$(TARGET_CONFIGURE_OPTS) LD=x86_64-linux-uclibc-gcc
$(TARGET_CONFIGURE_OPTS) LD=$(MFS_ARCH)-linux-uclibc-gcc
touch $@
$(TARGET_PATH)/usr/bin/wget: $(WGET_PATH)/src/wget
......
......@@ -43,7 +43,7 @@ $(ZLIB_PATH)/.patch-stamp: $(ZLIB_PATH)/.extract-stamp
$(ZLIB_PATH)/.config-stamp: $(ZLIB_PATH)/.patch-stamp
rm -f $(ZLIB_PATH)/config.cache
cd $(ZLIB_PATH); \
$(HOST_CONFIGURE_OPTS) CC=x86_64-linux-uclibc-gcc \
$(HOST_CONFIGURE_OPTS) CC=$(MFS_ARCH)-linux-uclibc-gcc \
CFLAGS="$(ZLIB_CFLAGS)" \
./configure --prefix=/usr \
--exec_prefix=$(STAGING_DIR)/usr/bin \
......
MFS_ARCH = x86_64
TOPDIR = $(PWD)
SOURCE_PATH = $(TOPDIR)/source
SCRIPTS_PATH = $(TOPDIR)/scripts
......@@ -10,13 +11,16 @@ TEMPLATE_PATH = $(TOPDIR)/target_template
TARGET_INITRAMFS = $(TOPDIR)/target.cpio.gz
FAKEROOT_ENVIRONMENT = $(TOPDIR)/$(BUILD)_fs_fakeroot.env
TARGET_CC = x86_64-linux-uclibc-gcc
#TARGET_CFLAGS = -Os -mtune=nocona -march=x86_64
TARGET_CC = $(MFS_ARCH)-linux-uclibc-gcc
ifeq ($(MFS_ARCH),i386)
TARGET_CFLAGS = -Os -mtune=i386 -march=i386
else
TARGET_CFLAGS = -Os
endif
TARGET_MODULES = uclibc-install-target zlib-install-target busybox-install dropbear-install linux-modules-install openssl-install-target kexec-install tmcc-install imagezip-install frisbee-install e2fsprogs-install
BUILDROOT_PATH = $(TOPDIR)/buildroot
STAGING_DIR = $(BUILDROOT_PATH)/build_x86_64/staging_dir/
STAGING_DIR = $(BUILDROOT_PATH)/build_$(MFS_ARCH)/staging_dir/
#HOSTMAKE=make
#HOSTAR=ar
......@@ -28,9 +32,9 @@ STAGING_DIR = $(BUILDROOT_PATH)/build_x86_64/staging_dir/
#TOOLCHAIN_PATH="$(STAGING_DIR)/bin:$(STAGING_DIR)/usr/bin:$(PATH)"
CROSS_COMPILER_PREFIX=x86_64-linux-uclibc-
CROSS_COMPILER_PREFIX=$(MFS_ARCH)-linux-uclibc-
STRIPCMD=$(STAGING_DIR)/usr/bin/$(CROSS_COMPILER_PREFIX)strip
#CC=$(STAGING_DIR)/usr/bin/x86_64-linux-uclibc-gcc -Os -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include --sysroot=$(STAGING_DIR)/ -isysroot $(STAGING_DIR) -mtune=x86_64 -march=x86_64
#CC=$(STAGING_DIR)/usr/bin/$(MFS_ARCH)-linux-uclibc-gcc -Os -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include --sysroot=$(STAGING_DIR)/ -isysroot $(STAGING_DIR) -mtune=$(MFS_ARCH) -march=$(MFS_ARCH)
# Hack for building uClibc -- it can't handle parallel make processes.
#MAKE1:=$(HOSTMAKE) MAKE="$(firstword $(HOSTMAKE)) -j1"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment