arch/arm/boot64: Check fit_decompress() return value

When the kernel format is incorrect, decompression functions such as
ulz4ln() usually silently return 0 directly due to magic mismatch.
Currently the return value of the first fit_decompress() call for
scratch buffer isn't checked. Therefore, when the kernel format is
wrong, we will see a misleading error message:

 ERROR: Invalid kernel magic: 0xf1204be8 != 0x644d5241

Add a return value check and print a more accurate error message on
decompression failure.

Also initialize the scratch to zero, and fix the extra newline in an
error log.

BUG=none
TEST=emerge-rauru depthcharge
BRANCH=none

Change-Id: Ie89ebaa282a85f94d4b88a09e49ab0f94ba9a4f5
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/depthcharge/+/7544822
Reviewed-by: Yidi Lin <yidilin@google.com>
Commit-Queue: Yidi Lin <yidilin@google.com>
1 file changed
tree: 6c45a4b1845dbc0ada991fda3b34a5d6d20c3d1c
  1. configs/
  2. screenshot/
  3. src/
  4. tests/
  5. util/
  6. .checkpatch.conf
  7. .clang-format
  8. .gitignore
  9. COPYING
  10. Kconfig
  11. LICENSE
  12. Makefile
  13. Makefile.inc
  14. OWNERS
  15. PRESUBMIT.cfg
  16. PRESUBMIT.py
  17. README.md
  18. unblocked_terms.txt
README.md

Depthcharge

Depthcharge is a bootloader for ChromeOS devices. It is responsible for initializing hardware, setting up the boot environment, and loading the operating system.

Key Features

  • Hardware Initialization: Initializes and configures the system's hardware components, including memory, storage, and peripherals.
  • Boot Environment Setup: Sets up the necessary environment for the operating system to boot, including memory, storage, and other peripherals.
  • Booting the Operating System: Loads and executes the operating system kernel.
  • Security Features: Implements various security features, such as secure boot and verified boot, using the vboot library.

Project Structure

  • src/: Contains the source code for the depthcharge bootloader.
  • board/: Contains the board-specific configuration files.
  • src/drivers/: Contains the device drivers.

Build Instructions

To build depthcharge, you will need a ChromeOS development environment. Within the chroot:

emerge-$BOARD sys-boot/depthcharge

Remember to build it before you build `chromeos-bootimage`!