[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] [PATCH] Make genmagic compile for CF v4e when compiling under this CPU



genmagic is a binary, compiled during kernel compilation, that
generates the magic.i header file. genmagic is compiled by default for
68000 CPU. When compiling the kernel with a ColdFire CPU the
compilation fails with an "Illegal Instruction" while running
genmagic. This patch adds a test in genmagic's Makefile for the
ColdFIre v4e CPU and sets the CPU variable accordingly

This is the best solution I've come up with, please if someone thinks
in a better way to solve this share it here, thanks.

Commit message:

Make genmagic compile for CodFire v4e CPU when kernel compilation is
done in this processor.
diff -r ba1ec1958047 sys/arch/magic/Makefile
--- a/sys/arch/magic/Makefile	Mon Oct 05 10:40:10 2015 +0200
+++ b/sys/arch/magic/Makefile	Tue Dec 15 09:15:51 2015 +0100
@@ -26,7 +26,17 @@
 # default definitions
 OBJS = $(COBJS:%.c=%.o) $(SOBJS:%.s=%.o) $(SPPOBJS:%.spp=%.o)
 GENFILES = $(TARGET) magic.i
+COLDFIRE := $(shell grep -q V4e /kern/cpuinfo; \
+					status=$$?; \
+					if [ $$status = 0 ]; \
+					then echo 1; \
+					else echo 0; \
+					fi)
+ifeq ($(COLDFIRE),1)
+CPU = v4e
+else
 CPU = 000
+endif
 
 
 $(TARGET): $(OBJS) $(LIBKERNSTMP)