Commit ec86cd7b authored by Guido Günther's avatar Guido Günther

Merge branch 'meta' into 'master'

Add checksum and size of the uncompressed image to the metadata

See merge request !73
parents d157866c 6b2652aa
Pipeline #3186 passed with stage
in 17 seconds
node {
gitUrl = 'https://source.puri.sm/Librem5/image-builder.git'
branch = 'master'
artifacts = "checksums,${params.board}.img.xz,tmp/*-report.log"
artifacts = "checksums,${params.board}.img.xz,tmp/*-report.log,files/meta.yml"
build_on_x86 = [ 'imx6', 'qemu-x86_64' ]
qcow2_builds = [ 'qemu-x86_64' ]
currentBuild.description = "${params.board} ${params.dist} ${build_type} image"
......
......@@ -68,6 +68,22 @@ setup_loop() {
return 0
}
write_meta() {
local out="$1"
local image="$2"
image_sha256sum=$(sha256sum "${image}" | sed 's/\([a-f0-9]\+\) .*/\1/')
image_size=$(stat --format='%s' "${image}")
echo "Image '${image} has sha256sum ${image_sha256sum}"
cat <<EOF >> "${out}"
gitrev: $(git log --format=format:%H -1)
image:
size: ${image_size}
sha256sum: ${image_sha256sum}
EOF
}
cwd=$(pwd)
distro=${DIST:-buster+ci}
......@@ -83,6 +99,7 @@ debootstrap_dist=
kernel_deb=
custom_package_opt=
board_packages=
meta_yml=files/meta.yml
while getopts ":hb:d:T:B" opt; do
case ${opt} in
......@@ -127,8 +144,7 @@ echo "Installing extra packages ${packages}"
[ -z "${board_packages}" ] || echo "Installing extra board specific packages ${board_packages}"
mkdir -p tmp/ files/
echo -n > files/meta.yml
rm -f "./tmp/${pureos_board}-report.log"
rm -f "./tmp/${pureos_board}-report.log" "${meta_yml}"
if [ "${build_type}" == "latest" ]; then
fetch_latest_kernel
......@@ -191,7 +207,6 @@ sudo pureos_board="${pureos_board}" \
${NULL}
set +x
echo "gitrev: $(git log --format=format:%H -1)" >> files/meta.yml
if [ "${arch}" == "arm64" ]; then
if [ ! -f "files/uboot-${uboot_type}/m4.bin" ]; then
......@@ -206,6 +221,8 @@ fi
[ -f "./tmp/${pureos_board}-report.log" ] || { echo "No install report found."; exit 1; }
write_meta "${meta_yml}" "${bootimg}"
if [ "${want_qcow2}" == 1 ]; then
qcow2="$(basename "${bootimg}" .img)".qcow2
qemu-img convert -f raw -O qcow2 "${bootimg}" "${qcow2}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment