-
Notifications
You must be signed in to change notification settings - Fork 421
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
57 changed files
with
512 additions
and
108 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
# Copyright (C) 2012 Alejandro Mery <[email protected]> | ||
# Copyright (C) 2012,2013 Henrik Nordstrom <[email protected]> | ||
# Copyright (C) 2013 Patrick Wood <[email protected]> | ||
# Copyright (C) 2013 Pat Wood <[email protected]> | ||
# Copyright (C) 2012 Alejandro Mery <[email protected]> | ||
# Copyright (C) 2012,2013 Henrik Nordstrom <[email protected]> | ||
# Copyright (C) 2013 Patrick Wood <[email protected]> | ||
# Copyright (C) 2013 Pat Wood <[email protected]> | ||
# Copyright (C) 2014 Alexey Edelev <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
|
@@ -10,111 +11,59 @@ | |
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
CC = gcc | ||
CFLAGS = -g -O0 -Wall -Wextra | ||
CFLAGS += -std=c99 -D_POSIX_C_SOURCE=200112L | ||
CFLAGS += -Iinclude/ | ||
PWD=$(shell pwd) | ||
.PHONY:tools baremetal | ||
|
||
TOOLS = fexc bin2fex fex2bin bootinfo fel pio | ||
TOOLS += nand-part | ||
TOOLS = \ | ||
bootinfo \ | ||
fel \ | ||
nand_part \ | ||
fexc \ | ||
phoenix_info \ | ||
pio | ||
|
||
MISC_TOOLS = phoenix_info | ||
CROSS_TOOLS = \ | ||
meminfo | ||
|
||
CROSS_COMPILE ?= arm-none-eabi- | ||
BAREMETAL = \ | ||
boot_head \ | ||
fel-sdboot \ | ||
jtag-loop \ | ||
fel-pio \ | ||
fel-copy | ||
|
||
.PHONY: all clean | ||
|
||
all: $(TOOLS) | ||
$(TOOLS): FORCE | ||
$(MAKE) -C tools/$@ | ||
tools:$(TOOLS) | ||
|
||
misc: $(MISC_TOOLS) | ||
$(BAREMETAL): FORCE | ||
$(MAKE) -C baremetal/$@ | ||
baremetal:$(BAREMETAL) | ||
|
||
clean: | ||
@rm -vf $(TOOLS) $(MISC_TOOLS) *.o *.elf *.sunxi *.bin *.nm *.orig | ||
$(CROSS_TOOLS):FORCE | ||
$(MAKE) -C tools/$@ | ||
cross-tools:$(CROSS_TOOLS) | ||
|
||
tools-clean: | ||
for d in $(TOOLS); do $(MAKE) -C tools/$$d clean; done | ||
|
||
$(TOOLS): Makefile common.h | ||
baremetal-clean: | ||
for d in $(BAREMETAL); do $(MAKE) -C baremetal/$$d clean; done | ||
|
||
fex2bin bin2fex: fexc | ||
ln -s $< $@ | ||
cross-tools-clean: | ||
for d in $(CROSS_TOOLS); do $(MAKE) -C tools/$$d clean; done | ||
|
||
fexc: fexc.h script.h script.c \ | ||
script_uboot.h script_uboot.c \ | ||
script_bin.h script_bin.c \ | ||
script_fex.h script_fex.c | ||
tools-install: | ||
for d in $(TOOLS); do $(MAKE) -C tools/$$d install; done | ||
|
||
LIBUSB = libusb-1.0 | ||
LIBUSB_CFLAGS = `pkg-config --cflags $(LIBUSB)` | ||
LIBUSB_LIBS = `pkg-config --libs $(LIBUSB)` | ||
tools-uninstall: | ||
for d in $(TOOLS); do $(MAKE) -C tools/$$d uninstall; done | ||
|
||
fel: fel.c | ||
$(CC) $(CFLAGS) $(LIBUSB_CFLAGS) $(LDFLAGS) -o $@ $(filter %.c,$^) $(LIBS) $(LIBUSB_LIBS) | ||
|
||
nand-part: nand-part-main.c nand-part.c nand-part-a10.h nand-part-a20.h | ||
$(CC) $(CFLAGS) -c -o nand-part-main.o nand-part-main.c | ||
$(CC) $(CFLAGS) -c -o nand-part-a10.o nand-part.c -D A10 | ||
$(CC) $(CFLAGS) -c -o nand-part-a20.o nand-part.c -D A20 | ||
$(CC) $(LDFLAGS) -o $@ nand-part-main.o nand-part-a10.o nand-part-a20.o $(LIBS) | ||
|
||
%: %.c | ||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(filter %.c,$^) $(LIBS) | ||
|
||
fel-pio.bin: fel-pio.elf fel-pio.nm | ||
$(CROSS_COMPILE)objcopy -O binary fel-pio.elf fel-pio.bin | ||
|
||
fel-pio.elf: fel-pio.c fel-pio.lds | ||
$(CROSS_COMPILE)gcc -g -Os -fpic -fno-common -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder fel-pio.c -nostdlib -o fel-pio.elf -T fel-pio.lds | ||
|
||
fel-pio.nm: fel-pio.elf | ||
$(CROSS_COMPILE)nm fel-pio.elf | grep -v " _" >fel-pio.nm | ||
|
||
jtag-loop.elf: jtag-loop.c jtag-loop.lds | ||
$(CROSS_COMPILE)gcc -g -Os -fpic -fno-common -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder jtag-loop.c -nostdlib -o jtag-loop.elf -T jtag-loop.lds -Wl,-N | ||
|
||
jtag-loop.bin: jtag-loop.elf | ||
$(CROSS_COMPILE)objcopy -O binary jtag-loop.elf jtag-loop.bin | ||
|
||
jtag-loop.sunxi: jtag-loop.bin | ||
mksunxiboot jtag-loop.bin jtag-loop.sunxi | ||
|
||
fel-sdboot.elf: fel-sdboot.c fel-sdboot.lds | ||
$(CROSS_COMPILE)gcc -g -Os -fpic -fno-common -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder fel-sdboot.c -nostdlib -o fel-sdboot.elf -T fel-sdboot.lds -Wl,-N | ||
|
||
fel-sdboot.bin: fel-sdboot.elf | ||
$(CROSS_COMPILE)objcopy -O binary fel-sdboot.elf fel-sdboot.bin | ||
|
||
fel-sdboot.sunxi: fel-sdboot.bin | ||
mksunxiboot fel-sdboot.bin fel-sdboot.sunxi | ||
|
||
boot_head_sun3i.elf: boot_head_sun3i.S boot_head_sun3i.lds | ||
$(CROSS_COMPILE)gcc -g -Os -fpic -fno-common -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder boot_head.S -nostdlib -o boot_head_sun3i.elf -T boot_head.lds -Wl,-N -DMACHID=0x1094 | ||
|
||
boot_head_sun3i.bin: boot_head_sun3i.elf | ||
$(CROSS_COMPILE)objcopy -O binary boot_head_sun3i.elf boot_head_sun3i.bin | ||
|
||
boot_head_sun4i.elf: boot_head.S boot_head.lds | ||
$(CROSS_COMPILE)gcc -g -Os -fpic -fno-common -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder boot_head.S -nostdlib -o boot_head_sun4i.elf -T boot_head.lds -Wl,-N -DMACHID=0x1008 | ||
|
||
boot_head_sun4i.bin: boot_head_sun4i.elf | ||
$(CROSS_COMPILE)objcopy -O binary boot_head_sun4i.elf boot_head_sun4i.bin | ||
|
||
boot_head_sun5i.elf: boot_head.S boot_head.lds | ||
$(CROSS_COMPILE)gcc -g -Os -fpic -fno-common -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder boot_head.S -nostdlib -o boot_head_sun5i.elf -T boot_head.lds -Wl,-N -DMACHID=0x102A | ||
|
||
boot_head_sun5i.bin: boot_head_sun5i.elf | ||
$(CROSS_COMPILE)objcopy -O binary boot_head_sun5i.elf boot_head_sun5i.bin | ||
|
||
bootinfo: bootinfo.c | ||
|
||
meminfo: meminfo.c | ||
$(CROSS_COMPILE)gcc -g -O0 -Wall -static -o $@ $^ | ||
|
||
.gitignore: Makefile | ||
@for x in $(TOOLS) '*.o' '*.swp'; do \ | ||
echo "$$x"; \ | ||
done > $@ | ||
FORCE: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (C) 2014 Alexey Edelev <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
CC ?= gcc | ||
OBJCOPY ?= objcopy | ||
NM ?= nm | ||
CROSS_COMPILE ?= arm-none-gnueabi- | ||
override CFLAGS := $(CFLAGS) -g -Os -fpic -fno-common -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder -nostdlib | ||
override CC := $(CROSS_COMPILE)$(CC) | ||
override OBJCOPY := $(CROSS_COMPILE)$(OBJCOPY) | ||
override NM := $(CROSS_COMPILE)$(NM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright (C) 2014 Alexey Edelev <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
.DEFAULT: all | ||
|
||
all: $(TARGETS) $(EXTRA_DEPS) | ||
|
||
$(ELFS): $(SOURCES) $(LDSCRIPT) | ||
$(CC) $(CFLAGS) $(SOURCES) -o $@ -T $(LDSCRIPT) -Wl,-N $(DEFINES) | ||
|
||
$(TARGETS): $(ELFS) | ||
$(OBJCOPY) -O binary $(subst .bin,.elf,$@) $@ | ||
|
||
clean: | ||
rm -f $(ELFS) | ||
rm -f $(TARGETS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright (C) 2014 Alexey Edelev <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
include ../baremetal.env | ||
|
||
sun3i_MATCHID=0x1094 | ||
sun4i_MATCHID=0x1008 | ||
sun5i_MATCHID=0x102A | ||
|
||
BOOT_HEADS = boot_head_sun3i \ | ||
boot_head_sun4i \ | ||
boot_head_sun5i | ||
|
||
ELFS = $(addsuffix .elf, $(BOOT_HEADS)) | ||
TARGETS = $(addsuffix .bin, $(BOOT_HEADS)) | ||
|
||
SOURCES = boot_head.S | ||
LDSCRIPT = boot_head.lds | ||
DEFINES=-DMACHID=$($(subst boot_head_,,$(subst .elf,,$@))_MATCHID) | ||
include ../baremetal.rules |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (C) 2014 Alexey Edelev <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
include ../baremetal.env | ||
|
||
.DEFAULT: all | ||
|
||
all: fel-copy.bin | ||
|
||
fel-copy.bin: fel-copy.o | ||
$(OBJCOPY) -O binary fel-copy.o fel-copy.bin | ||
|
||
fel-copy.o: | ||
$(CC) $(CFLAGS) -c fel-copy.c -o fel-copy.o | ||
|
||
clean: | ||
rm -f fel-copy.bin fel-copy.o |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (C) 2014 Alexey Edelev <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
include ../baremetal.env | ||
|
||
ELFS = fel-pio.elf | ||
TARGETS = fel-pio.bin | ||
EXTRA_DEPS = fel-pio.nm | ||
|
||
SOURCES = fel-pio.c | ||
LDSCRIPT = fel-pio.lds | ||
|
||
include ../baremetal.rules | ||
fel-pio.nm: fel-pio.elf | ||
$(NM) $^ | grep -v " _" >$@ |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (C) 2014 Alexey Edelev <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
include ../baremetal.env | ||
|
||
ELFS = fel-sdboot.elf | ||
TARGETS = fel-sdboot.bin | ||
|
||
SOURCES = fel-sdboot.c | ||
LDSCRIPT = fel-sdboot.lds | ||
EXTRA_DEPS = fel-sdboot.sunxi | ||
include ../baremetal.rules | ||
|
||
fel-sdboot.sunxi: fel-sdboot.bin | ||
-if $$(which mksunxiboot); then mksunxiboot $^ $@; fi |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright (C) 2014 Alexey Edelev <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
include ../baremetal.env | ||
|
||
ELFS = jtag-loop.elf | ||
TARGETS = jtag-loop.bin | ||
EXTRA_DEPS = jtag-loop.sunxi | ||
|
||
SOURCES = jtag-loop.c | ||
LDSCRIPT = jtag-loop.lds | ||
include ../baremetal.rules | ||
jtag-loop.sunxi: jtag-loop.bin | ||
-if $$(which mksunxiboot); then mksunxiboot $^ $@; fi |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.