Commit e7d163f7 authored by Chris Zankel's avatar Chris Zankel Committed by Linus Torvalds

[PATCH] xtensa: Removed local copy of zlib and fixed O= support

Removed an unnecessary local copy of zlib (sorry for the add'l traffic).
Fixed 'O=' support (thanks to Jan Dittmer for pointing it out).  Some minor
clean-ups in the make files.
Signed-off-by: default avatarChris Zankel <chris@zankel.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 82300bf4
......@@ -21,23 +21,17 @@ export CPU
# Platform configuration
platform-y := common
platform-$(CONFIG_XTENSA_PLATFORM_XT2000) := xt2000
platform-$(CONFIG_XTENSA_PLATFORM_ISS) := iss
PLATFORM = $(platform-y)
export PLATFORM
#LDFLAGS_vmlinux := -T$(word 1,$(LINKSCRIPT))
AFLAGS_vmlinux.lds.o := -Uxtensa
CPPFLAGS += -Iarch/xtensa -Iinclude/asm -mlongcalls -g
AFLAGS += -Iarch/xtensa -Iinclude/asm
CPP = $(CC) -E $(CFLAGS)
CPPFLAGS += $(if $(KBUILD_SRC),-I$(srctree)/include/asm-xtensa/)
CPPFLAGS += -Iinclude/asm
CFLAGS += -pipe -mlongcalls
cflags-y += -Iarch/xtensa -pipe -mlongcalls
KBUILD_DEFCONFIG := common_defconfig
KBUILD_DEFCONFIG := iss_defconfig
# ramdisk/initrd support
# You need a compressed ramdisk image, named ramdisk.gz in
......@@ -62,30 +56,36 @@ endif
LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
head-y := arch/xtensa/kernel/head.o
core-y += arch/xtensa/kernel/ \
arch/xtensa/mm/ arch/xtensa/platform-$(PLATFORM)/
core-y += arch/xtensa/kernel/ arch/xtensa/mm/
ifneq ($(PLATFORM),)
core-y += arch/xtensa/platform-$(PLATFORM)/
endif
libs-y += arch/xtensa/lib/ $(LIBGCC)
boot := arch/xtensa/boot
archinc := include/asm-xtensa
arch/xtensa/kernel/asm-offsets.s: \
arch/xtensa/kernel/asm-offsets.c \
include/asm-xtensa/.platform
arch/xtensa/kernel/asm-offsets.c $(archinc)/.platform
include/asm-xtensa/offsets.h: arch/xtensa/kernel/asm-offsets.s
$(call filechk,gen-asm-offsets)
prepare: include/asm-xtensa/.platform include/asm-xtensa/offsets.h
prepare: $(archinc)/.platform $(archinc)/offsets.h
# Update machine cpu and platform symlinks if something which affects
# them changed.
include/asm-xtensa/.platform: $(wildcard include/config/arch/*.h)
@echo ' Setting up cpu ($(CPU)) and platform ($(PLATFORM)) symlinks'
$(Q)rm -f include/asm-xtensa/platform
$(Q)rm -f include/asm-xtensa/xtensa/config
$(Q)(cd include/asm-xtensa/; ln -sf platform-$(PLATFORM) platform)
$(Q)(cd include/asm-xtensa/xtensa; ln -sf config-$(CPU) config)
$(archinc)/.platform: $(wildcard include/config/arch/*.h) include/config/MARKER
@echo ' SYMLINK $(archinc)/xtensa/config -> $(archinc)/xtensa/config-$(CPU)'
$(Q)mkdir -p $(archinc)
$(Q)mkdir -p $(archinc)/xtensa
$(Q)ln -fsn $(srctree)/$(archinc)/xtensa/config-$(CPU) $(archinc)/xtensa/config
@echo ' SYMLINK $(archinc)/platform -> $(archinc)/platform-$(PLATFORM)'
$(Q)ln -fsn $(srctree)/$(archinc)/platform-$(PLATFORM) $(archinc)/platform
@touch $@
all: zImage
......@@ -94,7 +94,9 @@ bzImage : zImage
zImage zImage.initrd: vmlinux
$(Q)$(MAKE) $(build)=$(boot) $@
CLEAN_FILES += arch/xtensa/vmlinux.lds include/asm-xtensa/offset.h
CLEAN_FILES += arch/xtensa/vmlinux.lds $(archinc)/offset.h \
$(archinc)/platform $(archinc)/xtensa/config \
$(archinc)/.platform
define archhelp
@echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
......
......@@ -11,21 +11,19 @@
CFLAGS += -fno-builtin -Iarch/$(ARCH)/boot/include
HOSTFLAGS += -Iarch/$(ARCH)/boot/include
BIG_ENDIAN := $(shell echo -e "\#ifdef __XTENSA_EL__\nint little;\n\#else\nint big;\n\#endif" | $(CC) -E -|grep -c big)
BIG_ENDIAN := $(shell echo -e __XTENSA_EB__ | $(CC) -E - | grep -v "\#")
export CFLAGS
export AFLAGS
export BIG_ENDIAN
subdir-y := lib
# Subdirs for the boot loader(s)
bootdir-$(CONFIG_XTENSA_PLATFORM_ISS) += boot-elf
bootdir-$(CONFIG_XTENSA_PLATFORM_XT2000) += boot-redboot boot-elf
subdir-y := lib/
subdir-y += boot-elf/ boot-redboot/
zImage zImage.initrd Image Image.initrd: $(bootdir-y)
......@@ -33,5 +31,3 @@ $(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \
$(addprefix $(obj)/,$(host-progs))
$(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS)
......@@ -27,7 +27,7 @@ Image: vmlinux $(OBJS)
--set-section-flags image=contents,alloc,load,load,data \
$(OBJS) $@.tmp
$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
-T arch/$(ARCH)/boot/boot-elf/boot.ld \
-T $(srctree)/arch/$(ARCH)/boot/boot-elf/boot.ld \
-o arch/$(ARCH)/boot/$@.elf $@.tmp
rm -f $@.tmp vmlinux.tmp
......@@ -41,7 +41,7 @@ Image.initrd: vmlinux $(OBJS)
--set-section-flags image=contents,alloc,load,load,data \
$(OBJS) $@.tmp
$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
-T arch/$(ARCH)/boot/boot-elf/boot.ld \
-T $(srctree)/arch/$(ARCH)/boot/boot-elf/boot.ld \
-o arch/$(ARCH)/boot/$@.elf $@.tmp
rm -f $@.tmp vmlinux.tmp
......
......@@ -12,24 +12,24 @@ else
OBJCOPY_ARGS := -O elf32-xtensa-le
endif
LD_ARGS = -T $(obj)/boot.ld
LD_ARGS = -T $(srctree)/$(obj)/boot.ld
boot-y := bootstrap.o
OBJS := $(addprefix $(obj)/,$(boot-y))
LIBS := arch/$(ARCH)/boot/lib/lib.a arch/$(ARCH)/lib/lib.a
LIBS := arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a
LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
zImage: vmlinux $(OBJS) $(LIBS)
$(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \
$(TOPDIR)/vmlinux vmlinux.tmp
vmlinux vmlinux.tmp
gzip -vf9 vmlinux.tmp
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
--add-section image=vmlinux.tmp.gz \
--set-section-flags image=contents,alloc,load,load,data \
$(OBJS) $@.tmp
$(LD) $(LD_ARGS) -o $@.elf $@.tmp $(LIBS) -L/xtensa-elf/lib $(LIBGCC)
$(OBJCOPY) -S -O binary $@.elf arch/$(ARCH)/boot/images/$@.redboot
# rm -f $@.tmp $@.elf vmlinux.tmp.gz
$(OBJCOPY) -S -O binary $@.elf arch/$(ARCH)/boot/$@.redboot
rm -f $@.tmp $@.elf vmlinux.tmp.gz
This diff is collapsed.
......@@ -2,5 +2,16 @@
# Makefile for some libs needed by zImage.
#
zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c
lib-y := zlib.o zmem.o
lib-y += $(zlib:.c=.o) zmem.o
EXTRA_CFLAGS += -Ilib/zlib_inflate
quiet_cmd_copy_zlib = COPY $@
cmd_copy_zlib = cat $< > $@
$(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
$(call cmd,copy_zlib)
clean-files := $(zlib)
/*
* arch/xtensa/lib/memcpy.S
*
* ANSI C standard library function memcpy
*
* This file is subject to the terms and conditions of the GNU General
* Public License. See the file "COPYING" in the main directory of
* this archive for more details.
*
* Copyright (C) 2002 Tensilica Inc.
*/
#define _ASMLANGUAGE
#include <xtensa/config/core.h>
.text
.align 4
.global bcopy
.type bcopy,@function
bcopy:
movi a14, xthal_bcopy // a14 safe to use regardless of whether caller
// used call4 or call8 (can't have used call12)
jx a14 // let the Core HAL do the work
.text
.align 4
.global memcpy
.type memcpy,@function
memcpy:
.global memmove
.type memmove,@function
memmove:
movi a14, xthal_memcpy // a14 safe to use regardless of whether caller
// used call4 or call8 (can't have used call12)
jx a14 // let the Core HAL do the work
This diff is collapsed.
#include "zlib.h"
#include <linux/zlib.h>
/* bits taken from ppc */
......@@ -9,11 +9,10 @@ void exit (void)
for (;;);
}
void *zalloc(void *x, unsigned items, unsigned size)
void *zalloc(unsigned size)
{
void *p = avail_ram;
size *= items;
size = (size + 7) & -8;
avail_ram += size;
if (avail_ram > end_avail) {
......@@ -24,11 +23,6 @@ void *zalloc(void *x, unsigned items, unsigned size)
return p;
}
void zfree(void *x, void *addr, unsigned nb)
{
}
#define HEAD_CRC 2
#define EXTRA_FIELD 4
#define ORIG_NAME 8
......@@ -43,7 +37,6 @@ void gunzip (void *dst, int dstlen, unsigned char *src, int *lenp)
int r, i, flags;
/* skip header */
i = 10;
flags = src[3];
if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
......@@ -65,9 +58,8 @@ void gunzip (void *dst, int dstlen, unsigned char *src, int *lenp)
exit();
}
s.zalloc = zalloc;
s.zfree = zfree;
r = inflateInit2(&s, -MAX_WBITS);
s.workspace = zalloc(zlib_inflate_workspacesize());
r = zlib_inflateInit2(&s, -MAX_WBITS);
if (r != Z_OK) {
//puts("inflateInit2 returned "); puthex(r); puts("\n");
exit();
......@@ -76,12 +68,12 @@ void gunzip (void *dst, int dstlen, unsigned char *src, int *lenp)
s.avail_in = *lenp - i;
s.next_out = dst;
s.avail_out = dstlen;
r = inflate(&s, Z_FINISH);
r = zlib_inflate(&s, Z_FINISH);
if (r != Z_OK && r != Z_STREAM_END) {
//puts("inflate returned "); puthex(r); puts("\n");
exit();
}
*lenp = s.next_out - (unsigned char *) dst;
inflateEnd(&s);
zlib_inflateEnd(&s);
}
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