diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2021-11-15 11:42:28 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-11-18 14:14:54 -0500 |
commit | 701d4ba77e61984a71ddbf552193e5567be4e3af (patch) | |
tree | c54de2854815fa010b13b9c686715f7fea2ce7ec /firmware/target/mips/ingenic_x1000/x1000boot.make | |
parent | 6e61e6f0c882ae4f6797b6a8c3ae92bb41e82893 (diff) | |
download | rockbox-701d4ba77e61984a71ddbf552193e5567be4e3af.tar.gz rockbox-701d4ba77e61984a71ddbf552193e5567be4e3af.zip |
x1000: Merge makefiles used for the bootloader
All three X1000 native targets turned out to have a very
similar boot configuration and used a nearly identical
makefile. Eliminate this duplication by moving the logic
into the main makefile.
Change-Id: I13044b9675c0abd605b8accdb2fee4f54549b020
Diffstat (limited to 'firmware/target/mips/ingenic_x1000/x1000boot.make')
-rw-r--r-- | firmware/target/mips/ingenic_x1000/x1000boot.make | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/firmware/target/mips/ingenic_x1000/x1000boot.make b/firmware/target/mips/ingenic_x1000/x1000boot.make index e69b6a1439..0bdf5cf7b4 100644 --- a/firmware/target/mips/ingenic_x1000/x1000boot.make +++ b/firmware/target/mips/ingenic_x1000/x1000boot.make | |||
@@ -7,6 +7,8 @@ | |||
7 | # $Id$ | 7 | # $Id$ |
8 | # | 8 | # |
9 | 9 | ||
10 | include $(ROOTDIR)/lib/microtar/microtar.make | ||
11 | |||
10 | INCLUDES += -I$(APPSDIR) | 12 | INCLUDES += -I$(APPSDIR) |
11 | SRC += $(call preprocess, $(APPSDIR)/SOURCES) | 13 | SRC += $(call preprocess, $(APPSDIR)/SOURCES) |
12 | 14 | ||
@@ -14,16 +16,23 @@ LDSDEP := $(FIRMDIR)/export/cpu.h $(FIRMDIR)/export/config/$(MODELNAME).h | |||
14 | 16 | ||
15 | BOOTLDS := $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/boot.lds | 17 | BOOTLDS := $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/boot.lds |
16 | BOOTLINK := $(BUILDDIR)/boot.link | 18 | BOOTLINK := $(BUILDDIR)/boot.link |
19 | BOOTEXT := $(suffix $(BINARY)) | ||
17 | 20 | ||
18 | SPLLDS := $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/spl.lds | 21 | SPLLDS := $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/spl.lds |
19 | SPLLINK := $(BUILDDIR)/spl.link | 22 | SPLLINK := $(BUILDDIR)/spl.link |
23 | SPLBINARY := spl$(BOOTEXT) | ||
24 | |||
25 | BLINFO = $(BUILDDIR)/bootloader-info.txt | ||
20 | 26 | ||
21 | CLEANOBJS += $(BUILDDIR)/bootloader.* $(BUILDDIR)/spl.* | 27 | CLEANOBJS += $(BUILDDIR)/bootloader.* $(BUILDDIR)/spl.* |
22 | 28 | ||
23 | include $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/$(MODELNAME)/boot.make | 29 | # Currently not needed |
30 | #include $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/$(MODELNAME)/boot.make | ||
24 | 31 | ||
25 | .SECONDEXPANSION: | 32 | .SECONDEXPANSION: |
26 | 33 | ||
34 | ### Bootloader | ||
35 | |||
27 | $(BOOTLINK): $(BOOTLDS) $(LDSDEP) | 36 | $(BOOTLINK): $(BOOTLDS) $(LDSDEP) |
28 | $(call PRINTS,PP $(@F)) | 37 | $(call PRINTS,PP $(@F)) |
29 | $(call preprocess2file,$<,$@,) | 38 | $(call preprocess2file,$<,$@,) |
@@ -38,6 +47,12 @@ $(BUILDDIR)/bootloader.elf: $$(OBJ) $(FIRMLIB) $(CORE_LIBS) $$(BOOTLINK) | |||
38 | $(BUILDDIR)/bootloader.bin: $(BUILDDIR)/bootloader.elf | 47 | $(BUILDDIR)/bootloader.bin: $(BUILDDIR)/bootloader.elf |
39 | $(call PRINTS,OC $(@F))$(call objcopy,$<,$@) | 48 | $(call PRINTS,OC $(@F))$(call objcopy,$<,$@) |
40 | 49 | ||
50 | $(BUILDDIR)/bootloader.ucl: $(BUILDDIR)/bootloader.bin | ||
51 | $(call PRINTS,UCLPACK $(@F))$(TOOLSDIR)/uclpack --nrv2e -9 $< $@ >/dev/null | ||
52 | |||
53 | |||
54 | ### SPL | ||
55 | |||
41 | $(SPLLINK): $(SPLLDS) $(LDSDEP) | 56 | $(SPLLINK): $(SPLLDS) $(LDSDEP) |
42 | $(call PRINTS,PP $(@F)) | 57 | $(call PRINTS,PP $(@F)) |
43 | $(call preprocess2file,$<,$@,) | 58 | $(call preprocess2file,$<,$@,) |
@@ -51,3 +66,29 @@ $(BUILDDIR)/spl.elf: $$(OBJ) $(FIRMLIB) $(CORE_LIBS) $$(SPLLINK) | |||
51 | 66 | ||
52 | $(BUILDDIR)/spl.bin: $(BUILDDIR)/spl.elf | 67 | $(BUILDDIR)/spl.bin: $(BUILDDIR)/spl.elf |
53 | $(call PRINTS,OC $(@F))$(call objcopy,$<,$@) | 68 | $(call PRINTS,OC $(@F))$(call objcopy,$<,$@) |
69 | |||
70 | $(BUILDDIR)/$(SPLBINARY): $(BUILDDIR)/spl.bin | ||
71 | $(call PRINTS,MKSPL $(@F))$(MKFIRMWARE) $< $@ | ||
72 | |||
73 | |||
74 | ### Generating the update package | ||
75 | |||
76 | # suppress regenerating bootloader-info if nothing has changed | ||
77 | BLVERSION:=$(SVNVERSION) | ||
78 | OLDBLVERSION:=$(shell head -n1 $(BLINFO) 2>/dev/null || echo "NOREVISION") | ||
79 | |||
80 | ifneq ($(BLVERSION),$(OLDBLVERSION)) | ||
81 | .PHONY: $(BLINFO) | ||
82 | endif | ||
83 | |||
84 | $(BLINFO): | ||
85 | $(call PRINTS,GEN $(@F))echo $(SVNVERSION) > $@ | ||
86 | |||
87 | # The "binary" is actually an update package which is just a tar archive | ||
88 | $(BUILDDIR)/$(BINARY): $(BUILDDIR)/$(SPLBINARY) \ | ||
89 | $(BUILDDIR)/bootloader.ucl \ | ||
90 | $(BLINFO) | ||
91 | $(call PRINTS,TAR $(@F))tar -C $(BUILDDIR) \ | ||
92 | --numeric-owner --no-acls --no-xattrs --no-selinux \ | ||
93 | --mode=0644 --owner=0 --group=0 \ | ||
94 | -cf $@ $(call full_path_subst,$(BUILDDIR)/%,%,$^) | ||