-
Notifications
You must be signed in to change notification settings - Fork 419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reorganize folder structure, improve build procedure #31
Open
semlanik
wants to merge
2
commits into
linux-sunxi:master
Choose a base branch
from
semlanik:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,10 +1,19 @@ | ||
fexc | ||
bin2fex | ||
fex2bin | ||
bootinfo | ||
fel | ||
pio | ||
nand-part | ||
meminfo | ||
*.o | ||
*.elf | ||
*.swp | ||
tools/bootinfo/bootinfo | ||
tools/fel/fel | ||
tools/fexc/bin2fex | ||
tools/fexc/fecx | ||
tools/fexc/fex2bin | ||
tools/nand_part/nand-part | ||
tools/phoenix_info/phoenix_info | ||
tools/pio/pio | ||
baremetal/boot_head/boot_head_sun3i.bin | ||
baremetal/boot_head/boot_head_sun4i.bin | ||
baremetal/boot_head/boot_head_sun5i.bin | ||
baremetal/fel-copy/fel-copy.bin | ||
baremetal/fel-pio/fel-pio.bin | ||
baremetal/fel-pio/fel-pio.nm | ||
baremetal/fel-sdboot/fel-sdboot.bin | ||
baremetal/jtag-loop/jtag-loop.bin |
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:$(TOOLS) | ||
$(TOOLS): FORCE | ||
$(MAKE) -C tools/$@ | ||
|
||
misc: $(MISC_TOOLS) | ||
baremetal:$(BAREMETAL) | ||
$(BAREMETAL): FORCE | ||
$(MAKE) -C baremetal/$@ | ||
|
||
clean: | ||
@rm -vf $(TOOLS) $(MISC_TOOLS) *.o *.elf *.sunxi *.bin *.nm *.orig | ||
cross-tools:$(CROSS_TOOLS) | ||
$(CROSS_TOOLS):FORCE | ||
$(MAKE) -C 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_MACHID=0x1094 | ||
sun4i_MACHID=0x1008 | ||
sun5i_MACHID=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,,$@))_MACHID) | ||
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why were these dropped? Won't binaries / .o start showing on git status now?