create initrd during the build process

This commit is contained in:
Stefan Lankes 2011-02-16 15:27:21 +01:00
parent 1b85d32945
commit 109c9bf013
2 changed files with 13 additions and 9 deletions

View file

@ -32,7 +32,7 @@ endif
default: all
all: newlib $(NAME)
all: newlib tools $(NAME)
#all:
# for i in $(SUBDIRS); do $(MAKE) -C $$i all; done
@ -46,6 +46,9 @@ all: newlib $(NAME)
newlib:
$(MAKE) ARCH=$(ARCH) CFLAGS="-m32 -march=i586 -fno-stack-protector" NASMFLAGS="-felf32 -g" -C newlib
tools:
$(MAKE) -C tools
$(NAME):
@echo [LD] $(NAME)
$Q$(LD) $(LDFLAGS) -o $(NAME) $^
@ -56,6 +59,7 @@ $(NAME):
clean:
$Q$(RM) $(NAME) $(SYM_NAME) *~
$Q$(MAKE) -C tools clean
@echo Cleaned.
veryclean: clean
@ -76,6 +80,6 @@ veryclean: clean
@echo [ASM] $@
$Q$(NASM) $(NASMFLAGS) -o $@ $<
.PHONY: default all clean emu gdb newlib
.PHONY: default all clean emu gdb newlib tools
include $(addsuffix /Makefile,$(SUBDIRS))

View file

@ -4,18 +4,18 @@ CROSS_COMPILE=i386-unknown-linux-gnu-gcc
CFLAGS = -m32 -O2 -Wall
LDFLGAS =
DEFINES=
ASM = nasm
ASMFLAGS = -fbin
NASM = nasm
NASMFLAGS = -fbin
EXECFILES = $(shell find ../newlib/examples -executable -type f)
# other implicit rules
%.o : %.c
$(CC) -c $(CFLAGS) -o $@ $<
default:
$(MAKE) all
default: all
all:
$(MAKE) make_initrd
all: make_initrd
./make_initrd /bin $(foreach FILE, $(EXECFILES), $(FILE) $(shell basename $(FILE)))
make_initrd: make_initrd.o
$(CC) $(CFLAGS) -o make_initrd $< $(LDFLAGS)
@ -27,7 +27,7 @@ smp_setup.hex: smp_setup.bin
hexdump -v -e '"0x" 1/1 "%02X" ", "' $< > $@
scc_setup.bin: scc_setup.asm
$(ASM) $(ASMFLAGS) -o $@ $<
$(NASM) $(NASMFLAGS) -o $@ $<
reset_vector.bin: reset_vector.o
ld --oformat binary -Ttext 0 -melf_i386 -o $@ $<