Commit 1ebb6a21 authored by Anton Blanchard's avatar Anton Blanchard

ppc64: update to match recent kbuild changes

parent a56c861d
...@@ -29,10 +29,10 @@ HEAD := arch/ppc64/kernel/head.o ...@@ -29,10 +29,10 @@ HEAD := arch/ppc64/kernel/head.o
core-y += arch/ppc64/kernel/ arch/ppc64/mm/ arch/ppc64/lib/ core-y += arch/ppc64/kernel/ arch/ppc64/mm/ arch/ppc64/lib/
core-$(CONFIG_XMON) += arch/ppc64/xmon/ core-$(CONFIG_XMON) += arch/ppc64/xmon/
MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot makeboot = $(call descend,arch/ppc64/boot,$(1))
ifdef CONFIG_PPC_PSERIES ifdef CONFIG_PPC_PSERIES
BOOT_TARGETS = zImage znetboot.initrd zImage.initrd BOOT_TARGETS = zImage zImage.initrd
endif endif
ifdef CONFIG_PPC_ISERIES ifdef CONFIG_PPC_ISERIES
...@@ -40,22 +40,14 @@ BOOT_TARGETS = vmlinux.sminitrd vmlinux.initrd vmlinux.sm ...@@ -40,22 +40,14 @@ BOOT_TARGETS = vmlinux.sminitrd vmlinux.initrd vmlinux.sm
endif endif
$(BOOT_TARGETS): vmlinux $(BOOT_TARGETS): vmlinux
@$(MAKEBOOT) $@ @$(call makeboot,arch/ppc64/boot/$@)
znetboot: vmlinux
ifdef CONFIG_SMP
cp -f vmlinux /tftpboot/vmlinux.smp
else
cp -f vmlinux /tftpboot/vmlinux
endif
@$(MAKEBOOT) $@
%_config: arch/ppc64/configs/%_defconfig %_config: arch/ppc64/configs/%_defconfig
rm -f .config arch/ppc64/defconfig rm -f .config arch/ppc64/defconfig
cp -f arch/ppc64/configs/$(@:config=defconfig) arch/ppc64/defconfig cp -f arch/ppc64/configs/$(@:config=defconfig) arch/ppc64/defconfig
archclean: archclean:
@$(MAKEBOOT) clean @$(call makeboot,clean)
archmrproper: archmrproper:
...@@ -74,3 +66,4 @@ include/asm-$(ARCH)/offsets.h: include/asm-$(ARCH)/offsets.h.tmp ...@@ -74,3 +66,4 @@ include/asm-$(ARCH)/offsets.h: include/asm-$(ARCH)/offsets.h.tmp
CLEAN_FILES += include/asm-$(ARCH)/offsets.h.tmp \ CLEAN_FILES += include/asm-$(ARCH)/offsets.h.tmp \
include/asm-$(ARCH)/offsets.h include/asm-$(ARCH)/offsets.h
...@@ -38,85 +38,64 @@ CFLAGS = $(CPPFLAGS) -O -fno-builtin -DSTDC_HEADERS ...@@ -38,85 +38,64 @@ CFLAGS = $(CPPFLAGS) -O -fno-builtin -DSTDC_HEADERS
LD_ARGS = -Ttext 0x00400000 -e _start LD_ARGS = -Ttext 0x00400000 -e _start
OBJCOPYFLAGS := -S -O binary OBJCOPYFLAGS := -S -O binary
OBJS = crt0.o start.o main.o zlib.o image.o imagesize.o OBJS = $(addprefix $(obj)/,crt0.o start.o main.o zlib.o image.o imagesize.o)
#LIBS = $(TOPDIR)/lib/lib.a
LIBS =
ifeq ($(CONFIG_SMP),y)
TFTPIMAGE=/tftpboot/zImage.chrp.smp
else
TFTPIMAGE=/tftpboot/zImage.chrp
endif
ifeq ($(CONFIG_PPC_ISERIES),y)
all: vmlinux.sm
else
all: $(TOPDIR)/zImage
endif
znetboot: zImage
cp zImage $(TFTPIMAGE)
ifeq ($(CONFIG_PPC_ISERIES),y) ifeq ($(CONFIG_PPC_ISERIES),y)
addSystemMap: addSystemMap.c boot: vmlinux.sm
$(HOSTCC) $(HOSTCFLAGS) -o addSystemMap addSystemMap.c
vmlinux.sm: $(TOPDIR)/vmlinux addSystemMap $(obj)/addSystemMap: $(obj)/addSystemMap.c
./addSystemMap $(TOPDIR)/System.map $(TOPDIR)/vmlinux vmlinux.sm $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
$(obj)/vmlinux.sm: vmlinux $(obj)/addSystemMap
$(obj)/addSystemMap System.map vmlinux $(obj)/vmlinux.sm
addRamDisk: addRamDisk.c $(obj)/addRamDisk: $(obj)/addRamDisk.c
$(HOSTCC) $(HOSTCFLAGS) -o addRamDisk addRamDisk.c $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
vmlinux.initrd: $(TOPDIR)/vmlinux addRamDisk ramdisk.image.gz $(TOPDIR)/System.map $(obj)/vmlinux.initrd: vmlinux $(obj)/addRamDisk $(obj)/ramdisk.image.gz System.map
./addRamDisk ramdisk.image.gz $(TOPDIR)/System.map $(TOPDIR)/vmlinux vmlinux.initrd $(obj)/addRamDisk $(obj)/ramdisk.image.gz System.map vmlinux $(obj)/vmlinux.initrd
vmlinux.sminitrd: vmlinux.sm addRamDisk ramdisk.image.gz $(TOPDIR)/System.map $(obj)/vmlinux.sminitrd: $(obj)/vmlinux.sm $(obj)/addRamDisk $(obj)/ramdisk.image.gz System.map
./addRamDisk ramdisk.image.gz $(TOPDIR)/System.map vmlinux.sm vmlinux.sminitrd $(obj)/addRamDisk $(obj)/ramdisk.image.gz System.map $(obj)/vmlinux.sm $(obj)/vmlinux.sminitrd
else
boot: zImage
endif endif
$(obj)/piggyback: $(obj)/piggyback.c
$(HOSTCC) $(HOSTCFLAGS) -DKERNELBASE=$(KERNELBASE) -o $@ $<
znetboot.initrd: zImage.initrd $(obj)/addnote: $(obj)/addnote.c
cp zImage.initrd $(TFTPIMAGE) $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
floppy: zImage $(obj)/image.o: $(obj)/piggyback $(obj)/vmlinux.gz
mcopy zImage a:zImage $(obj)/piggyback $(obj)/image < $(obj)/vmlinux.gz | $(BOOTAS) -o $@
piggyback: piggyback.c $(obj)/sysmap.o: $(obj)/piggyback System.map
$(HOSTCC) $(HOSTCFLAGS) -DKERNELBASE=$(KERNELBASE) -o piggyback piggyback.c $(obj)/piggyback $(obj)/sysmap < System.map | $(BOOTAS) -o $(obj)/sysmap.o
addnote: addnote.c $(obj)/initrd.o: $(obj)/ramdisk.image.gz $(obj)/piggyback
$(HOSTCC) $(HOSTCFLAGS) -o addnote addnote.c $(obj)/piggyback $(obj)/initrd < $(obj)/ramdisk.image.gz | $(BOOTAS) -o $(obj)/initrd.o
image.o: piggyback vmlinux.gz $(obj)/zImage: $(OBJS) $(obj)/no_initrd.o $(obj)/addnote
./piggyback image < vmlinux.gz | $(BOOTAS) -o image.o $(BOOTLD) $(LD_ARGS) -T $(obj)/zImage.lds -o $@ $(OBJS) $(obj)/no_initrd.o
$(obj)/addnote $@
sysmap.o: piggyback ../../../System.map
./piggyback sysmap < ../../../System.map | $(BOOTAS) -o sysmap.o
initrd.o: ramdisk.image.gz piggyback
./piggyback initrd < ramdisk.image.gz | $(BOOTAS) -o initrd.o
zImage: $(OBJS) no_initrd.o addnote
$(BOOTLD) $(LD_ARGS) -T zImage.lds -o $@ $(OBJS) no_initrd.o $(LIBS)
./addnote $@
zImage.initrd: $(OBJS) initrd.o addnote $(obj)/zImage.initrd: $(OBJS) $(obj)/initrd.o $(obj)/addnote
$(BOOTLD) $(LD_ARGS) -T zImage.lds -o $@ $(OBJS) initrd.o $(LIBS) $(BOOTLD) $(LD_ARGS) -T $(obj)/zImage.lds -o $@ $(OBJS) $(obj)/initrd.o
./addnote $@ ./addnote $@
vmlinux.gz: $(TOPDIR)/vmlinux $(obj)/vmlinux.gz: vmlinux
$(OBJCOPY) $(OBJCOPYFLAGS) $(TOPDIR)/vmlinux vmlinux $(OBJCOPY) $(OBJCOPYFLAGS) vmlinux $(obj)/vmlinux
ls -l vmlinux | awk '{printf "/* generated -- do not edit! */\nint uncompressed_size = %d;\n", $$5}' > imagesize.c ls -l $(obj)/vmlinux | awk '{printf "/* generated -- do not edit! */\nint uncompressed_size = %d;\n", $$5}' > $(obj)/imagesize.c
$(CROSS_COMPILE)nm -n $(TOPDIR)/vmlinux | tail -1 | awk '{printf "long vmlinux_end = 0x%s;\n", substr($$1,8)}' >> imagesize.c $(CROSS_COMPILE)nm -n vmlinux | tail -1 | awk '{printf "long vmlinux_end = 0x%s;\n", substr($$1,8)}' >> $(obj)/imagesize.c
gzip -vf9 vmlinux gzip -vf9 $(obj)/vmlinux
imagesize.c: vmlinux.gz $(obj)/imagesize.c: $(obj)/vmlinux.gz
clean: clean:
rm -f piggyback note addnote $(OBJS) zImage zImage.initrd vmlinux.gz no_initrd.o imagesize.c addSystemMap vmlinux.sm addRamDisk vmlinux.initrd vmlinux.sminitrd @rm -f $(OBJS)
@rm -f $(addprefix $(obj)/,piggyback note addnote zImage \
zImage.initrd vmlinux.gz no_initrd.o imagesize.c addSystemMap
vmlinux.sm addRamDisk vmlinux.initrd vmlinux.sminitrd)
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <string.h>
extern long ce_exec_config[]; extern long ce_exec_config[];
...@@ -17,20 +18,28 @@ int main(int argc, char *argv[]) ...@@ -17,20 +18,28 @@ int main(int argc, char *argv[])
unsigned int cksum, val; unsigned int cksum, val;
unsigned char *lp; unsigned char *lp;
unsigned char buf[8192]; unsigned char buf[8192];
char *varname;
if (argc != 2) if (argc != 2)
{ {
fprintf(stderr, "usage: %s name <in-file >out-file\n", fprintf(stderr, "usage: %s name <in-file >out-file\n",
argv[0]); argv[0]);
exit(1); exit(1);
} }
varname = strrchr(argv[1], '/');
if (varname)
varname++;
else
varname = argv[1];
fprintf(stdout, "#\n"); fprintf(stdout, "#\n");
fprintf(stdout, "# Miscellaneous data structures:\n"); fprintf(stdout, "# Miscellaneous data structures:\n");
fprintf(stdout, "# WARNING - this file is automatically generated!\n"); fprintf(stdout, "# WARNING - this file is automatically generated!\n");
fprintf(stdout, "#\n"); fprintf(stdout, "#\n");
fprintf(stdout, "\n"); fprintf(stdout, "\n");
fprintf(stdout, "\t.data\n"); fprintf(stdout, "\t.data\n");
fprintf(stdout, "\t.globl %s_data\n", argv[1]); fprintf(stdout, "\t.globl %s_data\n", varname);
fprintf(stdout, "%s_data:\n", argv[1]); fprintf(stdout, "%s_data:\n", varname);
pos = 0; pos = 0;
cksum = 0; cksum = 0;
while ((len = read(0, buf, sizeof(buf))) > 0) while ((len = read(0, buf, sizeof(buf))) > 0)
...@@ -64,8 +73,8 @@ int main(int argc, char *argv[]) ...@@ -64,8 +73,8 @@ int main(int argc, char *argv[])
} }
pos += len; pos += len;
} }
fprintf(stdout, "\t.globl %s_len\n", argv[1]); fprintf(stdout, "\t.globl %s_len\n", varname);
fprintf(stdout, "%s_len:\t.long\t0x%x\n", argv[1], pos); fprintf(stdout, "%s_len:\t.long\t0x%x\n", varname, pos);
fflush(stdout); fflush(stdout);
fclose(stdout); fclose(stdout);
fprintf(stderr, "cksum = %x\n", cksum); fprintf(stderr, "cksum = %x\n", cksum);
......
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