Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
This commit is contained in:
60
target/linux/mpc85xx/image/spi-loader/Makefile
Normal file
60
target/linux/mpc85xx/image/spi-loader/Makefile
Normal file
@@ -0,0 +1,60 @@
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# Copyright (C) 2022 Matthias Schiffer <mschiffer@universe-factory.net>
|
||||
|
||||
CONFIG ?= $(error No configuration set)
|
||||
|
||||
include config/$(CONFIG).mk
|
||||
|
||||
MKIMAGE := mkimage
|
||||
KARCH := powerpc
|
||||
CC := $(CROSS_COMPILE)gcc
|
||||
LD := $(CROSS_COMPILE)ld
|
||||
OBJCOPY := $(CROSS_COMPILE)objcopy
|
||||
|
||||
PROGRAM_NAME := MPC85xx SPI loader
|
||||
|
||||
BIN_FLAGS := -O binary --pad-to=$(PAD_TO)
|
||||
|
||||
CFLAGS += -std=gnu17 -Os -Wall -Wstrict-prototypes \
|
||||
-fomit-frame-pointer -ffreestanding \
|
||||
-ffunction-sections -fno-pic \
|
||||
-Iinclude -include ../config/$(CONFIG).h \
|
||||
-DCONFIG_PROGRAM_NAME='"$(PROGRAM_NAME)"' \
|
||||
-DCONFIG_IMAGE_OFFSET=$(IMAGE_OFFSET)
|
||||
ASFLAGS := $(CFLAGS)
|
||||
|
||||
LDS := loader.lds
|
||||
LDFLAGS := -static --gc-sections -T $(LDS) -Ttext $(TEXT_START)
|
||||
|
||||
OBJECTS := head.o loader.o string.o stdio.o drivers/serial/ns16550.o \
|
||||
drivers/spi/fsl_espi.o drivers/spi/spi-nor.o
|
||||
|
||||
OUTDIR := out
|
||||
|
||||
all: $(OUTDIR)/uImage
|
||||
|
||||
-include $(OBJECTS:%.o=$(OUTDIR)/%.d)
|
||||
|
||||
$(OUTDIR)/%.o: %.c Makefile config/$(CONFIG).mk
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) $(CFLAGS) -c -o $@ -MD -MP $<
|
||||
|
||||
$(OUTDIR)/%.o: %.S Makefile config/$(CONFIG).mk
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) $(ASFLAGS) -c -o $@ -MD -MP $<
|
||||
|
||||
$(OUTDIR)/loader.elf: $(OBJECTS:%=$(OUTDIR)/%) $(LDS)
|
||||
$(LD) $(LDFLAGS) -o $@ $(OBJECTS:%=$(OUTDIR)/%)
|
||||
|
||||
$(OUTDIR)/loader.bin: $(OUTDIR)/loader.elf
|
||||
$(OBJCOPY) $(BIN_FLAGS) $< $@
|
||||
|
||||
$(OUTDIR)/uImage: $(OUTDIR)/loader.bin
|
||||
$(MKIMAGE) -A $(KARCH) -O linux -T kernel -C none \
|
||||
-a $(TEXT_START) -e $(TEXT_START) -n '$(PROGRAM_NAME)' -d $< $@
|
||||
|
||||
clean:
|
||||
rm -rf $(OUTDIR)
|
||||
|
||||
.PHONY: all clean
|
||||
Reference in New Issue
Block a user