blob: 5bbedb3c2f95378962ca0f8c54c9db96fe32c79c [file] [log] [blame]
// Copyright 2020 The Fuchsia Authors
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file or at
#include <asm.h>
// This header is generated from the symbol table of the linked kernel.
// It defines VERSION_STRING_OFFSET and VERSION_STRING_SIZE, which are the
// bounds of the embedded version string variable inside the kernel image.
#include "kernel-image.h"
// This header defines VERSION_STRING_FILE for use below. It also defines
// VERSION_STRING_SIZE, not to the size of the file but to the maximum size to
// be allocated at compile time. This better match what kernel-image.h has
// extracted from the kernel symbol table, or something went wrong. That
// mismatch will cause a non-identical re-#define error at compile time.
#include <lib/version/version-string.h>
// Pad out to the header size that was allocated in the kernel image layout.
// This ensures that the kernel image is aligned correctly in memory.
// Crack the kernel image in half around the version string and replace the
// wafer-thin layer in the middle with the contents of the separate version
// string file, which can change independently of the kernel image itself.
// Exactly VERSION_STRING_SIZE bytes are to be replaced in the image.
// The replaced bytes must end with a NUL terminator.
.byte 0
// If it's smaller, pad the difference with more NULs.
.space VERSION_STRING_SIZE - (1b - 0b)
// The second half of the kernel image skips the compile-time embedded string.