A port of the Qualcomm Android bootctrl HAL for musl/glibc userspace.
Go to file
Caleb Connolly b8d2248914
add a flag to continue when ufs bsg device is missing
For some usecases it is desired to still update the GPT headers even if
the UFS BSG device is missing. Add a new flag which implements this
behaviour.

It isn't made the default because on some platforms this could result in
an unbootable device, there it's preferable to defer to the user by just
bailing out if the UFS BSG device is unavailable.

Signed-off-by: Caleb Connolly <caleb@connolly.tech>
2023-09-27 18:56:43 +01:00
.clang-format rework, fixup, cleanup 2023-06-23 21:53:30 +01:00
.gitignore gitignore: compile_commands.json 2023-05-15 20:25:59 +01:00
bootctrl_impl.c add a flag to continue when ufs bsg device is missing 2023-09-27 18:56:43 +01:00
bootctrl.h add a flag to continue when ufs bsg device is missing 2023-09-27 18:56:43 +01:00
crc32.c drop test stub, fix licenses 2023-06-24 01:38:14 +01:00
crc32.h drop test stub, fix licenses 2023-06-24 01:38:14 +01:00
gpt-utils.c add a flag to continue when ufs bsg device is missing 2023-09-27 18:56:43 +01:00
gpt-utils.h even even more rework, drop zlib dep 2023-06-24 01:04:15 +01:00
LICENSE drop test stub, fix licenses 2023-06-24 01:38:14 +01:00
meson.build meson.build: use gnu11 std instead of c11 2023-09-27 18:43:46 +01:00
qbootctl.c add a flag to continue when ufs bsg device is missing 2023-09-27 18:56:43 +01:00
README.md add a flag to continue when ufs bsg device is missing 2023-09-27 18:56:43 +01:00
ufs-bsg.c add a flag to continue when ufs bsg device is missing 2023-09-27 18:56:43 +01:00
ufs-bsg.h minor cleanups, improve error handling 2022-06-10 19:18:13 +01:00
utils.h rework, fixup, cleanup 2023-06-23 21:53:30 +01:00

Qualcomm bootctl HAL for Linux

This HAL was pulled from AOSP source code and bastardised to build and run on a musl/glibc system. This may or may not render any hardware you run it on unusable, you have been warned.

Dependencies

  • zlib-dev
  • meson
  • cmake
  • linux-headers

Building

qbootctl uses the meson build system

meson build
meson compile -C build

Usage

qbootctl: qcom bootctrl HAL port for Linux
-------------------------------------------
qbootctl [-c|-m|-s|-u|-b|-n|-x] [SLOT]

    <no args>        dump slot info (default)
    -h               this help text
    -c               get the current slot
    -b SLOT          check if SLOT is marked as bootable
    -n SLOT          check if SLOT is marked as successful
    -x [SLOT]        get the slot suffix for SLOT (default: current)
    -s SLOT          set to active slot to SLOT
    -m [SLOT]        mark a boot as successful (default: current)
    -u [SLOT]        mark SLOT as unbootable (default: current)
    -i               still write the GPT headers even if the UFS bLun can't be changed (default: false)

Debugging

Set DEBUG to 1 in utils.h to enable debug logging.

Documentation

A more details explanation and a list of devices where qbootctl has been validated can be found on the postmarketOS wiki: