2 # SPDX-License-Identifier: GPL-2.0-only
3 # ${VERSION_NAME}: new version name
4 # ${COMMIT_ID}: commit id for new version
5 # ${USERNAME}: username (if not default to https)
6 # ${GPG_KEY_ID}: gpg key id (if not don't sign)
14 TIME_FILE
="$(mktemp -d)/.coreboot-time"
15 COREBOOT_RELEASE_NAME
=coreboot-
${VERSION_NAME}
16 COREBOOT_TARBALL
="${COREBOOT_RELEASE_NAME}.tar.xz"
17 COREBOOT_BLOBS_TARBALL
="coreboot-blobs-${VERSION_NAME}.tar.xz"
19 if [ -z "$GPG_TTY" ]; then
24 # set local + tz to be reproducible
30 if [ -z "${VERSION_NAME}" ] || [ "${VERSION_NAME}" = "--help" ] || [ -z "${COMMIT_ID}" ]; then
31 echo "usage: $0 <version> <commit id> [username] [gpg key id]"
32 echo "Tags a new coreboot version and creates a tar archive"
34 echo "version: New version name to tag the tree with"
35 echo "commit id: check out this commit-id after cloning the coreboot tree"
36 echo "username: clone the tree using ssh://USERNAME - defaults to https://"
37 echo "gpg key id: used to tag the version, and generate a gpg signature"
45 if [ -n "$text" ]; then
48 read -r -p "Press [Enter] key to continue..."
51 # Verify that tar supports --sort
52 if ! tar --sort=name
-cf /dev
/null
/dev
/null
2>/dev
/null
; then
53 echo "Error: The installed version of tar does not support --sort"
54 echo " GNU tar version 1.28 or greater is required. Exiting."
58 # Clone new copy of repo if needed
59 if [ ! -d "${COREBOOT_RELEASE_NAME}/.git" ]; then
60 rm -rf "${COREBOOT_RELEASE_NAME}"
61 declare -a GIT_REF_OPTS
63 GIT_REF_OPTS
=("--reference" "." "--dissociate")
64 elif [ -d ..
/..
/.git
]; then
65 GIT_REF_OPTS
=("--reference" "../.." "--dissociate")
67 if [ -n "${USERNAME}" ]; then
68 git clone
"${GIT_REF_OPTS[@]}" "ssh://${USERNAME}@review.coreboot.org:29418/coreboot.git" "${COREBOOT_RELEASE_NAME}" --
70 git clone
"${GIT_REF_OPTS[@]}" https
://review.coreboot.org
/coreboot.git
"${COREBOOT_RELEASE_NAME}" --
74 # Handle everything that needs to be done from inside the new coreboot
75 # directory. Use requested version, update submodules, and get ready to
76 # run from outside a git repository, and create a signed tag to push.
78 cd "${COREBOOT_RELEASE_NAME}" ||
exit 1
79 git
reset --hard "${COMMIT_ID}"
81 util
/crossgcc
/buildgcc
-W > .crossgcc-version
83 if [ -n "${GPG_KEY_ID}" ]; then
84 pause
"The next step will need your PGP key's passphrase, so be ready."
85 git tag
-a -s -u "$GPG_KEY_ID" --force "${VERSION_NAME}" -m "coreboot version ${VERSION_NAME}" --
87 git tag
-a --force "${VERSION_NAME}" -m "coreboot version ${VERSION_NAME}" --
90 git submodule update
--init --checkout
92 printf "%s-%s\n" "$VERSION_NAME" "$(git log --pretty=%h -1)" > .coreboot-version
93 printf "%s\n" "$(git log --pretty=format:%ci -1)" > "${TIME_FILE}"
95 tstamp
=$
(cat "${TIME_FILE}" |
sed 's/ +0000//')
97 # Create the two tarballs, source and blobs.
98 exclude_paths
="3rdparty/blobs 3rdparty/fsp 3rdparty/intel-microcode 3rdparty/amd_blobs 3rdparty/qc_blobs"
100 declare -a blobs_paths
101 declare -a exclude_opts
102 for i
in ${exclude_paths}; do
103 blobs_paths
+=("${COREBOOT_RELEASE_NAME}/${i}")
104 exclude_opts
+=("--exclude=${COREBOOT_RELEASE_NAME}/${i}")
107 tar --sort=name
--mtime="${tstamp}" --owner=coreboot:1000 --group=coreboot:1000 --exclude=*/.git --exclude=*/.gitignore --exclude=*/.gitreview --exclude=*/.mailmap --exclude=*/.gitmodules "${exclude_opts[@]}" -cvf - "${COREBOOT_RELEASE_NAME}" |xz -9 > "${COREBOOT_TARBALL}"
108 tar --sort=name
--mtime="${tstamp}" --owner=coreboot:1000 --group=coreboot:1000 --exclude=*/.git --exclude=*/.gitignore --exclude=*/.gitreview --exclude=*/.mailmap --exclude=*/.gitmodules -cvf - "${blobs_paths[@]}" |xz -9 > "${COREBOOT_BLOBS_TARBALL}"
111 if [ -n "${GPG_KEY_ID}" ]; then
112 gpg
--armor --local-user "$GPG_KEY_ID" --output "${COREBOOT_TARBALL}.sig" --detach-sig "${COREBOOT_TARBALL}"
113 gpg
--armor --local-user "$GPG_KEY_ID" --output "${COREBOOT_BLOBS_TARBALL}.sig" --detach-sig "${COREBOOT_BLOBS_TARBALL}"