Skip to content

Commit 755117d

Browse files
committed
build: introduce OUTPUT_TARBALL_FILELIST=yes to include LK's --format tar output and its filelist
- useful during development for: - debugging esoteric issue with file permissions - checking the space usage distribution, so we can slim down where needed Signed-off-by: Ricardo Pardini <[email protected]>
1 parent 672a521 commit 755117d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

bash/linuxkit.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,19 @@ function linuxkit_build() {
8484
declare -a lk_args=(
8585
"--docker"
8686
"--arch" "${kernel_info['DOCKER_ARCH']}"
87-
"--format" "kernel+initrd"
8887
"--name" "hook"
8988
"--cache" "${lk_cache_dir}"
9089
"--dir" "${lk_output_dir}"
9190
"hook.${inventory_id}.yaml" # the linuxkit configuration file
9291
)
9392

93+
if [[ "${OUTPUT_TARBALL_FILELIST:-"no"}" == "yes" ]]; then
94+
log info "OUTPUT_TARBALL_FILELIST=yes; Building Hook (tar/filelist) with kernel ${inventory_id} using linuxkit: ${lk_args[*]}"
95+
"${linuxkit_bin}" build "--format" "tar" "${lk_args[@]}"
96+
fi
97+
9498
log info "Building Hook with kernel ${inventory_id} using linuxkit: ${lk_args[*]}"
95-
"${linuxkit_bin}" build "${lk_args[@]}"
99+
"${linuxkit_bin}" build "--format" "kernel+initrd" "${lk_args[@]}"
96100

97101
if [[ "${LK_RUN}" == "qemu" ]]; then
98102
linuxkit_run_qemu
@@ -137,6 +141,13 @@ function linuxkit_build() {
137141
rm -rf "${dtbs_tmp_dir}"
138142
rm "${lk_output_dir}/dtbs-${OUTPUT_ID}.tar.gz"
139143

144+
if [[ "${OUTPUT_TARBALL_FILELIST:-"no"}" == "yes" ]]; then
145+
log info "OUTPUT_TARBALL_FILELIST=yes; including tar and filelist in output."
146+
mv -v "${lk_output_dir}/hook.tar" "out/hook/hook_rootfs_${OUTPUT_ID}.tar"
147+
tar --list -vf "out/hook/hook_rootfs_${OUTPUT_ID}.tar" > "out/hook/hook_rootfs_${OUTPUT_ID}.filelist"
148+
fi
149+
150+
# finally clean up the hook-specific out dir
140151
rm -rf "${lk_output_dir}"
141152

142153
# tar the files into out/hook.tar in such a way that vmlinuz and initramfs are at the root of the tar; pigz it

0 commit comments

Comments
 (0)