> I can't get this to apply against -rc3 or -rc4 (just updated in
> u-boot/master).
> These changes are complex enough, it would be preferable to create a
> merge request on salsa.
I am not sure that a merge request is the right tool here.
Patch 1 is not intended for commit, only documenting and
(re)generating patch 2.
Patches 2 and 3 are conceptually one suggestion, 2 is the generated
part and 3 is the manual part.
Sorry, the 4 commits are convenient during local rebases, but confusing
as attachments. Please:
Forget about 0001.patch and 0002.patch.
# python3 PATH/TO/ATTACHED/targets.py debian/targets > debian/targets.mk
# git rm debian/targets
# git add debian/targets.mk
# git commit -m 'Replace many shell constructs with Make constructs (generated
part)'
Commit 0003.patch.
Then optionally commit 0004.patch.
#!/usr/bin/python3
# Convert debian/targets to a Makefile snippet included by
# debian/rules.
# python3 debian/targets.py < debian/targets > debian/targets.mk
qemu = {}
architectures = {}
maintainers = []
with open ('debian/targets') as i:
assert i.readline () == '# ARCH subarch platform target\n'
assert i.readline () == '# --------------------------------------------\n'
for line in i:
if line == '\n':
maintainers = []
continue
if line.startswith('#'):
maintainers.append (line.rstrip ())
continue
fields = line.rstrip ().split ()
arch, subarch, platform = fields [:3]
targets = fields [3:]
if arch.startswith ('all'):
assert subarch == 'qemu'
qemu [platform] = (arch, targets)
else:
if arch not in architectures:
architectures [arch] = {}
packages = architectures [arch]
if subarch == '-':
package = 'u-boot'
else:
package = f'u-boot-{subarch}'
if package not in packages:
packages [package] = {}
platforms = packages [package]
platforms [platform] = (targets, maintainers)
print ('# Target architectures supported by u-boot in Debian.')
print ('# debian/rules includes this Makefile snippet.')
def format_targets (platform : str,
targets : list):
s = f' {platform}_targets :='
print (s, end='')
col = len (s)
for t in sorted (targets):
if 75 < col + len (t):
print (' \\')
print (' ', end='')
col = 4
s = f' {t}'
print (s, end='')
col += len (s)
print ('')
else_ifeq = False
for arch in sorted (architectures.keys ()):
print ('')
if else_ifeq:
print ('else ', end='')
else:
else_ifeq = True
print ('ifeq (${DEB_HOST_ARCH},' + arch + ')')
packages = architectures [arch]
for package in sorted (packages.keys ()):
print ('')
print (f'# {package}')
platforms = packages [package]
for platform in sorted (platforms.keys ()):
targets, maintainers = platforms [platform]
print ('')
for maintainer in maintainers:
print (f' {maintainer}')
print (f' {package}_platforms += {platform}')
if targets [0].startswith ('/usr/lib/arm-trusted-firmware/'):
print (f' {platform}_assigns := BL31={targets.pop (0)}')
if platform != 'novena-rawsd':
targets.append ('uboot.elf')
format_targets (platform, targets)
print ('')
print ('endif')
print ('')
print ('# u-boot-qemu (Architecture: all)')
for platform in sorted (qemu.keys ()):
arch, targets = qemu [platform]
print ('')
print (f' u-boot-qemu_platforms += {platform}')
gnu_type = arch[4:]
print (f' {platform}_CROSS_COMPILE := {gnu_type}-')
targets.append ('uboot.elf')
format_targets (platform, targets)