3 # SPDX-License-Identifier: GPL-2.0-only
6 # Imports ec_commands.h and ec_cmd_api.h from the cros EC repo
7 # and updates the copyright header for coreboot.
18 if [[ -n "${scratch_file}" ]]; then
19 rm -f -- "${scratch_file}"
29 Usage: ${pname}: [top of cros EC repo]
31 Imports ec_commands.h and ec_cmd_api.h from the cros EC repo
32 and updates the copyright header for coreboot.
37 # Remove the original ChromiumOS copyright so we can insert the SPDX
38 # license identifier. Preserve the original number of lines in the file
39 # so embedded #line directives are correct.
44 local spdx
='/* SPDX-License-Identifier: BSD-3-Clause */'
47 # replace existing copyright with empty lines
48 sed -i -e '/Copyright.*Chromium/,/^$/{s/^.*$//}' "${f}"
49 # now add the SPDX header
50 sed -i -e "1s@^\$@${spdx}@" "${f}"
60 if [[ ! -f "${ec_path}/${ec_file}" ]]; then
61 echo "${ec_path}/${ec_file} does not exist" 2>&1
65 scratch_file
=$
(mktemp
)
67 cp "${ec_path}/${ec_file}" "${scratch_file}"
69 update_copyright
"${scratch_file}"
70 cp "${scratch_file}" "${dst_path}"
72 rm -f "${scratch_file}"
75 log
=$
(git
-C "${ec_path}" log
--oneline -1 "${ec_file}")
76 echo "The original ${ec_file} version in the EC repo is:"
85 pname
=$
(basename "$0")
87 if [[ $# != 1 ]]; then
93 if [[ ! -d "${ec_path}" ]]; then
94 echo "${pname}: could not find ${ec_path}" 1>&2
98 coreboot_top
=$
(git rev-parse
--show-toplevel)
99 if [[ ! -d "${coreboot_top}" ]]; then
100 echo "${pname}: could not determine coreboot top" 1>&2
104 dst_path
="${coreboot_top}/src/ec/google/chromeec"
107 Suggested commit message:
109 Generated using ${pname} [EC-DIR].
113 get_file
"${ec_path}" include
/ec_commands.h
"${dst_path}/ec_commands.h"
114 get_file
"${ec_path}" include
/ec_cmd_api.h
"${dst_path}/ec_cmd_api.h"