mirror of
https://github.com/vivier/EMILE.git
synced 2025-04-04 09:29:31 +00:00
Add support for multiple kernel type: add netBSD
This commit is contained in:
parent
acf4794515
commit
f696ece068
110
Makefile
110
Makefile
@ -56,41 +56,49 @@ PPC_OBJCOPY=$(PPC_CROSS_COMPILE)objcopy
|
||||
|
||||
# Kernel architecture
|
||||
|
||||
RAMDISK=ramdisk.gz
|
||||
KERNELPATH=vmlinux
|
||||
LINUXRAMDISK=ramdisk.gz
|
||||
LINUXPATH=vmlinux
|
||||
|
||||
KERNEL=$(shell ls $(KERNELPATH) 2> /dev/null)
|
||||
LINUX=$(shell ls $(LINUXPATH) 2> /dev/null)
|
||||
|
||||
ifeq ($(KERNEL),$(KERNELPATH))
|
||||
FILEARCH=$(shell file -bknL $(KERNEL) | cut -d, -f 2)
|
||||
ifeq ($(findstring PowerPC, $(FILEARCH)), PowerPC)
|
||||
KARCH=ppc
|
||||
ifeq ($(LINUX),$(LINUXPATH))
|
||||
FILEARCH=$(shell file -bknL $(LINUX) | cut -d, -f 2)
|
||||
ifeq ($(findstring PowerPC, $(FILEARCH)), PowerPC)
|
||||
|
||||
KARCH=ppc
|
||||
|
||||
else
|
||||
ifeq ($(findstring Motorola 68000, $(FILEARCH)), Motorola 68000)
|
||||
|
||||
KARCH=classic
|
||||
|
||||
else
|
||||
ifeq ($(findstring Motorola 68, $(FILEARCH)), Motorola 68)
|
||||
|
||||
KARCH=m68k
|
||||
else
|
||||
KARCH=unknown
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(findstring Motorola 68, $(FILEARCH)), Motorola 68)
|
||||
KARCH=m68k
|
||||
else
|
||||
KARCH=unknown
|
||||
endif
|
||||
endif
|
||||
else
|
||||
KARCH=m68k
|
||||
KARCH=m68k
|
||||
endif
|
||||
|
||||
# Target
|
||||
|
||||
all: libemile tools first/first_floppy second/$(KARCH)-second_floppy \
|
||||
second/$(KARCH)-second_scsi
|
||||
all: libemile tools first/first_floppy second
|
||||
|
||||
# We can build floppy image only if a kernel is provided
|
||||
|
||||
ifeq ($(KERNEL),$(KERNELPATH))
|
||||
ifeq ($(LINUX),$(LINUXPATH))
|
||||
all_bin: netboot.bin rescue.bin debian-installer.bin boot.bin
|
||||
rm -f last.bin
|
||||
|
||||
floppy.bin: libemile tools first/first_floppy vmlinuz \
|
||||
second/$(KARCH)-second_floppy
|
||||
second
|
||||
tools/emile-install -f first/first_floppy \
|
||||
-s second/$(KARCH)-second_floppy \
|
||||
-s second/$(KARCH)-linux-floppy/second \
|
||||
-k vmlinuz floppy.bin.X
|
||||
ifdef CONSOLE
|
||||
tools/emile-set-output floppy.bin.X --printer --modem
|
||||
@ -98,10 +106,10 @@ endif
|
||||
mv floppy.bin.X floppy.bin
|
||||
|
||||
floppy_ramdisk.bin: libemile tools first/first_floppy vmlinuz \
|
||||
second/$(KARCH)-second_floppy $(RAMDISK)
|
||||
second/$(KARCH)-linux-floppy/second $(LINUXRAMDISK)
|
||||
tools/emile-install -f first/first_floppy \
|
||||
-s second/$(KARCH)-second_floppy \
|
||||
-k vmlinuz -r $(RAMDISK) floppy_ramdisk.bin.X
|
||||
-s second/$(KARCH)-linux-floppy/second \
|
||||
-k vmlinuz -r $(LINUXRAMDISK) floppy_ramdisk.bin.X
|
||||
ifdef CONSOLE
|
||||
tools/emile-set-output floppy_ramdisk.bin.X --printer --modem
|
||||
endif
|
||||
@ -135,8 +143,8 @@ boot.bin: floppy.bin
|
||||
mv boot.bin.X boot.bin
|
||||
ln -s boot.bin last.bin
|
||||
|
||||
vmlinux.bin: $(KERNEL)
|
||||
$(M68K_OBJCOPY) -I elf32-big -O binary -R .note -R .comment -S $(KERNEL) vmlinux.bin
|
||||
vmlinux.bin: $(LINUX)
|
||||
$(M68K_OBJCOPY) -I elf32-big -O binary -R .note -R .comment -S $(LINUX) vmlinux.bin
|
||||
|
||||
vmlinuz: vmlinux.bin
|
||||
cp vmlinux.bin vmlinuz.out
|
||||
@ -144,18 +152,51 @@ vmlinuz: vmlinux.bin
|
||||
mv vmlinuz.out.gz vmlinuz
|
||||
endif
|
||||
|
||||
NETBSDPATH=netbsd
|
||||
|
||||
NETBSD=$(shell ls $(NETBSDPATH) 2> /dev/null)
|
||||
|
||||
ifeq ($(NETBSD),$(NETBSDPATH))
|
||||
netbsd-floppy.bin: libemile tools first/first_floppy netbsd.gz \
|
||||
second
|
||||
tools/emile-install -f first/first_floppy \
|
||||
-s second/$(KARCH)-linux-floppy/second \
|
||||
-k netbsd.gz netbsd-floppy.bin.X
|
||||
ifdef CONSOLE
|
||||
tools/emile-set-output netbsd-floppy.bin.X --printer --modem
|
||||
endif
|
||||
mv netbsd-floppy.bin.X netbsd-floppy.bin
|
||||
|
||||
netbsd-boot.bin: netbsd-floppy.bin
|
||||
rm -f last.bin
|
||||
cp netbsd-floppy.bin netbsd-boot.bin.X
|
||||
tools/emile-set-cmdline netbsd-boot.bin.X $(BOOT_ARGS)
|
||||
mv netbsd-boot.bin.X netbsd-boot.bin
|
||||
ln -s netbsd-boot.bin last.bin
|
||||
|
||||
netbsd.bin: $(LINUX)
|
||||
$(M68K_OBJCOPY) -I elf32-big -O binary -R .note -R .comment -S $(NETBSD) netbsd.bin
|
||||
|
||||
netbsd.gz: netbsd.bin
|
||||
cp netbsd.bin netbsd.out
|
||||
gzip -9 netbsd.out
|
||||
mv netbsd.out.gz netbsd.gz
|
||||
endif
|
||||
|
||||
first/first_floppy::
|
||||
$(MAKE) -C first OBJCOPY=$(M68K_OBJCOPY) LD=$(M68K_LD) CC=$(M68K_CC) AS=$(M68K_AS) SIGNATURE="$(SIGNATURE)"
|
||||
|
||||
second/$(KARCH)-second_floppy::
|
||||
$(MAKE) -C second OBJCOPY=$(M68K_OBJCOPY) LD=$(M68K_LD) CC=$(M68K_CC) \
|
||||
AS=$(M68K_AS) VERSION=$(VERSION) SIGNATURE="$(SIGNATURE)" \
|
||||
$(KARCH)-second_floppy
|
||||
second:: second/$(KARCH)-linux-scsi/second second/$(KARCH)-linux-floppy/second
|
||||
|
||||
second/$(KARCH)-second_scsi::
|
||||
second/$(KARCH)-linux-floppy/second::
|
||||
$(MAKE) -C second OBJCOPY=$(M68K_OBJCOPY) LD=$(M68K_LD) CC=$(M68K_CC) \
|
||||
AS=$(M68K_AS) VERSION=$(VERSION) SIGNATURE="$(SIGNATURE)" \
|
||||
$(KARCH)-second_scsi
|
||||
TARGET=$(KARCH)-linux MEDIA=floppy $(KARCH)-linux-floppy/second
|
||||
|
||||
second/$(KARCH)-linux-scsi/second::
|
||||
$(MAKE) -C second OBJCOPY=$(M68K_OBJCOPY) LD=$(M68K_LD) CC=$(M68K_CC) \
|
||||
AS=$(M68K_AS) VERSION=$(VERSION) SIGNATURE="$(SIGNATURE)" \
|
||||
TARGET=$(KARCH)-linux MEDIA=scsi $(KARCH)-linux-scsi/second
|
||||
|
||||
libemile::
|
||||
$(MAKE) -C libemile all VERSION=$(VERSION) SIGNATURE="$(SIGNATURE)" \
|
||||
@ -190,9 +231,9 @@ install: all
|
||||
install -d $(DESTDIR)/$(PREFIX)/lib/emile/
|
||||
install first/first_floppy $(DESTDIR)/$(PREFIX)/lib/emile/first_floppy
|
||||
install -d $(DESTDIR)/$(PREFIX)/boot/emile/
|
||||
install second/$(KARCH)-second_scsi $(DESTDIR)/$(PREFIX)/boot/emile/$(KARCH)-second_scsi
|
||||
install second/$(KARCH)-linux-scsi/second $(DESTDIR)/$(PREFIX)/boot/emile/$(KARCH)-second_scsi
|
||||
install -d $(DESTDIR)/$(PREFIX)/lib/emile/
|
||||
install second/$(KARCH)-second_floppy $(DESTDIR)/$(PREFIX)/lib/emile/$(KARCH)-second_floppy
|
||||
install second/$(KARCH)-linux-floppy/second $(DESTDIR)/$(PREFIX)/lib/emile/$(KARCH)-second_floppy
|
||||
$(MAKE) -C docs install
|
||||
|
||||
uninstall:
|
||||
@ -244,7 +285,8 @@ SECOND_FILES = second/MMU030.c second/MMU030.h second/MMU030_asm.S \
|
||||
second/misc.c second/misc.h second/printf.c \
|
||||
second/uncompress.c second/uncompress.h \
|
||||
second/enter_kernel040.S second/keyboard.h \
|
||||
second/keyboard.c second/cli.h second/cli.c
|
||||
second/keyboard.c second/cli.h second/cli.c \
|
||||
second/bootenv.c second/bootenv.h
|
||||
|
||||
TOOLS_FILES = tools/emile-set-cmdline.c tools/Makefile \
|
||||
tools/emile-first-tune.c \
|
||||
|
175
second/Makefile
175
second/Makefile
@ -4,13 +4,13 @@
|
||||
#
|
||||
#
|
||||
|
||||
TARGET = m68k-linux
|
||||
MEDIA = floppy
|
||||
|
||||
TOP = $(shell pwd)
|
||||
VPATH = $(TOP)
|
||||
CPPFLAGS = -DVERSION="\"$(VERSION)\"" -I$(TOP) -Wa,-I$(TOP) \
|
||||
$(OPT_CPPFLAGS) -DUSE_CLI
|
||||
#TARGET_CFLAGS = -m68000 -Wa,-m68000 -Os
|
||||
TARGET_CFLAGS = -m68020 -Wa,-m68020 -Os
|
||||
CFLAGS = $(OPT_CFLAGS) -nostdlib -nodefaultlibs -Wall -Werror -Wno-multichar -fpic $(TARGET_CFLAGS)
|
||||
CPPFLAGS = -DVERSION="\"$(VERSION)\"" -I$(TOP) -Wa,-I$(TOP) $(OPT_CPPFLAGS) -DUSE_CLI
|
||||
CFLAGS = $(OPT_CFLAGS) -nostdlib -nodefaultlibs -Wall -Werror -Wno-multichar -fpic
|
||||
ASFLAGS =
|
||||
LS = ls
|
||||
AWK = awk
|
||||
@ -20,79 +20,108 @@ OBJS = head.o main.o console.o printf.o \
|
||||
misc.o glue.o bank.o arch.o \
|
||||
load.o serial.o vga.o $(OPTOBJS) $(OBJS_CLI)
|
||||
|
||||
OBJS_M68K = MMU030_asm.o MMU040_asm.o MMU030.o MMU040.o \
|
||||
enter_kernel030.o enter_kernel040.o bootinfo.o \
|
||||
enter_kernelnoMMU.o
|
||||
OBJS_CLI = keyboard.o cli.o
|
||||
|
||||
OBJS_PPC = enter_kernelPPC.o PPC_asm.o bootx.o
|
||||
# ARCHITECTURE
|
||||
|
||||
OBJS_M68K = MMU030_asm.o MMU040_asm.o MMU030.o MMU040.o \
|
||||
enter_kernel030.o enter_kernel040.o enter_kernelnoMMU.o
|
||||
|
||||
OBJS_PPC = enter_kernelPPC.o PPC_asm.o
|
||||
|
||||
# TARGET
|
||||
|
||||
OBJS_LINUX_M68K = bootinfo.o
|
||||
|
||||
OBJS_NETBSD_M68K = bootenv.o
|
||||
|
||||
OBJS_LINUX_PPC = bootx.o
|
||||
|
||||
# MEDIA
|
||||
|
||||
OBJS_SCSI = scsi.o container.o
|
||||
|
||||
OBJS_CLI = keyboard.o cli.o
|
||||
OBJS_FLOPPY =
|
||||
|
||||
all: m68k-second_floppy m68k-second_scsi ppc-second_floppy ppc-second_scsi
|
||||
OBJS_ATA =
|
||||
|
||||
|
||||
ifeq ("$(TARGET)", "m68k-linux")
|
||||
|
||||
OBJS_TARGET = $(OBJS_M68K) $(OBJS_LINUX_M68K)
|
||||
CPPFLAGS_TARGET = -D__LINUX__ -DARCH_M68K
|
||||
CFLAGS_TARGET = -m68020 -Wa,-m68020 -Os
|
||||
|
||||
else
|
||||
ifeq ("$(TARGET)", "classic-linux")
|
||||
|
||||
OBJS_TARGET = $(OBJS_M68K) $(OBJS_LINUX_M68K)
|
||||
CPPFLAGS_TARGET = -D__LINUX__ -DARCH_M68K
|
||||
CFLAGS_TARGET = -m68000 -Wa,-m68000 -Os
|
||||
|
||||
else
|
||||
ifeq ("$(TARGET)", "ppc-linux")
|
||||
|
||||
OBJS_TARGET = $(OBJS_PPC) $(OBJS_LINUX_PPC)
|
||||
CPPFLAGS_TARGET = -D__LINUX__ -DARCH_PPC
|
||||
CFLAGS_TARGET = -m68020 -Wa,-m68020 -Os
|
||||
|
||||
else
|
||||
ifeq ("$(TARGET)", "mixed-linux")
|
||||
|
||||
OBJS_TARGET = $(OBJS_M68K) $(OBJS_LINUX_M68K) $(OBJS_PPC) $(OBJS_LINUX_PPC)
|
||||
CPPFLAGS_TARGET = -D__LINUX__ -DARCH_M68K -DARCH_PPC
|
||||
CFLAGS_TARGET = -m68020 -Wa,-m68020 -Os
|
||||
|
||||
else
|
||||
ifeq ("$(TARGET)", "m68k-netbsd")
|
||||
|
||||
OBJS_TARGET = $(OBJS_M68K) $(OBJS_NETBSD_M68K)
|
||||
CPPFLAGS_TARGET = -D__NETBSD__ -DARCH_M68K
|
||||
CFLAGS_TARGET = -m68020 -Wa,-m68020 -Os
|
||||
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ("$(MEDIA)", "scsi")
|
||||
|
||||
OBJS_MEDIA = $(OBJS_SCSI)
|
||||
CPPFLAGS_MEDIA = -DSCSI_SUPPORT
|
||||
|
||||
else
|
||||
ifeq ("$(MEDIA)", "floppy")
|
||||
|
||||
OBJS_MEDIA = $(OBJS_FLOPPY)
|
||||
CPPFLAGS_MEDIA = -DFLOPPY_SUPPORT
|
||||
|
||||
else
|
||||
ifeq ("$(MEDIA)", "ata")
|
||||
|
||||
OBJS_MEDIA = $(OBJS_ATA)
|
||||
CPPFLAGS_MEDIA = -DATA_SUPPORT
|
||||
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
$(TARGET)-$(MEDIA)/second:
|
||||
test -d $(TARGET)-$(MEDIA) || mkdir $(TARGET)-$(MEDIA)
|
||||
cd $(TARGET)-$(MEDIA) && make -f $(TOP)/Makefile second \
|
||||
VERSION=$(VERSION) \
|
||||
TOP=$(TOP) \
|
||||
OBJCOPY=$(OBJCOPY) LD=$(LD) CC=$(CC) \
|
||||
AS=$(AS) SIGNATURE="$(SIGNATURE)" \
|
||||
OPT_CPPFLAGS="$(CPPFLAGS_TARGET) $(CPPFLAGS_MEDIA)" \
|
||||
OPT_CFLAGS="$(CFLAGS_TARGET)" \
|
||||
OPTOBJS="$(OBJS_TARGET) $(OBJS_MEDIA)"
|
||||
|
||||
second: second.o
|
||||
$(OBJCOPY) -j .text -j .data -j .rodata -j .got \
|
||||
-O binary second.o second
|
||||
|
||||
m68k-second_floppy::
|
||||
test -d m68k-floppy || mkdir m68k-floppy
|
||||
cd m68k-floppy && make -f $(TOP)/Makefile second VERSION=$(VERSION) \
|
||||
TOP=$(TOP) \
|
||||
OPT_CPPFLAGS="-DARCH_M68K" \
|
||||
OBJCOPY=$(OBJCOPY) LD=$(LD) CC=$(CC) \
|
||||
AS=$(AS) SIGNATURE="$(SIGNATURE)" \
|
||||
OPTOBJS="$(OBJS_M68K)"
|
||||
mv m68k-floppy/second m68k-second_floppy
|
||||
|
||||
m68k-second_scsi::
|
||||
test -d m68k-scsi || mkdir m68k-scsi
|
||||
cd m68k-scsi && make -f $(TOP)/Makefile second VERSION=$(VERSION) \
|
||||
TOP=$(TOP) \
|
||||
OPT_CPPFLAGS="-DARCH_M68K -DSCSI_SUPPORT" \
|
||||
OBJCOPY=$(OBJCOPY) LD=$(LD) CC=$(CC) AS=$(AS) \
|
||||
SIGNATURE="$(SIGNATURE)" \
|
||||
OPTOBJS="$(OBJS_M68K) $(OBJS_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) OPT_CPPFLAGS="-DARCH_PPC" \
|
||||
OBJCOPY=$(OBJCOPY) LD=$(LD) CC=$(CC) \
|
||||
AS=$(AS) SIGNATURE="$(SIGNATURE)" \
|
||||
OPTOBJS="$(OBJS_PPC)"
|
||||
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) OPT_CPPFLAGS="-DARCH_PPC -DSCSI_SUPPORT" \
|
||||
OBJCOPY=$(OBJCOPY) LD=$(LD) CC=$(CC) AS=$(AS) \
|
||||
SIGNATURE="$(SIGNATURE)" \
|
||||
OPTOBJS="$(OBJS_PPC) $(OBJS_SCSI)"
|
||||
mv ppc-scsi/second ppc-second_scsi
|
||||
|
||||
mixed-second_floppy::
|
||||
test -d mixed-floppy || mkdir mixed-floppy
|
||||
cd mixed-floppy && make -f $(TOP)/Makefile second VERSION=$(VERSION) \
|
||||
TOP=$(TOP) OPT_CPPFLAGS="-DARCH_M68K -DARCH_PPC" \
|
||||
OBJCOPY=$(OBJCOPY) LD=$(LD) CC=$(CC) \
|
||||
AS=$(AS) SIGNATURE="$(SIGNATURE)" \
|
||||
OPTOBJS="$(OBJS_PPC) $(OBJS_M68K)"
|
||||
mv mixed-floppy/second mixed-second_floppy
|
||||
|
||||
mixed-second_scsi::
|
||||
test -d mixed-scsi || mkdir mixed-scsi
|
||||
cd mixed-scsi && make -f $(TOP)/Makefile second VERSION=$(VERSION) \
|
||||
TOP=$(TOP) \
|
||||
OPT_CPPFLAGS="-DARCH_M68K -DARCH_PPC -DSCSI_SUPPORT"\
|
||||
OBJCOPY=$(OBJCOPY) LD=$(LD) CC=$(CC) AS=$(AS) \
|
||||
SIGNATURE="$(SIGNATURE)" \
|
||||
OPTOBJS="$(OBJS_PPC) ($OBJS_M68K) $(OBJS_SCSI)"
|
||||
mv mixed-scsi/second mixed-second_scsi
|
||||
|
||||
second.o: $(OBJS) $(TOP)/ld.script
|
||||
$(LD) -T $(TOP)/ld.script -o second.o $(OBJS)
|
||||
|
||||
@ -100,9 +129,7 @@ second.o: $(OBJS) $(TOP)/ld.script
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $^
|
||||
|
||||
clean:
|
||||
rm -f m68k-second_floppy m68k-second_scsi \
|
||||
m68k-floppy/*.o m68k-scsi/*.o \
|
||||
ppc-second_floppy ppc-second_scsi \
|
||||
ppc-floppy/*.o ppc-scsi/*.o \
|
||||
mixed-second_floppy mixed-second_scsi \
|
||||
mixed-floppy/*.o mixed-scsi/*.o
|
||||
rm -fr m68k-linux-floppy m68k-linux-scsi m68k-linux-ata \
|
||||
ppc-linux-floppy ppc-linux-scsi ppc-linux-ata \
|
||||
mixed-linux-floppy mixed-linux-scsi mixed-linux-ata \
|
||||
m68k-netbsd-floppy
|
||||
|
Loading…
x
Reference in New Issue
Block a user