Gentoo Archives: gentoo-commits

From: Steve Arnold <nerdboy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-embedded/sunxi-tools/files/, dev-embedded/sunxi-tools/
Date: Fri, 14 Jan 2022 23:44:00
Message-Id: 1642200510.53bf6b05947281d0f4b4c2191f86b513819bc5a5.nerdboy@gentoo
1 commit: 53bf6b05947281d0f4b4c2191f86b513819bc5a5
2 Author: Steve Arnold <nerdboy <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jan 14 18:04:10 2022 +0000
4 Commit: Steve Arnold <nerdboy <AT> gentoo <DOT> org>
5 CommitDate: Fri Jan 14 22:48:30 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=53bf6b05
7
8 dev-embedded/sunxi-tools: bump to newer version with flash builder
9
10 * required to build flash images for CHIP devices
11
12 Package-Manager: Portage-3.0.20, Repoman-3.0.3
13 Signed-off-by: Steve Arnold <nerdboy <AT> gentoo.org>
14
15 dev-embedded/sunxi-tools/Manifest | 1 +
16 ...-tools-1.4.1-fix-strncpy-compiler-warning.patch | 42 ++++++
17 ...-tools-1.4.1-respect-user-supplied-cflags.patch | 153 +++++++++++++++++++++
18 dev-embedded/sunxi-tools/sunxi-tools-1.4.1.ebuild | 36 +++++
19 4 files changed, 232 insertions(+)
20
21 diff --git a/dev-embedded/sunxi-tools/Manifest b/dev-embedded/sunxi-tools/Manifest
22 index a6e9cfe28cfa..db2220b9c0ad 100644
23 --- a/dev-embedded/sunxi-tools/Manifest
24 +++ b/dev-embedded/sunxi-tools/Manifest
25 @@ -1 +1,2 @@
26 DIST sunxi-tools-1.3.tar.gz 52608 BLAKE2B e8c3ed7276f705273598e38a0cc469225de1ee4eb8177b78be63b78ebc584c4fdf2362e21b895f61b4c5e84df98bfd5ccf6d3965ffa9338c98027c9ce4635626 SHA512 954c95963013aee8a38b3583ba1b7ec7e7049c7e09c5fa9ec564dfc33f304d3669fdf68c2fa5e4b5a6265640a3d1ee8bc13bcd71d804c714884b6a780d193615
27 +DIST sunxi-tools-1.4.1.tar.gz 78878 BLAKE2B f50b14e79d4880a076f8b25869eea44e34cfc50c91ce7f9e4adc831bb2ac2238c930623677bacb399e52faadba20c9ba21ea212915c50941af825d0579804153 SHA512 b66f5caaabec016a0d2f1ccc88ee7f37cd26a511ac81c270e2de6bf0b967e8dfda2b510d5306daffb33ec8855c3c6be99a29bfd1efd5bd0cf3431494b092a52b
28
29 diff --git a/dev-embedded/sunxi-tools/files/sunxi-tools-1.4.1-fix-strncpy-compiler-warning.patch b/dev-embedded/sunxi-tools/files/sunxi-tools-1.4.1-fix-strncpy-compiler-warning.patch
30 new file mode 100644
31 index 000000000000..a255e61f3f01
32 --- /dev/null
33 +++ b/dev-embedded/sunxi-tools/files/sunxi-tools-1.4.1-fix-strncpy-compiler-warning.patch
34 @@ -0,0 +1,42 @@
35 +From 0825d9aaa6078ef283390662004797a9a1d939f3 Mon Sep 17 00:00:00 2001
36 +From: Andre Przywara <andre.przywara@×××.com>
37 +Date: Wed, 15 Dec 2021 23:04:14 +0000
38 +Subject: [PATCH 1/2] nandpart: fix strncpy compiler warning
39 +
40 +More recent versions of GCC warns about the usage of strncpy in
41 +nandpart.c: we actually only (need to) copy the stub string part of the
42 +magic string, without the terminating NUL character. This is fine in
43 +our particular case, but raises the compiler's eyebrows:
44 +===================
45 +nand-part.c: In function '_get_mbr':
46 +nand-part.c:93:4: warning: 'strncpy' output truncated before terminating
47 + nul copying 8 bytes from a string of the same length
48 + [-Wstringop-truncation]
49 + 93 | strncpy((char *)mbr->magic, MBR_MAGIC, 8);
50 + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
51 +===================
52 +
53 +Switch to the more fitting memcpy() here to avoid the warning.
54 +
55 +Signed-off-by: Andre Przywara <andre.przywara@×××.com>
56 +Reported-by: slange-dev
57 +---
58 + nand-part.c | 2 +-
59 + 1 file changed, 1 insertion(+), 1 deletion(-)
60 +
61 +diff --git a/nand-part.c b/nand-part.c
62 +index a0d46c5..af2169d 100644
63 +--- a/nand-part.c
64 ++++ b/nand-part.c
65 +@@ -90,7 +90,7 @@ static MBR *_get_mbr(int fd, int mbr_num, int force)
66 + printf("check partition table copy %d: ", mbr_num);
67 + printmbrheader(mbr);
68 + if (force) {
69 +- strncpy((char *)mbr->magic, MBR_MAGIC, 8);
70 ++ memcpy(mbr->magic, MBR_MAGIC, 8);
71 + mbr->version = MBR_VERSION;
72 + return mbr;
73 + }
74 +--
75 +2.32.0
76 +
77
78 diff --git a/dev-embedded/sunxi-tools/files/sunxi-tools-1.4.1-respect-user-supplied-cflags.patch b/dev-embedded/sunxi-tools/files/sunxi-tools-1.4.1-respect-user-supplied-cflags.patch
79 new file mode 100644
80 index 000000000000..faa2ae606bea
81 --- /dev/null
82 +++ b/dev-embedded/sunxi-tools/files/sunxi-tools-1.4.1-respect-user-supplied-cflags.patch
83 @@ -0,0 +1,153 @@
84 +From 95d40f8fcfd97890c270d2987bd845c7a6bac428 Mon Sep 17 00:00:00 2001
85 +From: Bernhard Nortmann <bernhard.nortmann@×××.de>
86 +Date: Sat, 29 Oct 2016 18:32:00 +0200
87 +Subject: [PATCH] Makefile: Ensure that user-supplied CFLAGS get respected
88 +
89 +Signed-off-by: Bernhard Nortmann <bernhard.nortmann@×××.de>
90 +---
91 + .travis.yml | 2 +-
92 + Makefile | 53 ++++++++++++++++++++++++++++-------------------------
93 + 2 files changed, 29 insertions(+), 26 deletions(-)
94 +
95 +diff --git a/.travis.yml b/.travis.yml
96 +index 47aa891..c843fba 100644
97 +--- a/.travis.yml
98 ++++ b/.travis.yml
99 +@@ -4,7 +4,7 @@ sudo: false
100 + language: c
101 +
102 + # treat all warnings as errors
103 +-env: EXTRA_CFLAGS=-Werror
104 ++env: CFLAGS=-Werror
105 +
106 + os:
107 + - linux
108 +diff --git a/Makefile b/Makefile
109 +index 6e0471b..12f121c 100644
110 +--- a/Makefile
111 ++++ b/Makefile
112 +@@ -17,21 +17,21 @@
113 + # along with this program. If not, see <http://www.gnu.org/licenses/>.
114 +
115 + CC ?= gcc
116 +-CFLAGS = -g -O0 -Wall -Wextra $(EXTRA_CFLAGS)
117 +-CFLAGS += -std=c99 $(DEFINES)
118 +-CFLAGS += -Iinclude/
119 ++DEFAULT_CFLAGS := -g -O0 -Wall -Wextra -std=c99
120 +
121 +-DEFINES = -D_POSIX_C_SOURCE=200112L
122 ++DEFAULT_CFLAGS += -D_POSIX_C_SOURCE=200112L
123 + # Define _BSD_SOURCE, necessary to expose all endian conversions properly.
124 + # See http://linux.die.net/man/3/endian
125 +-DEFINES += -D_BSD_SOURCE
126 ++DEFAULT_CFLAGS += -D_BSD_SOURCE
127 + # glibc 2.20+ also requires _DEFAULT_SOURCE
128 +-DEFINES += -D_DEFAULT_SOURCE
129 ++DEFAULT_CFLAGS += -D_DEFAULT_SOURCE
130 + ifeq (NetBSD,$(OS))
131 + # add explicit _NETBSD_SOURCE, see https://github.com/linux-sunxi/sunxi-tools/pull/22
132 +-DEFINES += -D_NETBSD_SOURCE
133 ++DEFAULT_CFLAGS += -D_NETBSD_SOURCE
134 + endif
135 +
136 ++DEFAULT_CFLAGS += -Iinclude/
137 ++
138 + # Tools useful on host and target
139 + TOOLS = sunxi-fexc sunxi-bootinfo sunxi-fel sunxi-nand-part
140 +
141 +@@ -49,6 +49,7 @@ MISC_TOOLS = phoenix_info sunxi-nand-image-builder
142 + BINFILES = fel-pio.bin jtag-loop.sunxi fel-sdboot.sunxi uart0-helloworld-sdboot.sunxi
143 +
144 + CROSS_COMPILE ?= arm-none-eabi-
145 ++CROSS_CC ?= $(CROSS_COMPILE)gcc
146 + MKSUNXIBOOT ?= mksunxiboot
147 +
148 + DESTDIR ?=
149 +@@ -110,24 +111,26 @@ LIBUSB_CFLAGS ?= `pkg-config --cflags $(LIBUSB)`
150 + LIBUSB_LIBS ?= `pkg-config --libs $(LIBUSB)`
151 + ifeq ($(OS),Windows_NT)
152 + # Windows lacks mman.h / mmap()
153 +- DEFINES += -DNO_MMAP
154 ++ DEFAULT_CFLAGS += -DNO_MMAP
155 + # portable_endian.h relies on winsock2
156 + LIBS += -lws2_32
157 + endif
158 +
159 ++HOST_CFLAGS = $(DEFAULT_CFLAGS) $(CFLAGS)
160 ++
161 + sunxi-fel: fel.c fel-to-spl-thunk.h progress.c progress.h
162 +- $(CC) $(CFLAGS) $(LIBUSB_CFLAGS) $(LDFLAGS) -o $@ $(filter %.c,$^) $(LIBS) $(LIBUSB_LIBS)
163 ++ $(CC) $(HOST_CFLAGS) $(LIBUSB_CFLAGS) $(LDFLAGS) -o $@ $(filter %.c,$^) $(LIBS) $(LIBUSB_LIBS)
164 +
165 + sunxi-nand-part: nand-part-main.c nand-part.c nand-part-a10.h nand-part-a20.h
166 +- $(CC) $(CFLAGS) -c -o nand-part-main.o nand-part-main.c
167 +- $(CC) $(CFLAGS) -c -o nand-part-a10.o nand-part.c -D A10
168 +- $(CC) $(CFLAGS) -c -o nand-part-a20.o nand-part.c -D A20
169 ++ $(CC) $(HOST_CFLAGS) -c -o nand-part-main.o nand-part-main.c
170 ++ $(CC) $(HOST_CFLAGS) -c -o nand-part-a10.o nand-part.c -D A10
171 ++ $(CC) $(HOST_CFLAGS) -c -o nand-part-a20.o nand-part.c -D A20
172 + $(CC) $(LDFLAGS) -o $@ nand-part-main.o nand-part-a10.o nand-part-a20.o $(LIBS)
173 +
174 + sunxi-%: %.c
175 +- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(filter %.c,$^) $(LIBS)
176 ++ $(CC) $(HOST_CFLAGS) $(LDFLAGS) -o $@ $(filter %.c,$^) $(LIBS)
177 + phoenix_info: phoenix_info.c
178 +- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
179 ++ $(CC) $(HOST_CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
180 +
181 + %.bin: %.elf
182 + $(CROSS_COMPILE)objcopy -O binary $< $@
183 +@@ -143,39 +146,39 @@ ARM_ELF_FLAGS += -mno-thumb-interwork -fno-stack-protector -fno-toplevel-reorder
184 + ARM_ELF_FLAGS += -Wstrict-prototypes -Wno-format-nonliteral -Wno-format-security
185 +
186 + fel-pio.elf: fel-pio.c fel-pio.lds
187 +- $(CROSS_COMPILE)gcc -g $(ARM_ELF_FLAGS) $< -nostdlib -o $@ -T fel-pio.lds
188 ++ $(CROSS_CC) -g $(ARM_ELF_FLAGS) $< -nostdlib -o $@ -T fel-pio.lds
189 +
190 + fel-pio.nm: fel-pio.elf
191 + $(CROSS_COMPILE)nm $< | grep -v " _" >$@
192 +
193 + jtag-loop.elf: jtag-loop.c jtag-loop.lds
194 +- $(CROSS_COMPILE)gcc -g $(ARM_ELF_FLAGS) $< -nostdlib -o $@ -T jtag-loop.lds -Wl,-N
195 ++ $(CROSS_CC) -g $(ARM_ELF_FLAGS) $< -nostdlib -o $@ -T jtag-loop.lds -Wl,-N
196 +
197 + fel-sdboot.elf: fel-sdboot.S fel-sdboot.lds
198 +- $(CROSS_COMPILE)gcc -g $(ARM_ELF_FLAGS) $< -nostdlib -o $@ -T fel-sdboot.lds -Wl,-N
199 ++ $(CROSS_CC) -g $(ARM_ELF_FLAGS) $< -nostdlib -o $@ -T fel-sdboot.lds -Wl,-N
200 +
201 + uart0-helloworld-sdboot.elf: uart0-helloworld-sdboot.c uart0-helloworld-sdboot.lds
202 +- $(CROSS_COMPILE)gcc -g $(ARM_ELF_FLAGS) $< -nostdlib -o $@ -T uart0-helloworld-sdboot.lds -Wl,-N
203 ++ $(CROSS_CC) -g $(ARM_ELF_FLAGS) $< -nostdlib -o $@ -T uart0-helloworld-sdboot.lds -Wl,-N
204 +
205 + boot_head_sun3i.elf: boot_head.S boot_head.lds
206 +- $(CROSS_COMPILE)gcc -g $(ARM_ELF_FLAGS) $< -nostdlib -o $@ -T boot_head.lds -Wl,-N -DMACHID=0x1094
207 ++ $(CROSS_CC) -g $(ARM_ELF_FLAGS) $< -nostdlib -o $@ -T boot_head.lds -Wl,-N -DMACHID=0x1094
208 +
209 + boot_head_sun4i.elf: boot_head.S boot_head.lds
210 +- $(CROSS_COMPILE)gcc -g $(ARM_ELF_FLAGS) $< -nostdlib -o $@ -T boot_head.lds -Wl,-N -DMACHID=0x1008
211 ++ $(CROSS_CC) -g $(ARM_ELF_FLAGS) $< -nostdlib -o $@ -T boot_head.lds -Wl,-N -DMACHID=0x1008
212 +
213 + boot_head_sun5i.elf: boot_head.S boot_head.lds
214 +- $(CROSS_COMPILE)gcc -g $(ARM_ELF_FLAGS) $< -nostdlib -o $@ -T boot_head.lds -Wl,-N -DMACHID=0x102A
215 ++ $(CROSS_CC) -g $(ARM_ELF_FLAGS) $< -nostdlib -o $@ -T boot_head.lds -Wl,-N -DMACHID=0x102A
216 +
217 + sunxi-bootinfo: bootinfo.c
218 +
219 + # target tools
220 +-TARGET_CFLAGS = -g -O0 -Wall -Wextra -std=c99 $(DEFINES) -Iinclude/ -static
221 ++TARGET_CFLAGS = $(DEFAULT_CFLAGS) -static $(CFLAGS)
222 + sunxi-pio: pio.c
223 +- $(CROSS_COMPILE)gcc $(TARGET_CFLAGS) -o $@ $<
224 ++ $(CROSS_CC) $(TARGET_CFLAGS) -o $@ $<
225 + sunxi-meminfo: meminfo.c
226 +- $(CROSS_COMPILE)gcc $(TARGET_CFLAGS) -o $@ $<
227 ++ $(CROSS_CC) $(TARGET_CFLAGS) -o $@ $<
228 + sunxi-script_extractor: script_extractor.c
229 +- $(CROSS_COMPILE)gcc $(TARGET_CFLAGS) -o $@ $<
230 ++ $(CROSS_CC) $(TARGET_CFLAGS) -o $@ $<
231 +
232 + version.h:
233 + @./autoversion.sh > $@
234 +--
235 +2.32.0
236 +
237
238 diff --git a/dev-embedded/sunxi-tools/sunxi-tools-1.4.1.ebuild b/dev-embedded/sunxi-tools/sunxi-tools-1.4.1.ebuild
239 new file mode 100644
240 index 000000000000..eead316718cc
241 --- /dev/null
242 +++ b/dev-embedded/sunxi-tools/sunxi-tools-1.4.1.ebuild
243 @@ -0,0 +1,36 @@
244 +# Copyright 1999-2022 Gentoo Authors
245 +# Distributed under the terms of the GNU General Public License v2
246 +
247 +EAPI="6"
248 +
249 +inherit toolchain-funcs
250 +
251 +MY_PV="v${PV}"
252 +SRC_URI="https://github.com/linux-sunxi/sunxi-tools/archive/${MY_PV}.tar.gz -> ${P}.tar.gz"
253 +
254 +DESCRIPTION="Tools for Allwinner A10 devices."
255 +HOMEPAGE="http://linux-sunxi.org/"
256 +
257 +LICENSE="GPL-2"
258 +SLOT="0"
259 +IUSE=""
260 +KEYWORDS="~amd64"
261 +
262 +DEPEND="virtual/libusb"
263 +
264 +PATCHES=(
265 + "${FILESDIR}/${P}-respect-user-supplied-cflags.patch"
266 + "${FILESDIR}/${P}-fix-strncpy-compiler-warning.patch"
267 +)
268 +
269 +src_compile() {
270 + emake CC="$(tc-getCC)" tools misc
271 +}
272 +
273 +src_install() {
274 + dobin bin2fex fex2bin phoenix_info sunxi-nand-image-builder
275 + newbin sunxi-bootinfo bootinfo
276 + newbin sunxi-fel fel
277 + newbin sunxi-fexc fexc
278 + newbin sunxi-nand-part nand-part
279 +}