
XDEV	=arm-linux-

CC	=$(XDEV)gcc
OBJCOPY	=$(XDEV)objcopy

INITRD	=./initrds2
KERNEL	=/usr/src/arm/linux-2.4.19-ak0/arch/arm/boot/Image
GLUE	=./glue.pl

DEFS=
#DEFS=-DDEBUG

all:		kernel
rom:		bootsim.rom

bootsim.rom:	boot2nd.bin $(INITRD) $(KERNEL) $(GLUE)
		$(GLUE) -r bootsim.rom -b boot2nd.bin -k $(KERNEL) $(INITRD)

kernel:		boot2nd.bin $(KERNEL) $(GLUE)
		$(GLUE) -o kernel -b boot2nd.bin -k $(KERNEL)

boot2nd.bin:	boot2nd.S
		$(CC) boot2nd.S -o boot2nd.elf -nostdlib -Wl,-Ttext,0x00000000 $(DEFS)
		$(OBJCOPY) -O binary boot2nd.elf boot2nd.bin
		rm -f boot2nd.elf

clean:
		rm -f boot2nd.elf boot2nd.bin bootsim.rom kernel
