summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.lib23
-rwxr-xr-xscripts/build-efi.sh16
-rwxr-xr-xscripts/checkpatch.pl6
-rwxr-xr-xscripts/event_dump.py2
-rwxr-xr-xscripts/make_pip.sh117
5 files changed, 156 insertions, 8 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index ac45a884785..7b27224b5d4 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -585,24 +585,35 @@ cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \
# ---------------------------------------------------------------------------
# Pass the original device tree file through fdtgrep twice. The first pass
# removes any unwanted nodes (i.e. those which don't have the
-# 'u-boot,dm-pre-reloc' property and thus are not needed by SPL. The second
+# 'bootph-all' property and thus are not needed by SPL. The second
# pass removes various unused properties from the remaining nodes.
# The output is typically a much smaller device tree file.
+
+ifdef CONFIG_OF_TAG_MIGRATE
+# Support the old tags for a migration period
+migrate_tpl := -b u-boot,dm-pre-reloc -b u-boot,dm-tpl
+migrate_vpl := -b u-boot,dm-pre-reloc -b u-boot,dm-vpl
+migrate_spl := -b u-boot,dm-pre-reloc -b u-boot,dm-spl
+migrate_all := -P u-boot,dm-pre-reloc \
+ -P u-boot,dm-spl -P u-boot,dm-tpl -P u-boot,dm-vpl
+endif
+
ifeq ($(CONFIG_VPL_BUILD),y)
-fdtgrep_props := -b u-boot,dm-pre-reloc -b u-boot,dm-vpl
+fdtgrep_props := -b bootph-all -b bootph-verify $(migrate_vpl)
else
ifeq ($(CONFIG_TPL_BUILD),y)
-fdtgrep_props := -b u-boot,dm-pre-reloc -b u-boot,dm-tpl
+fdtgrep_props := -b bootph-all -b bootph-pre-sram $(migrate_tpl)
else
-fdtgrep_props := -b u-boot,dm-pre-reloc -b u-boot,dm-spl
+fdtgrep_props := -b bootph-all -b bootph-pre-ram $(migrate_spl)
endif
endif
quiet_cmd_fdtgrep = FDTGREP $@
cmd_fdtgrep = $(objtree)/tools/fdtgrep $(fdtgrep_props) -RT $< \
-n /chosen -n /config -O dtb | \
$(objtree)/tools/fdtgrep -r -O dtb - -o $@ \
- -P u-boot,dm-pre-reloc -P u-boot,dm-spl -P u-boot,dm-tpl \
- -P u-boot,dm-vpl \
+ -P bootph-all -P bootph-pre-ram -P bootph-pre-sram \
+ -P bootph-verify \
+ $(migrate_all) \
$(addprefix -P ,$(subst $\",,$(CONFIG_OF_SPL_REMOVE_PROPS)))
# fdt_rm_props
diff --git a/scripts/build-efi.sh b/scripts/build-efi.sh
index bc9aeebbf4f..6b7df2e9bfe 100755
--- a/scripts/build-efi.sh
+++ b/scripts/build-efi.sh
@@ -18,12 +18,15 @@
# OVMF-pure-efi.x64.fd at
# https://drive.google.com/file/d/1c39YI9QtpByGQ4V0UNNQtGqttEzS-eFV/view?usp=sharing
+bzimage_fname=/tmp/kernel/arch/x86/boot/bzImage
+
set -e
usage() {
echo "Usage: $0 [-a | -p] [other opts]" 1>&2
echo 1>&2
echo " -a - Package up the app" 1>&2
+ echo " -k - Add a kernel" 1>&2
echo " -o - Use old EFI app build (before 32/64 split)" 1>&2
echo " -p - Package up the payload" 1>&2
echo " -P - Create a partition table" 1>&2
@@ -52,11 +55,14 @@ serial=
# before the 32/64 split of the app
old=
+# package up a kernel as well
+kernel=
+
# Set ubdir to the build directory where you build U-Boot out-of-tree
# We avoid in-tree build because it gets confusing trying different builds
ubdir=/tmp/b/
-while getopts "aopPrsw" opt; do
+while getopts "akopPrsw" opt; do
case "${opt}" in
a)
type=app
@@ -64,6 +70,9 @@ while getopts "aopPrsw" opt; do
p)
type=payload
;;
+ k)
+ kernel=1
+ ;;
r)
run=1
;;
@@ -96,6 +105,8 @@ run_qemu() {
fi
if [[ -n "${serial}" ]]; then
extra="-display none -serial mon:stdio"
+ else
+ extra="-serial mon:stdio"
fi
echo "Running ${qemu}"
# Use 512MB since U-Boot EFI likes to have 256MB to play with
@@ -122,6 +133,9 @@ EOF
# Copy files into the filesystem
copy_files() {
sudo cp $TMP/* $MNT
+ if [[ -n "${kernel}" ]]; then
+ sudo cp ${bzimage_fname} $MNT/vmlinuz
+ fi
}
# Create a filesystem on a raw device and copy in the files
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index ccfcbb3e125..62b764f6c38 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2680,6 +2680,12 @@ sub u_boot_line {
"DEVICE_PRIV_AUTO", $herecurr);
u_boot_struct_name($line, "per_device_plat_auto", "_plat",
"DEVICE_PLAT_AUTO", $herecurr);
+
+ # Avoid using the pre-schema driver model tags
+ if ($line =~ /^\+.*u-boot,dm-.*/) {
+ ERROR("PRE_SCHEMA",
+ "Driver model schema uses 'bootph-...' tags now\n" . $herecurr);
+ }
}
sub exclude_global_initialisers {
diff --git a/scripts/event_dump.py b/scripts/event_dump.py
index d87823f3749..0117457526e 100755
--- a/scripts/event_dump.py
+++ b/scripts/event_dump.py
@@ -15,7 +15,7 @@ src_path = os.path.dirname(our_path)
sys.path.insert(1, os.path.join(our_path, '../tools'))
from binman import elf
-from patman import tools
+from u_boot_pylib import tools
# A typical symbol looks like this:
# _u_boot_list_2_evspy_info_2_EVT_MISC_INIT_F_3_sandbox_misc_init_f
diff --git a/scripts/make_pip.sh b/scripts/make_pip.sh
new file mode 100755
index 00000000000..4602dcf61c8
--- /dev/null
+++ b/scripts/make_pip.sh
@@ -0,0 +1,117 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+
+# Packages a U-Boot tool
+#
+# Usage: make_pip.sh <tool_name> [--real]
+#
+# Where tool_name is one of patman, buildman, dtoc, binman, u_boot_pylib
+#
+# and --real means to upload to the real server (otherwise the test one is used)
+#
+# The username for upload is always __token__ so set TWINE_PASSWORD to your
+# password before running this script:
+#
+# export TWINE_PASSWORD=pypi-xxx
+#
+# To test your new packages:
+#
+# pip install -i https://test.pypi.org/simple/ <tool_name>
+#
+
+# DO NOT use patman or binman
+
+set -xe
+
+# Repo to upload to
+repo="--repository testpypi"
+
+# Non-empty to do the actual upload
+upload=1
+
+tool="$1"
+shift
+flags="$*"
+
+if [[ "${tool}" =~ ^(patman|buildman|dtoc|binman|u_boot_pylib)$ ]]; then
+ echo "Building dist package for tool ${tool}"
+else
+ echo "Unknown tool ${tool}: use patman, buildman, dtoc or binman"
+ exit 1
+fi
+
+for flag in "${flags}"; do
+ if [ "${flag}" == "--real" ]; then
+ echo "Using real server"
+ repo=
+ fi
+ if [ "${flag}" == "-n" ]; then
+ echo "Doing dry run"
+ upload=
+ fi
+done
+
+if [ -n "${upload}" ]; then
+ if [ -z "${TWINE_PASSWORD}" ]; then
+ echo "Please set TWINE_PASSWORD to your password and retry"
+ exit 1
+ fi
+fi
+
+# Create a temp dir to work in
+dir=$(mktemp -d)
+
+# Copy in some basic files
+cp -v tools/${tool}/pyproject.toml ${dir}
+cp -v Licenses/gpl-2.0.txt ${dir}/LICENSE
+readme="tools/${tool}/README.*"
+
+# Copy in the README, dropping some Sphinx constructs that PyPi doesn't like
+cat ${readme} | sed -E 's/:(doc|ref):`.*`//; /sectionauthor/d; /toctree::/d' \
+ > ${dir}/$(basename ${readme})
+
+# Copy the top-level Python and doc files
+dest=${dir}/src/${tool}
+mkdir -p ${dest}
+cp -v tools/$tool/{*.py,*.rst} ${dest}
+
+# Copy over the subdirectories, including any sub files. Drop any cache files
+# and other such things
+pushd tools/${tool}
+for subdir in $(find . -maxdepth 1 -type d | \
+ grep -vE "(__pycache__|home|usr|scratch|\.$|pyproject)"); do
+ pathname="${dest}/${subdir}"
+ echo "Copy ${pathname}"
+ cp -a ${subdir} ${pathname}
+done
+popd
+
+# Remove cache files that accidentally made it through
+find ${dest} -name __pycache__ -type f -exec rm {} \;
+find ${dest} -depth -name __pycache__ -exec rmdir 112 \;
+
+# Remove test files
+rm -rf ${dest}/*test*
+
+mkdir ${dir}/tests
+cd ${dir}
+
+# Make sure the tools are up to date
+python3 -m pip install --upgrade build
+python3 -m pip install --upgrade twine
+
+# Build the PyPi package
+python3 -m build
+
+echo "Completed build of ${tool}"
+
+# Use --skip-existing to work even if the version is already present
+if [ -n "${upload}" ]; then
+ echo "Uploading from ${dir}"
+ python3 -m twine upload ${repo} -u __token__ dist/*
+ echo "Completed upload of ${tool}"
+fi
+
+rm -rf "${dir}"
+
+echo -e "done\n\n"