cris: Add CRISv32 support
Subsystems (3)
PATCH 1/1 cris: Add CRISv32 support
Hello,
I hope this is the correct list to which to send these patches. Comments are very welcome.
Thanks,
Edgar
From: Edgar E. Iglesias <[email protected]>
Add a CRISv32 port. Initially only the elf filetype is supported.
config/config.sub +1 -1
@@ -457,7 +457,7 @@ case $basic_machine in crds | unos) basic_machine=m68k-crds ;; - cris | cris-* | etrax*) + cris | cris-* | etrax* | crisv32 | crisv32-* | etraxfs*) basic_machine=cris-axis ;; crx)
configure.ac +3 -0
@@ -41,6 +41,9 @@ case $target_cpu in mips|mipsel ) ARCH="mips" ;; + crisv32 ) + ARCH="cris" + ;; ia64|x86_64|alpha ) ARCH="$target_cpu" ;;
kexec/Makefile +1 -0
@@ -48,6 +48,7 @@ include $(srcdir)/kexec/arch/arm/Makefile include $(srcdir)/kexec/arch/i386/Makefile include $(srcdir)/kexec/arch/ia64/Makefile include $(srcdir)/kexec/arch/mips/Makefile +include $(srcdir)/kexec/arch/cris/Makefile include $(srcdir)/kexec/arch/ppc/Makefile include $(srcdir)/kexec/arch/ppc64/Makefile include $(srcdir)/kexec/arch/s390/Makefile
kexec/arch/cris/Makefile new file +13 -0
@@ -0,0 +1,13 @@ +cris_KEXEC_SRCS = kexec/arch/cris/kexec-cris.c +cris_KEXEC_SRCS += kexec/arch/cris/kexec-elf-cris.c +cris_KEXEC_SRCS += kexec/arch/cris/cris-setup-simple.S +cris_KEXEC_SRCS += kexec/arch/cris/kexec-elf-rel-cris.c + +cris_ADD_BUFFER = +cris_ADD_SEGMENT = +cris_VIRT_TO_PHYS = + +dist += kexec/arch/cris/Makefile $(cris_KEXEC_SRCS) \ + kexec/arch/cris/kexec-criss.h \ + kexec/arch/cris/include/arch/options.h +
kexec/arch/cris/cris-setup-simple.S new file +31 -0
@@ -0,0 +1,31 @@ +/* + * cris-setup-simple.S - code to execute before stepping into the new kernel. + * Copyright (C) 2008 AXIS Communications AB + * Written by Edgar E. Iglesias + * + * This source code is licensed under the GNU General Public License, + * Version 2. See the file COPYING for more details. + */ + + .data + .globl cris_trampoline +cris_trampoline: + .balign 4 + lapc cris_regframe, $sp + moveq 0, $r0 + move $r0, $pid + + movem [$sp+], $r14 + jump $r0 + nop + + .globl cris_regframe +cris_regframe: + .balign 4 + .fill 16, 4, 0 +cris_trampoline_end: + + .globl cris_trampoline_size +cris_trampoline_size: + .long cris_trampoline_end - cris_trampoline +
kexec/arch/cris/include/arch/options.h new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef KEXEC_ARCH_MIPS_OPTIONS_H +#define KEXEC_ARCH_MIPS_OPTIONS_H + +#define OPT_ARCH_MAX (OPT_MAX+0) + +#define KEXEC_ARCH_OPTIONS \ + KEXEC_OPTIONS \ + +#define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR "" + +#endif /* KEXEC_ARCH_MIPS_OPTIONS_H */
kexec/arch/cris/kexec-cris.c new file +121 -0
121 lines not on this page · raw message
kexec/arch/cris/kexec-cris.h new file +17 -0
@@ -0,0 +1,17 @@ +#ifndef KEXEC_CRIS_H +#define KEXEC_CRIS_H + +extern unsigned char setup_simple_start[]; +extern uint32_t setup_simple_size; + +extern struct { +uint32_t spr8; +uint32_t spr9; +} setup_simple_regs; + +int elf_cris_probe (const char *buf,off_t len); +int elf_cris_load (int argc,char **argv,const char *buf,off_t len, +struct kexec_info *info); +void elf_cris_usage (void ); + +#endif /* KEXEC_CRIS_H */
kexec/arch/cris/kexec-elf-cris.c new file +136 -0
136 lines not on this page · raw message
kexec/arch/cris/kexec-elf-rel-cris.c new file +42 -0
42 lines not on this page · raw message
kexec/kexec-syscall.h +1 -0
@@ -87,6 +87,7 @@ static inline long kexec_reboot(void)#define KEXEC_ARCH_SH (42 << 16)#define KEXEC_ARCH_MIPS_LE (10 << 16)#define KEXEC_ARCH_MIPS ( 8 << 16) +#define KEXEC_ARCH_CRIS (76 << 16)#define KEXEC_MAX_SEGMENTS 16
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 4 lines · Edgar E. Iglesias
Hello,
I hope this is the correct list to which to send these patches. Comments are very welcome.
Hi Edgar,
this is the right place. And this patch looks pretty reasonable to me.
I am wondering if you can give any advise on setting up a crosscompiler so that I can compile this code on an x86_32 box.
Thanks.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 6 lines · Simon Horman
Quoted 4 lines · Edgar E. Iglesias
Hello,
I hope this is the correct list to which to send these patches. Comments are very welcome.
Quoted 6 lines
Hi Edgar,
this is the right place. And this patch looks pretty reasonable to me.
I am wondering if you can give any advise on setting up a crosscompiler so that I can compile this code on an
x86_32box.
Hi Simon,
For the compiler tools there are basically two alternatives:
1. The hard way is to check out binutils + gcc from the FSF svn and build them for the crisv32-axis-linux-gnu target. The GCC port for crisv32 was committed to the svn trunk fairly recently so I'm guessing you'll have to use the trunk.
I don't think the CRISv32 port of glibc is committed upstream yet so you'll have to get that from our site. See below.
2. The recommended and easier way is to get one of the toolschains distributed with the ETRAX/CRIS sdk. Those can be found here:
ftp://ftp.axis.se/pub/axis/tools/cris/compiler-kit/
----
Once you've got the toolchain installed and assuming you've got them in your PATH It should be enough to build the kexec-tools like this:
$ cd /my-kexec-tools-build $ CC=crisv32-axis-linux-gnu-gcc /my-kexec-tools-src/configure --host=crisv32-axis-linux-gnu $ make
When trying this I noticed two issues with the released 3.2.1 toolchain:
1. The released crisv32 gcc port does not support the -fno-zero-initialized-in-bss flag so that has to be commented out from the Makefiles.
purgatory/Makefile +2 -2
@@ -46,8 +46,8 @@ purgatory/sha256.o: $(srcdir)/util_lib/sha256.c $(PURGATORY): CC=$(TARGET_CC) $(PURGATORY): CFLAGS+=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \ - -Os -fno-builtin -ffreestanding \ - -fno-zero-initialized-in-bss + -Os -fno-builtin -ffreestanding +# -fno-zero-initialized-in-bss $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \ -I$(srcdir)/purgatory/include \
2. The released toolchain had an old list of syscalls (kexec_load was missing) so I had to add a fallback definition:
kexec/kexec-syscall.h +5 -0
@@ -28,6 +28,11 @@#ifdef __sh__#define __NR_kexec_load 283#endif +#ifdef __cris__ +#ifndef __NR_kexec_load +#define __NR_kexec_load 283 +#endif +#endif #ifdef __ia64__#define __NR_kexec_load 1268#endif
I'm posting an updated kexec-tools CRIS port patch with this latter change included.
If you (or anyone else) would be interested in testing, I'd recommend to use qemu. You'll find a bit of info here:
ftp://ftp.axis.se/pub/users/edgar/qemu-etrax/
The kernel image you'll find there has kexec support. I've also added a vmlinux ELF image to test with. The easiest way would be to boot up the kernel on qemu, then ftp upload the vmlinux image and your test kexec tools onto the guest's /tmp/ and run from there.
Let me know if there is something else I can help with.
Best regards
--
From: Edgar E. Iglesias <[email protected]>
Add a CRISv32 port. For now, only the elf filetype is supported.
config/config.sub +1 -1
@@ -457,7 +457,7 @@ case $basic_machine in crds | unos) basic_machine=m68k-crds ;; - cris | cris-* | etrax*) + cris | cris-* | etrax* | crisv32 | crisv32-* | etraxfs*) basic_machine=cris-axis ;; crx)
configure.ac +3 -0
@@ -41,6 +41,9 @@ case $target_cpu in mips|mipsel ) ARCH="mips" ;; + crisv32 ) + ARCH="cris" + ;; ia64|x86_64|alpha ) ARCH="$target_cpu" ;;
kexec/Makefile +1 -0
@@ -48,6 +48,7 @@ include $(srcdir)/kexec/arch/arm/Makefile include $(srcdir)/kexec/arch/i386/Makefile include $(srcdir)/kexec/arch/ia64/Makefile include $(srcdir)/kexec/arch/mips/Makefile +include $(srcdir)/kexec/arch/cris/Makefile include $(srcdir)/kexec/arch/ppc/Makefile include $(srcdir)/kexec/arch/ppc64/Makefile include $(srcdir)/kexec/arch/s390/Makefile
kexec/arch/cris/Makefile new file +13 -0
@@ -0,0 +1,13 @@ +cris_KEXEC_SRCS = kexec/arch/cris/kexec-cris.c +cris_KEXEC_SRCS += kexec/arch/cris/kexec-elf-cris.c +cris_KEXEC_SRCS += kexec/arch/cris/cris-setup-simple.S +cris_KEXEC_SRCS += kexec/arch/cris/kexec-elf-rel-cris.c + +cris_ADD_BUFFER = +cris_ADD_SEGMENT = +cris_VIRT_TO_PHYS = + +dist += kexec/arch/cris/Makefile $(cris_KEXEC_SRCS) \ + kexec/arch/cris/kexec-criss.h \ + kexec/arch/cris/include/arch/options.h +
kexec/arch/cris/cris-setup-simple.S new file +31 -0
@@ -0,0 +1,31 @@ +/* + * cris-setup-simple.S - code to execute before stepping into the new kernel. + * Copyright (C) 2008 AXIS Communications AB + * Written by Edgar E. Iglesias + * + * This source code is licensed under the GNU General Public License, + * Version 2. See the file COPYING for more details. + */ + + .data + .globl cris_trampoline +cris_trampoline: + .balign 4 + lapc cris_regframe, $sp + moveq 0, $r0 + move $r0, $pid + + movem [$sp+], $r14 + jump $r0 + nop + + .globl cris_regframe +cris_regframe: + .balign 4 + .fill 16, 4, 0 +cris_trampoline_end: + + .globl cris_trampoline_size +cris_trampoline_size: + .long cris_trampoline_end - cris_trampoline +
kexec/arch/cris/include/arch/options.h new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef KEXEC_ARCH_MIPS_OPTIONS_H +#define KEXEC_ARCH_MIPS_OPTIONS_H + +#define OPT_ARCH_MAX (OPT_MAX+0) + +#define KEXEC_ARCH_OPTIONS \ + KEXEC_OPTIONS \ + +#define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR "" + +#endif /* KEXEC_ARCH_MIPS_OPTIONS_H */
kexec/arch/cris/kexec-cris.c new file +121 -0
121 lines not on this page · raw message
kexec/arch/cris/kexec-cris.h new file +17 -0
@@ -0,0 +1,17 @@ +#ifndef KEXEC_CRIS_H +#define KEXEC_CRIS_H + +extern unsigned char setup_simple_start[]; +extern uint32_t setup_simple_size; + +extern struct { +uint32_t spr8; +uint32_t spr9; +} setup_simple_regs; + +int elf_cris_probe (const char *buf,off_t len); +int elf_cris_load (int argc,char **argv,const char *buf,off_t len, +struct kexec_info *info); +void elf_cris_usage (void ); + +#endif /* KEXEC_CRIS_H */
kexec/arch/cris/kexec-elf-cris.c new file +136 -0
136 lines not on this page · raw message
kexec/arch/cris/kexec-elf-rel-cris.c new file +42 -0
42 lines not on this page · raw message
kexec/kexec-syscall.h +6 -0
@@ -28,6 +28,11 @@#ifdef __sh__#define __NR_kexec_load 283#endif +#ifdef __cris__ +#ifndef __NR_kexec_load +#define __NR_kexec_load 283 +#endif +#endif #ifdef __ia64__#define __NR_kexec_load 1268#endif
@@ -87,6 +92,7 @@ static inline long kexec_reboot(void)#define KEXEC_ARCH_SH (42 << 16)#define KEXEC_ARCH_MIPS_LE (10 << 16)#define KEXEC_ARCH_MIPS ( 8 << 16) +#define KEXEC_ARCH_CRIS (76 << 16)#define KEXEC_MAX_SEGMENTS 16
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 18 lines · Edgar E. Iglesias
Quoted 6 lines · Simon Horman
Quoted 4 lines · Edgar E. Iglesias
Hello,
I hope this is the correct list to which to send these patches. Comments are very welcome.
Quoted 6 lines
Hi Edgar,
this is the right place. And this patch looks pretty reasonable to me.
I am wondering if you can give any advise on setting up a crosscompiler so that I can compile this code on an
x86_32box.Hi Simon,
For the compiler tools there are basically two alternatives:
Quoted 7 lines
1. The hard way is to check out binutils + gcc from the FSF svn and build them for the crisv32-axis-linux-gnu target. The GCC port for crisv32 was committed to the svn trunk fairly recently so I'm guessing you'll have to use the trunk.
I don't think the CRISv32 port of glibc is committed upstream yet so you'll have to get that from our site. See below.
2. The recommended and easier way is to get one of the toolschains distributed with the ETRAX/CRIS sdk. Those can be found here:
ftp://ftp.axis.se/pub/axis/tools/cris/compiler-kit/
Hi Edgar,
sorry for taking a while to get to this.
I'm happy to report that the debian package, cris-dist_1.64-1_i386.deb, at the link above works just fine for me and I have been able to confirm that your code compiles. I have gone ahead
and merged it into the kexec-tools git tree and CRISv32 support should appear in the next release, likely 2.0.1.
http://git.kernel.org/?p=linux/kernel/git/horms/kexec-tools.git;a=summary
I have added a few other minor patches, mainly based on your suggestions below. I will post those patches shortly for the record.
Quoted 57 lines
----
Once you've got the toolchain installed and assuming you've got them in your PATH It should be enough to build the kexec-tools like this:
$ cd /my-kexec-tools-build $ CC=crisv32-axis-linux-gnu-gcc /my-kexec-tools-src/configure --host=crisv32-axis-linux-gnu $ makeWhen trying this I noticed two issues with the released 3.2.1 toolchain:
1. The released crisv32 gcc port does not support the -fno-zero-initialized-in-bss flag so that has to be commented out from the Makefiles.purgatory/Makefile +2
-2@@ -46,8 +46,8 @@ purgatory/sha256.o: $(srcdir)/util_lib/sha256.c $(PURGATORY): CC=$(TARGET_CC) $(PURGATORY): CFLAGS+=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \ - -Os -fno-builtin -ffreestanding \ - -fno-zero-initialized-in-bss + -Os -fno-builtin -ffreestanding +# -fno-zero-initialized-in-bss $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \ -I$(srcdir)/purgatory/include \2. The released toolchain had an old list of syscalls (
kexec_loadwas missing) so I had to add a fallback definition:kexec/kexec-syscall.h +5
-0@@ -28,6 +28,11 @@#ifdef __sh__#define __NR_kexec_load 283#endif +#ifdef __cris__ +#ifndef __NR_kexec_load +#define __NR_kexec_load 283 +#endif +#endif #ifdef __ia64__#define __NR_kexec_load 1268#endif I'm posting an updated kexec-tools CRIS port patch with this latter change included.
If you (or anyone else) would be interested in testing, I'd recommend to use qemu. You'll find a bit of info here:
ftp://ftp.axis.se/pub/users/edgar/qemu-etrax/The kernel image you'll find there has kexec support. I've also added a vmlinux ELF image to test with. The easiest way would be to boot up the kernel on qemu, then ftp upload the vmlinux image and your test kexec tools onto the guest's
/tmp/and run from there.Let me know if there is something else I can help with.
Best regards
Signature · 9 lines
Simon Horman VA Linux Systems Japan K.K., Sydney, Australia Satellite Office H: www.vergenet.net/~horms/ W: www.valinux.co.jp/en _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Simon Horman
AppliedPATCH 1/1 Only use -fno-zero-initialized-in-bss if it is available
As pointed out by Edgar E. Iglesias, the -fno-zero-initialized-in-bss option to gcc is not available in the cris 3.2.1 toolchain.
--- Makefile.in | 1 + configure.ac | 14 ++++++++++++++ purgatory/Makefile | 6 +++--- 3 files changed, 18 insertions(+), 3 deletions(-)
I have applied this patch to the kexec-tools git tree.
Makefile.in +1 -0
@@ -46,6 +46,7 @@ TARGET_CFLAGS = @TARGET_CFLAGS@ CPPFLAGS = @CPPFLAGS@ -I$(srcdir)/include -I$(srcdir)/util_lib/include \ -Iinclude/ CFLAGS = @CFLAGS@ -fno-strict-aliasing -Wall -Wstrict-prototypes +PURGATORY_EXTRA_CFLAGS = @PURGATORY_EXTRA_CFLAGS@ ASFLAGS = @ASFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@
configure.ac +14 -0
@@ -7,6 +7,7 @@ dnl ---Required AC_INIT(kexec-tools, 2.0.0-git) AC_CONFIG_AUX_DIR(./config) AC_CONFIG_HEADERS([include/config.h]) +AC_LANG(C) AC_DEFINE_UNQUOTED(PACKAGE_DATE, "19th July 2008", [Define to the release date of this package])
@@ -105,6 +106,19 @@ else TARGET_LD="$LD" fi +AC_MSG_CHECKING([whether $TARGET_CC accepts -fno-zero-initialized-in-bss]) +saved_CFLAGS="$CFLAGS" +saved_CC="$CC" +CC="$TARGET_CC" +CFLAGS="$CFLAGS -fno-zero-initialized-in-bss" +AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,,)], + PURGATORY_EXTRA_CFLAGS="-fno-zero-initialized-in-bss" + AC_MSG_RESULT([Yes]), AC_MSG_RESULT([No])) +CFLAGS="$saved_CFLAGS" +CC="$saved_CC" + +AC_SUBST(PURGATORY_EXTRA_CFLAGS, [$PURGATORY_EXTRA_CFLAGS]) + dnl Find the helper functions AC_PROG_INSTALL AC_CHECK_PROG([MKDIR], mkdir, mkdir, "no", [$PATH])
purgatory/Makefile +3 -3
@@ -45,9 +45,9 @@ purgatory/sha256.o: $(srcdir)/util_lib/sha256.c $(COMPILE.c) -o $@ $^ $(PURGATORY): CC=$(TARGET_CC) -$(PURGATORY): CFLAGS+=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \ - -Os -fno-builtin -ffreestanding \ - -fno-zero-initialized-in-bss +$(PURGATORY): CFLAGS+=$(PURGATORY_EXTRA_CFLAGS) \ + $($(ARCH)_PURGATORY_EXTRA_CFLAGS) \ + -Os -fno-builtin -ffreestanding $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \ -I$(srcdir)/purgatory/include \
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Simon Horman
AppliedPATCH 1/1 cris: add kexc_load syscall
In reply to Simon HormanFrom: Edgar E. Iglesias <[email protected]>
The released toolchain had an old list of syscalls (kexec_load was missing) so I had to add a fallback definition:
--- kexec/kexec-syscall.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
I have applied this patch to the kexec-tools git tree.
kexec/kexec-syscall.h +5 -0
@@ -28,6 +28,11 @@#ifdef __sh__#define __NR_kexec_load 283#endif +#ifdef __cris__ +#ifndef __NR_kexec_load +#define __NR_kexec_load 283 +#endif +#endif #ifdef __ia64__#define __NR_kexec_load 1268#endif
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH 1/1 cris: add cris architecture to configure
In reply to Simon Horman# PATH=$PATH:/usr/local/cris/bin/ CC=crisv32-axis-linux-gnu-gcc \ ./configure --host=crisv32-axis-linux-gnu
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
checking build system type... i686-pc-linux-gnu
checking host system type... cris-axis-linux-gnu
checking target system type... cris-axis-linux-gnu
configure: error: unsupported architecture cris
--- configure.ac | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
I have added this patch to the kexec-tools git tree.
configure.ac +1 -1
@@ -42,7 +42,7 @@ case $target_cpu in mips|mipsel ) ARCH="mips" ;; - crisv32 ) + cris|crisv32 ) ARCH="cris" ;; ia64|x86_64|alpha )
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec