summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gen-site-config43
-rwxr-xr-xscripts/install-buildtools47
-rw-r--r--scripts/lib/build_perf/html/measurement_chart.html26
-rw-r--r--scripts/lib/devtool/upgrade.py11
-rw-r--r--scripts/lib/wic/engine.py2
-rw-r--r--scripts/lib/wic/partition.py37
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-efi.py4
-rwxr-xr-xscripts/makefile-getvar24
-rwxr-xr-xscripts/oe-build-perf-report2
9 files changed, 101 insertions, 95 deletions
diff --git a/scripts/gen-site-config b/scripts/gen-site-config
deleted file mode 100755
index 727b809c0f..0000000000
--- a/scripts/gen-site-config
+++ /dev/null
@@ -1,43 +0,0 @@
1#! /bin/sh
2# Copyright (c) 2005-2008 Wind River Systems, Inc.
3#
4# SPDX-License-Identifier: GPL-2.0-only
5#
6
7cat << EOF
8AC_PREREQ(2.57)
9AC_INIT([site_wide],[1.0.0])
10
11EOF
12
13# Disable as endian is set in the default config
14#echo AC_C_BIGENDIAN
15#echo
16
17if [ -e $1/types ] ; then
18 while read type ; do
19 echo "AC_CHECK_SIZEOF([$type])"
20 done < $1/types
21
22 echo
23fi
24
25if [ -e $1/funcs ]; then
26 while read func ; do
27 echo "AC_CHECK_FUNCS([$func])"
28 done < $1/funcs
29
30 echo
31fi
32
33if [ -e $1/headers ]; then
34 while read header ; do
35 echo "AC_CHECK_HEADERS([$header])"
36 done < $1/headers
37
38 echo
39fi
40
41cat << EOF
42AC_OUTPUT
43EOF
diff --git a/scripts/install-buildtools b/scripts/install-buildtools
index 2218f3ffac..5b86c13077 100755
--- a/scripts/install-buildtools
+++ b/scripts/install-buildtools
@@ -56,9 +56,9 @@ PROGNAME = 'install-buildtools'
56logger = scriptutils.logger_create(PROGNAME, stream=sys.stdout) 56logger = scriptutils.logger_create(PROGNAME, stream=sys.stdout)
57 57
58DEFAULT_INSTALL_DIR = os.path.join(os.path.split(scripts_path)[0],'buildtools') 58DEFAULT_INSTALL_DIR = os.path.join(os.path.split(scripts_path)[0],'buildtools')
59DEFAULT_BASE_URL = 'http://downloads.yoctoproject.org/releases/yocto' 59DEFAULT_BASE_URL = 'https://downloads.yoctoproject.org/releases/yocto'
60DEFAULT_RELEASE = 'yocto-4.1' 60DEFAULT_RELEASE = 'yocto-5.0.1'
61DEFAULT_INSTALLER_VERSION = '4.1' 61DEFAULT_INSTALLER_VERSION = '5.0.1'
62DEFAULT_BUILDDATE = '202110XX' 62DEFAULT_BUILDDATE = '202110XX'
63 63
64# Python version sanity check 64# Python version sanity check
@@ -102,6 +102,16 @@ def sha256_file(filename):
102 import hashlib 102 import hashlib
103 return _hasher(hashlib.sha256(), filename) 103 return _hasher(hashlib.sha256(), filename)
104 104
105def remove_quotes(var):
106 """
107 If a variable starts and ends with double quotes, remove them.
108 Assumption: if a variable starts with double quotes, it must also
109 end with them.
110 """
111 if var[0] == '"':
112 var = var[1:-1]
113 return var
114
105 115
106def main(): 116def main():
107 global DEFAULT_INSTALL_DIR 117 global DEFAULT_INSTALL_DIR
@@ -238,19 +248,15 @@ def main():
238 # Verify checksum 248 # Verify checksum
239 if args.check: 249 if args.check:
240 logger.info("Fetching buildtools installer checksum") 250 logger.info("Fetching buildtools installer checksum")
241 checksum_type = "" 251 checksum_type = "sha256sum"
242 for checksum_type in ["md5sum", "sha256sum"]: 252 check_url = "{}.{}".format(buildtools_url, checksum_type)
243 check_url = "{}.{}".format(buildtools_url, checksum_type) 253 checksum_filename = "{}.{}".format(filename, checksum_type)
244 checksum_filename = "{}.{}".format(filename, checksum_type) 254 tmpbuildtools_checksum = os.path.join(tmpsdk_dir, checksum_filename)
245 tmpbuildtools_checksum = os.path.join(tmpsdk_dir, checksum_filename) 255 ret = subprocess.call("wget -q -O %s %s" %
246 ret = subprocess.call("wget -q -O %s %s" % 256 (tmpbuildtools_checksum, check_url), shell=True)
247 (tmpbuildtools_checksum, check_url), shell=True) 257 if ret != 0:
248 if ret == 0: 258 logger.error("Could not download file from %s" % check_url)
249 break 259 return ret
250 else:
251 if ret != 0:
252 logger.error("Could not download file from %s" % check_url)
253 return ret
254 regex = re.compile(r"^(?P<checksum>[0-9a-f]+)\s+(?P<path>.*/)?(?P<filename>.*)$") 260 regex = re.compile(r"^(?P<checksum>[0-9a-f]+)\s+(?P<path>.*/)?(?P<filename>.*)$")
255 with open(tmpbuildtools_checksum, 'rb') as f: 261 with open(tmpbuildtools_checksum, 'rb') as f:
256 original = f.read() 262 original = f.read()
@@ -263,10 +269,7 @@ def main():
263 logger.error("Filename does not match name in checksum") 269 logger.error("Filename does not match name in checksum")
264 return 1 270 return 1
265 checksum = m.group('checksum') 271 checksum = m.group('checksum')
266 if checksum_type == "md5sum": 272 checksum_value = sha256_file(tmpbuildtools)
267 checksum_value = md5_file(tmpbuildtools)
268 else:
269 checksum_value = sha256_file(tmpbuildtools)
270 if checksum == checksum_value: 273 if checksum == checksum_value:
271 logger.info("Checksum success") 274 logger.info("Checksum success")
272 else: 275 else:
@@ -280,7 +283,7 @@ def main():
280 os.chmod(tmpbuildtools, st.st_mode | stat.S_IEXEC) 283 os.chmod(tmpbuildtools, st.st_mode | stat.S_IEXEC)
281 logger.debug(os.stat(tmpbuildtools)) 284 logger.debug(os.stat(tmpbuildtools))
282 if args.directory: 285 if args.directory:
283 install_dir = args.directory 286 install_dir = os.path.abspath(args.directory)
284 ret = subprocess.call("%s -d %s -y" % 287 ret = subprocess.call("%s -d %s -y" %
285 (tmpbuildtools, install_dir), shell=True) 288 (tmpbuildtools, install_dir), shell=True)
286 else: 289 else:
@@ -301,7 +304,7 @@ def main():
301 if match: 304 if match:
302 env_var = match.group('env_var') 305 env_var = match.group('env_var')
303 logger.debug("env_var: %s" % env_var) 306 logger.debug("env_var: %s" % env_var)
304 env_val = match.group('env_val') 307 env_val = remove_quotes(match.group('env_val'))
305 logger.debug("env_val: %s" % env_val) 308 logger.debug("env_val: %s" % env_val)
306 os.environ[env_var] = env_val 309 os.environ[env_var] = env_val
307 310
diff --git a/scripts/lib/build_perf/html/measurement_chart.html b/scripts/lib/build_perf/html/measurement_chart.html
index ad4a93ed02..05bd84e6ce 100644
--- a/scripts/lib/build_perf/html/measurement_chart.html
+++ b/scripts/lib/build_perf/html/measurement_chart.html
@@ -2,7 +2,7 @@
2 // Get raw data 2 // Get raw data
3 const rawData = [ 3 const rawData = [
4 {% for sample in measurement.samples %} 4 {% for sample in measurement.samples %}
5 [{{ sample.commit_num }}, {{ sample.mean.gv_value() }}, {{ sample.start_time }}], 5 [{{ sample.commit_num }}, {{ sample.mean.gv_value() }}, {{ sample.start_time }}, '{{sample.commit}}'],
6 {% endfor %} 6 {% endfor %}
7 ]; 7 ];
8 8
@@ -30,23 +30,23 @@
30 const option = { 30 const option = {
31 tooltip: { 31 tooltip: {
32 trigger: 'axis', 32 trigger: 'axis',
33 valueFormatter: (value) => { 33 enterable: true,
34 const commitNumber = rawData.filter(([commit, dataValue, time]) => updateValue(dataValue) === value) 34 position: function (point, params, dom, rect, size) {
35 return [point[0]-150, '10%'];
36 },
37 formatter: function (param) {
38 const value = param[0].value[1]
39 const sample = rawData.filter(([commit, dataValue]) => updateValue(dataValue) === value)
40 // Add commit hash to the tooltip as a link
41 const commitLink = `https://git.yoctoproject.org/poky/commit/?id=${sample[0][3]}`
35 if ('{{ measurement.value_type.quantity }}' == 'time') { 42 if ('{{ measurement.value_type.quantity }}' == 'time') {
36 const hours = Math.floor(value/60) 43 const hours = Math.floor(value/60)
37 const minutes = Math.floor(value % 60) 44 const minutes = Math.floor(value % 60)
38 const seconds = Math.floor((value * 60) % 60) 45 const seconds = Math.floor((value * 60) % 60)
39 return [ 46 return `<strong>Duration:</strong> ${hours}:${minutes}:${seconds}, <br/> <strong>Commit number:</strong> <a href="${commitLink}" target="_blank" rel="noreferrer noopener">${sample[0][0]}</a>`
40 hours + ':' + minutes + ':' + seconds + ', ' +
41 'commit number: ' + commitNumber[0][0]
42 ]
43 } 47 }
44 return [ 48 return `<strong>Size:</strong> ${value.toFixed(2)} MB, <br/> <strong>Commit number:</strong> <a href="${commitLink}" target="_blank" rel="noreferrer noopener">${sample[0][0]}</a>`
45 value.toFixed(2) + ' MB' + ', ' + 49 ;}
46 'commit number: ' + commitNumber[0][0]
47 ]
48 },
49
50 }, 50 },
51 xAxis: { 51 xAxis: {
52 type: 'time', 52 type: 'time',
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index a8130ed23f..8e13833b51 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -534,6 +534,15 @@ def _generate_license_diff(old_licenses, new_licenses):
534 diff = diff + line 534 diff = diff + line
535 return diff 535 return diff
536 536
537def _run_recipe_update_extra_tasks(pn, rd, tinfoil):
538 tasks = []
539 for task in (rd.getVar('RECIPE_UPDATE_EXTRA_TASKS') or '').split():
540 logger.info('Running extra recipe update task: %s' % task)
541 res = tinfoil.build_targets(pn, task, handle_events=True)
542
543 if not res:
544 raise DevtoolError('Running extra recipe update task %s for %s failed' % (task, pn))
545
537def upgrade(args, config, basepath, workspace): 546def upgrade(args, config, basepath, workspace):
538 """Entry point for the devtool 'upgrade' subcommand""" 547 """Entry point for the devtool 'upgrade' subcommand"""
539 548
@@ -609,6 +618,8 @@ def upgrade(args, config, basepath, workspace):
609 copied, config.workspace_path, rd) 618 copied, config.workspace_path, rd)
610 standard._add_md5(config, pn, af) 619 standard._add_md5(config, pn, af)
611 620
621 _run_recipe_update_extra_tasks(pn, rd, tinfoil)
622
612 update_unlockedsigs(basepath, workspace, args.fixed_setup, [pn]) 623 update_unlockedsigs(basepath, workspace, args.fixed_setup, [pn])
613 624
614 logger.info('Upgraded source extracted to %s' % srctree) 625 logger.info('Upgraded source extracted to %s' % srctree)
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index 674ccfc244..ce7e6c5d75 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -359,7 +359,7 @@ class Disk:
359 Remove files/dirs and their contents from the partition. 359 Remove files/dirs and their contents from the partition.
360 This only applies to ext* partition. 360 This only applies to ext* partition.
361 """ 361 """
362 abs_path = re.sub('\/\/+', '/', path) 362 abs_path = re.sub(r'\/\/+', '/', path)
363 cmd = "{} {} -wR 'rm \"{}\"'".format(self.debugfs, 363 cmd = "{} {} -wR 'rm \"{}\"'".format(self.debugfs,
364 self._get_part_image(pnum), 364 self._get_part_image(pnum),
365 abs_path) 365 abs_path)
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index 795707ec5d..bf2c34d594 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -284,19 +284,8 @@ class Partition():
284 284
285 extraopts = self.mkfs_extraopts or "-F -i 8192" 285 extraopts = self.mkfs_extraopts or "-F -i 8192"
286 286
287 if os.getenv('SOURCE_DATE_EPOCH'): 287 # use hash_seed to generate reproducible ext4 images
288 sde_time = int(os.getenv('SOURCE_DATE_EPOCH')) 288 (extraopts, pseudo) = self.get_hash_seed_ext4(extraopts, pseudo)
289 if pseudo:
290 pseudo = "export E2FSPROGS_FAKE_TIME=%s;%s " % (sde_time, pseudo)
291 else:
292 pseudo = "export E2FSPROGS_FAKE_TIME=%s; " % sde_time
293
294 # Set hash_seed to generate deterministic directory indexes
295 namespace = uuid.UUID("e7429877-e7b3-4a68-a5c9-2f2fdf33d460")
296 if self.fsuuid:
297 namespace = uuid.UUID(self.fsuuid)
298 hash_seed = str(uuid.uuid5(namespace, str(sde_time)))
299 extraopts += " -E hash_seed=%s" % hash_seed
300 289
301 label_str = "" 290 label_str = ""
302 if self.label: 291 if self.label:
@@ -344,6 +333,23 @@ class Partition():
344 333
345 self.check_for_Y2038_problem(rootfs, native_sysroot) 334 self.check_for_Y2038_problem(rootfs, native_sysroot)
346 335
336 def get_hash_seed_ext4(self, extraopts, pseudo):
337 if os.getenv('SOURCE_DATE_EPOCH'):
338 sde_time = int(os.getenv('SOURCE_DATE_EPOCH'))
339 if pseudo:
340 pseudo = "export E2FSPROGS_FAKE_TIME=%s;%s " % (sde_time, pseudo)
341 else:
342 pseudo = "export E2FSPROGS_FAKE_TIME=%s; " % sde_time
343
344 # Set hash_seed to generate deterministic directory indexes
345 namespace = uuid.UUID("e7429877-e7b3-4a68-a5c9-2f2fdf33d460")
346 if self.fsuuid:
347 namespace = uuid.UUID(self.fsuuid)
348 hash_seed = str(uuid.uuid5(namespace, str(sde_time)))
349 extraopts += " -E hash_seed=%s" % hash_seed
350
351 return (extraopts, pseudo)
352
347 def prepare_rootfs_btrfs(self, rootfs, cr_workdir, oe_builddir, rootfs_dir, 353 def prepare_rootfs_btrfs(self, rootfs, cr_workdir, oe_builddir, rootfs_dir,
348 native_sysroot, pseudo): 354 native_sysroot, pseudo):
349 """ 355 """
@@ -437,13 +443,16 @@ class Partition():
437 443
438 extraopts = self.mkfs_extraopts or "-i 8192" 444 extraopts = self.mkfs_extraopts or "-i 8192"
439 445
446 # use hash_seed to generate reproducible ext4 images
447 (extraopts, pseudo) = self.get_hash_seed_ext4(extraopts, None)
448
440 label_str = "" 449 label_str = ""
441 if self.label: 450 if self.label:
442 label_str = "-L %s" % self.label 451 label_str = "-L %s" % self.label
443 452
444 mkfs_cmd = "mkfs.%s -F %s %s -U %s %s" % \ 453 mkfs_cmd = "mkfs.%s -F %s %s -U %s %s" % \
445 (self.fstype, extraopts, label_str, self.fsuuid, rootfs) 454 (self.fstype, extraopts, label_str, self.fsuuid, rootfs)
446 exec_native_cmd(mkfs_cmd, native_sysroot) 455 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
447 456
448 self.check_for_Y2038_problem(rootfs, native_sysroot) 457 self.check_for_Y2038_problem(rootfs, native_sysroot)
449 458
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 13a9cddf4e..7cc5131541 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -428,10 +428,10 @@ class BootimgEFIPlugin(SourcePlugin):
428 elif source_params['loader'] == 'uefi-kernel': 428 elif source_params['loader'] == 'uefi-kernel':
429 kernel = get_bitbake_var("KERNEL_IMAGETYPE") 429 kernel = get_bitbake_var("KERNEL_IMAGETYPE")
430 if not kernel: 430 if not kernel:
431 raise WicError("Empty KERNEL_IMAGETYPE %s\n" % target) 431 raise WicError("Empty KERNEL_IMAGETYPE")
432 target = get_bitbake_var("TARGET_SYS") 432 target = get_bitbake_var("TARGET_SYS")
433 if not target: 433 if not target:
434 raise WicError("Unknown arch (TARGET_SYS) %s\n" % target) 434 raise WicError("Empty TARGET_SYS")
435 435
436 if re.match("x86_64", target): 436 if re.match("x86_64", target):
437 kernel_efi_image = "bootx64.efi" 437 kernel_efi_image = "bootx64.efi"
diff --git a/scripts/makefile-getvar b/scripts/makefile-getvar
new file mode 100755
index 0000000000..4a07055e68
--- /dev/null
+++ b/scripts/makefile-getvar
@@ -0,0 +1,24 @@
1#! /bin/sh
2
3# Get a variable's value from a makefile:
4#
5# $ makefile-getvar Makefile VARIABLE VARIABLE ...
6#
7# If multiple variables are specified, they will be printed one per line.
8#
9# SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
10# SPDX-License-Identifier: GPL-2.0-only
11
12set -eu
13
14MAKEFILE=$1
15shift
16
17for VARIABLE in $*; do
18 make -f - $VARIABLE.var <<EOF
19include $MAKEFILE
20
21%.var:
22 @echo \$(\$*)
23EOF
24done
diff --git a/scripts/oe-build-perf-report b/scripts/oe-build-perf-report
index 266700d294..6c3c726ee3 100755
--- a/scripts/oe-build-perf-report
+++ b/scripts/oe-build-perf-report
@@ -336,10 +336,12 @@ def print_html_report(data, id_comp, buildstats):
336 test_i = test_data['tests'][test] 336 test_i = test_data['tests'][test]
337 meas_i = test_i['measurements'][meas] 337 meas_i = test_i['measurements'][meas]
338 commit_num = get_data_item(meta, 'layers.meta.commit_count') 338 commit_num = get_data_item(meta, 'layers.meta.commit_count')
339 commit = get_data_item(meta, 'layers.meta.commit')
339 # Add start_time for both test measurement types of sysres and disk usage 340 # Add start_time for both test measurement types of sysres and disk usage
340 start_time = test_i['start_time'][0] 341 start_time = test_i['start_time'][0]
341 samples.append(measurement_stats(meas_i, '', start_time)) 342 samples.append(measurement_stats(meas_i, '', start_time))
342 samples[-1]['commit_num'] = commit_num 343 samples[-1]['commit_num'] = commit_num
344 samples[-1]['commit'] = commit
343 345
344 absdiff = samples[-1]['val_cls'](samples[-1]['mean'] - samples[id_comp]['mean']) 346 absdiff = samples[-1]['val_cls'](samples[-1]['mean'] - samples[id_comp]['mean'])
345 reldiff = absdiff * 100 / samples[id_comp]['mean'] 347 reldiff = absdiff * 100 / samples[id_comp]['mean']