mirror of
https://github.com/vivier/EMILE.git
synced 2024-12-22 10:29:31 +00:00
Preliminary support of multitarget architecture (m68k, ppc)
This commit is contained in:
parent
ca784197e6
commit
a59b49fa18
85
Makefile
85
Makefile
@ -23,30 +23,60 @@ BOOT_ARGS="root=/dev/sda3 $(CONSOLE)"
|
|||||||
WHO = $(shell whoami)
|
WHO = $(shell whoami)
|
||||||
WHERE = $(shell hostname)
|
WHERE = $(shell hostname)
|
||||||
WHEN = $(shell LANG=C date)
|
WHEN = $(shell LANG=C date)
|
||||||
ARCH = $(shell uname -m -o)
|
ARCH = $(shell uname -m)
|
||||||
|
OS = $(shell uname -o)
|
||||||
|
|
||||||
SIGNATURE = $(PACKAGE)-$(VERSION) $(WHO)@$(WHERE)($(ARCH)) $(WHEN)
|
SIGNATURE = $(PACKAGE)-$(VERSION) $(WHO)@$(WHERE)($(ARCH) $(OS)) $(WHEN)
|
||||||
|
|
||||||
# tools to use
|
# tools to use
|
||||||
|
|
||||||
ifneq ($(shell uname -m),m68k)
|
AS=as
|
||||||
CROSS_COMPILE = m68k-linux-
|
CC=gcc
|
||||||
|
LD=ld
|
||||||
|
OBJCOPY=objcopy
|
||||||
|
|
||||||
|
ifneq ($(ARCH),m68k)
|
||||||
|
M68K_CROSS_COMPILE = m68k-linux-
|
||||||
endif
|
endif
|
||||||
|
|
||||||
AS=$(CROSS_COMPILE)as
|
M68K_AS=$(M68K_CROSS_COMPILE)as
|
||||||
CC=$(CROSS_COMPILE)gcc
|
M68K_CC=$(M68K_CROSS_COMPILE)gcc
|
||||||
LD=$(CROSS_COMPILE)ld
|
M68K_LD=$(M68K_CROSS_COMPILE)ld
|
||||||
OBJCOPY=$(CROSS_COMPILE)objcopy
|
M68K_OBJCOPY=$(M68K_CROSS_COMPILE)objcopy
|
||||||
|
|
||||||
# identify architecture of kernel (Motorola 680x0 or PowerPC)
|
ifneq ($(ARCH),ppc)
|
||||||
|
PPC_CROSS_COMPILE = ppc-linux-
|
||||||
|
endif
|
||||||
|
|
||||||
|
PPC_AS=$(PPC_CROSS_COMPILE)as
|
||||||
|
PPC_CC=$(PPC_CROSS_COMPILE)gcc
|
||||||
|
PPC_LD=$(PPC_CROSS_COMPILE)ld
|
||||||
|
PPC_OBJCOPY=$(PPC_CROSS_COMPILE)objcopy
|
||||||
|
|
||||||
|
# Kernel architecture
|
||||||
|
|
||||||
KERNEL=vmlinux
|
KERNEL=vmlinux
|
||||||
FILE=file -bknL
|
|
||||||
|
|
||||||
all: libemile tools first/first_floppy second/second_floppy
|
FILEARCH=$(shell file -bknL $(KERNEL) | cut -d, -f 2)
|
||||||
|
ifeq ($(findstring PowerPC, $(FILEARCH)), PowerPC)
|
||||||
|
KARCH=ppc
|
||||||
|
else
|
||||||
|
ifeq ($(findstring Motorola 68, $(FILEARCH)), Motorola 68)
|
||||||
|
KARCH=m68k
|
||||||
|
else
|
||||||
|
KARCH=unknown
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
floppy.bin: libemile tools first/first_floppy vmlinuz second/second_floppy
|
# Target
|
||||||
tools/emile-install -f first/first_floppy -s second/second_floppy \
|
|
||||||
|
all: libemile tools first/first_floppy second/$(KARCH)-second_floppy \
|
||||||
|
second/$(KARCH)-second_scsi
|
||||||
|
|
||||||
|
floppy.bin: libemile tools first/first_floppy vmlinuz \
|
||||||
|
second/$(KARCH)-second_floppy
|
||||||
|
tools/emile-install -f first/first_floppy \
|
||||||
|
-s second/$(KARCH)-second_floppy \
|
||||||
-k vmlinuz floppy.bin.X
|
-k vmlinuz floppy.bin.X
|
||||||
ifdef CONSOLE
|
ifdef CONSOLE
|
||||||
tools/emile-set-output floppy.bin.X --printer --modem
|
tools/emile-set-output floppy.bin.X --printer --modem
|
||||||
@ -54,8 +84,9 @@ endif
|
|||||||
mv floppy.bin.X floppy.bin
|
mv floppy.bin.X floppy.bin
|
||||||
|
|
||||||
floppy_ramdisk.bin: libemile tools first/first_floppy vmlinuz \
|
floppy_ramdisk.bin: libemile tools first/first_floppy vmlinuz \
|
||||||
second/second_floppy ramdisk.gz
|
second/$(KARCH)-second_floppy ramdisk.gz
|
||||||
tools/emile-install -f first/first_floppy -s second/second_floppy \
|
tools/emile-install -f first/first_floppy \
|
||||||
|
-s second/$(KARCH)-second_floppy \
|
||||||
-k vmlinuz -r ramdisk.gz floppy_ramdisk.bin.X
|
-k vmlinuz -r ramdisk.gz floppy_ramdisk.bin.X
|
||||||
ifdef CONSOLE
|
ifdef CONSOLE
|
||||||
tools/emile-set-output floppy_ramdisk.bin.X --printer --modem
|
tools/emile-set-output floppy_ramdisk.bin.X --printer --modem
|
||||||
@ -91,7 +122,7 @@ boot.bin: floppy.bin
|
|||||||
ln -s boot.bin last.bin
|
ln -s boot.bin last.bin
|
||||||
|
|
||||||
vmlinux.bin: $(KERNEL)
|
vmlinux.bin: $(KERNEL)
|
||||||
$(OBJCOPY) -I elf32-big -O binary -R .note -R .comment -S $(KERNEL) vmlinux.bin
|
$(M68K_OBJCOPY) -I elf32-big -O binary -R .note -R .comment -S $(KERNEL) vmlinux.bin
|
||||||
|
|
||||||
vmlinuz: vmlinux.bin
|
vmlinuz: vmlinux.bin
|
||||||
cp vmlinux.bin vmlinuz.out
|
cp vmlinux.bin vmlinuz.out
|
||||||
@ -99,11 +130,17 @@ vmlinuz: vmlinux.bin
|
|||||||
mv vmlinuz.out.gz vmlinuz
|
mv vmlinuz.out.gz vmlinuz
|
||||||
|
|
||||||
first/first_floppy::
|
first/first_floppy::
|
||||||
$(MAKE) -C first OBJCOPY=$(OBJCOPY) LD=$(LD) CC=$(CC) AS=$(AS) SIGNATURE="$(SIGNATURE)"
|
$(MAKE) -C first OBJCOPY=$(M68K_OBJCOPY) LD=$(M68K_LD) CC=$(M68K_CC) AS=$(M68K_AS) SIGNATURE="$(SIGNATURE)"
|
||||||
|
|
||||||
second/second_floppy::
|
second/$(KARCH)-second_floppy::
|
||||||
$(MAKE) -C second OBJCOPY=$(OBJCOPY) LD=$(LD) CC=$(CC) AS=$(AS) \
|
$(MAKE) -C second OBJCOPY=$(M68K_OBJCOPY) LD=$(M68K_LD) CC=$(M68K_CC) \
|
||||||
VERSION=$(VERSION) SIGNATURE="$(SIGNATURE)"
|
AS=$(M68K_AS) VERSION=$(VERSION) SIGNATURE="$(SIGNATURE)" \
|
||||||
|
$(KARCH)-second_floppy
|
||||||
|
|
||||||
|
second/$(KARCH)-second_scsi::
|
||||||
|
$(MAKE) -C second OBJCOPY=$(M68K_OBJCOPY) LD=$(M68K_LD) CC=$(M68K_CC) \
|
||||||
|
AS=$(M68K_AS) VERSION=$(VERSION) SIGNATURE="$(SIGNATURE)" \
|
||||||
|
$(KARCH)-second_scsi
|
||||||
|
|
||||||
libemile::
|
libemile::
|
||||||
$(MAKE) -C libemile all VERSION=$(VERSION) SIGNATURE="$(SIGNATURE)"
|
$(MAKE) -C libemile all VERSION=$(VERSION) SIGNATURE="$(SIGNATURE)"
|
||||||
@ -135,9 +172,9 @@ install: all
|
|||||||
install -d $(DESTDIR)/$(PREFIX)/lib/emile/
|
install -d $(DESTDIR)/$(PREFIX)/lib/emile/
|
||||||
install first/first_floppy $(DESTDIR)/$(PREFIX)/lib/emile/first_floppy
|
install first/first_floppy $(DESTDIR)/$(PREFIX)/lib/emile/first_floppy
|
||||||
install -d $(DESTDIR)/$(PREFIX)/boot/emile/
|
install -d $(DESTDIR)/$(PREFIX)/boot/emile/
|
||||||
install second/second_scsi $(DESTDIR)/$(PREFIX)/boot/emile/second_scsi
|
install second/$(KARCH)-second_scsi $(DESTDIR)/$(PREFIX)/boot/emile/$(KARCH)-second_scsi
|
||||||
install -d $(DESTDIR)/$(PREFIX)/lib/emile/
|
install -d $(DESTDIR)/$(PREFIX)/lib/emile/
|
||||||
install second/second_floppy $(DESTDIR)/$(PREFIX)/lib/emile/second_floppy
|
install second/$(KARCH)-second_floppy $(DESTDIR)/$(PREFIX)/lib/emile/$(KARCH)-second_floppy
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(DESTDIR)/$(PREFIX)/usr/include/libemile.h
|
rm -f $(DESTDIR)/$(PREFIX)/usr/include/libemile.h
|
||||||
@ -150,8 +187,8 @@ uninstall:
|
|||||||
rm -fr $(DESTDIR)/$(PREFIX)/sbin/emile-map-set
|
rm -fr $(DESTDIR)/$(PREFIX)/sbin/emile-map-set
|
||||||
rm -f $(DESTDIR)/$(PREFIX)/boot/emile/first_scsi
|
rm -f $(DESTDIR)/$(PREFIX)/boot/emile/first_scsi
|
||||||
rm -f $(DESTDIR)/$(PREFIX)/lib/emile/first_floppy
|
rm -f $(DESTDIR)/$(PREFIX)/lib/emile/first_floppy
|
||||||
rm -f $(DESTDIR)/$(PREFIX)/boot/emile/second_scsi
|
rm -f $(DESTDIR)/$(PREFIX)/boot/emile/$(KARCH)-second_scsi
|
||||||
rm -f $(DESTDIR)/$(PREFIX)/lib/emile/second_floppy
|
rm -f $(DESTDIR)/$(PREFIX)/lib/emile/$(KARCH)-second_floppy
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(MAKE) -C libemile clean
|
$(MAKE) -C libemile clean
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
TOP = $(shell pwd)
|
TOP = $(shell pwd)
|
||||||
VPATH = $(TOP)
|
VPATH = $(TOP)
|
||||||
#CPPFLAGS = -DVERSION="\"$(VERSION)\""
|
|
||||||
CPPFLAGS = -DVERSION="\"$(VERSION)\"" -I$(TOP) -Wa,-I$(TOP) \
|
CPPFLAGS = -DVERSION="\"$(VERSION)\"" -I$(TOP) -Wa,-I$(TOP) \
|
||||||
$(OPTFLAGS)
|
$(OPTFLAGS)
|
||||||
CFLAGS = -Wno-multichar -O -m68030 -nostdlib -nodefaultlibs -Wall -Werror -fpic
|
CFLAGS = -Wno-multichar -O -m68030 -nostdlib -nodefaultlibs -Wall -Werror -fpic
|
||||||
@ -21,26 +20,43 @@ OBJS = head.o MMU030_asm.o MMU040_asm.o main.o console.o printf.o \
|
|||||||
|
|
||||||
OBJS_SCSI = scsi.o container.o
|
OBJS_SCSI = scsi.o container.o
|
||||||
|
|
||||||
all: second_floppy second_scsi
|
all: m68k-second_floppy m68k-second_scsi ppc-second_floppy ppc-second_scsi
|
||||||
|
|
||||||
second: second.o
|
second: second.o
|
||||||
$(OBJCOPY) -j .text -j .data -j .rodata -j .got \
|
$(OBJCOPY) -j .text -j .data -j .rodata -j .got \
|
||||||
-O binary second.o second
|
-O binary second.o second
|
||||||
|
|
||||||
second_floppy::
|
m68k-second_floppy::
|
||||||
test -d floppy || mkdir floppy
|
test -d m68k-floppy || mkdir m68k-floppy
|
||||||
cd floppy && make -f $(TOP)/Makefile second VERSION=$(VERSION) \
|
cd m68k-floppy && make -f $(TOP)/Makefile second VERSION=$(VERSION) \
|
||||||
TOP=$(TOP) OBJCOPY=$(OBJCOPY) LD=$(LD) CC=$(CC) \
|
TOP=$(TOP) OPTFLAGS="-DARCH_M68K" \
|
||||||
|
OBJCOPY=$(OBJCOPY) LD=$(LD) CC=$(CC) \
|
||||||
AS=$(AS) SIGNATURE="$(SIGNATURE)"
|
AS=$(AS) SIGNATURE="$(SIGNATURE)"
|
||||||
mv floppy/second second_floppy
|
mv m68k-floppy/second m68k-second_floppy
|
||||||
|
|
||||||
second_scsi::
|
m68k-second_scsi::
|
||||||
test -d scsi || mkdir scsi
|
test -d m68k-scsi || mkdir m68k-scsi
|
||||||
cd scsi && make -f $(TOP)/Makefile second VERSION=$(VERSION) \
|
cd m68k-scsi && make -f $(TOP)/Makefile second VERSION=$(VERSION) \
|
||||||
TOP=$(TOP) OPTFLAGS=-DSCSI_SUPPORT \
|
TOP=$(TOP) OPTFLAGS="-DARCH_M68K -DSCSI_SUPPORT" \
|
||||||
OBJCOPY=$(OBJCOPY) LD=$(LD) CC=$(CC) AS=$(AS) \
|
OBJCOPY=$(OBJCOPY) LD=$(LD) CC=$(CC) AS=$(AS) \
|
||||||
SIGNATURE="$(SIGNATURE)" OPTOBJS="$(OBJS_SCSI)"
|
SIGNATURE="$(SIGNATURE)" OPTOBJS="$(OBJS_SCSI)"
|
||||||
mv scsi/second second_scsi
|
mv m68k-scsi/second m68k-second_scsi
|
||||||
|
|
||||||
|
ppc-second_floppy::
|
||||||
|
test -d ppc-floppy || mkdir ppc-floppy
|
||||||
|
cd ppc-floppy && make -f $(TOP)/Makefile second VERSION=$(VERSION) \
|
||||||
|
TOP=$(TOP) OPTFLAGS="-DARCH_PPC" \
|
||||||
|
OBJCOPY=$(OBJCOPY) LD=$(LD) CC=$(CC) \
|
||||||
|
AS=$(AS) SIGNATURE="$(SIGNATURE)"
|
||||||
|
mv ppc-floppy/second ppc-second_floppy
|
||||||
|
|
||||||
|
ppc-second_scsi::
|
||||||
|
test -d ppc-scsi || mkdir ppc-scsi
|
||||||
|
cd ppc-scsi && make -f $(TOP)/Makefile second VERSION=$(VERSION) \
|
||||||
|
TOP=$(TOP) OPTFLAGS="-DARCH_PPC -DSCSI_SUPPORT" \
|
||||||
|
OBJCOPY=$(OBJCOPY) LD=$(LD) CC=$(CC) AS=$(AS) \
|
||||||
|
SIGNATURE="$(SIGNATURE)" OPTOBJS="$(OBJS_SCSI)"
|
||||||
|
mv ppc-scsi/second ppc-second_scsi
|
||||||
|
|
||||||
second.o: $(OBJS) $(TOP)/ld.script
|
second.o: $(OBJS) $(TOP)/ld.script
|
||||||
$(LD) -T $(TOP)/ld.script -o second.o $(OBJS)
|
$(LD) -T $(TOP)/ld.script -o second.o $(OBJS)
|
||||||
|
Loading…
Reference in New Issue
Block a user