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.
15 SPDX_ID_STRING
="SPDX-License-Identifier"
19 if [[ -n "${scratch_file}" ]]; then
20 rm -f -- "${scratch_file}"
30 Usage: ${pname}: [top of cros EC repo]
32 Imports ec_commands.h and ec_cmd_api.h from the cros EC repo
33 and updates the copyright header for coreboot.
38 # Remove the original ChromiumOS copyright so we can insert the SPDX
39 # license identifier. Preserve the original number of lines in the file
40 # so embedded #line directives are correct.
45 local spdx
="/* ${SPDX_ID_STRING}: BSD-3-Clause */"
48 # replace existing copyright with empty lines
49 sed -i -e '/Copyright.*Chromium/,/^$/{s/^.*$//}' "${f}"
50 # now add the SPDX header
51 sed -i -e "1s@^\$@${spdx}@" "${f}"
61 if [[ ! -f "${ec_path}/${ec_file}" ]]; then
62 echo "${ec_path}/${ec_file} does not exist" 2>&1
66 scratch_file
=$
(mktemp
)
68 cp "${ec_path}/${ec_file}" "${scratch_file}"
70 update_copyright
"${scratch_file}"
71 cp "${scratch_file}" "${dst_path}"
73 rm -f "${scratch_file}"
76 log
=$
(git
-C "${ec_path}" log
--oneline -1 "${ec_file}")
77 echo "The original ${ec_file} version in the EC repo is:"
86 pname
=$
(basename "$0")
88 if [[ $# != 1 ]]; then
94 if [[ ! -d "${ec_path}" ]]; then
95 echo "${pname}: could not find ${ec_path}" 1>&2
99 coreboot_top
=$
(git rev-parse
--show-toplevel)
100 if [[ ! -d "${coreboot_top}" ]]; then
101 echo "${pname}: could not determine coreboot top" 1>&2
105 dst_path
="${coreboot_top}/src/ec/google/chromeec"
108 Suggested commit message:
110 Generated using ${pname} [EC-DIR].
114 get_file
"${ec_path}" include
/ec_commands.h
"${dst_path}/ec_commands.h"
115 get_file
"${ec_path}" include
/ec_cmd_api.h
"${dst_path}/ec_cmd_api.h"