Files
android_vendor_pawlet/hal/boot_control/rpi/service.cpp
T
oxmc 9344e608f6 Initial commit: PawletOS vendor tree
Adds the full vendor/pawlet tree for PawletOS on Raspberry Pi 4/5:

- build/: envsetup.sh helpers (breakfast/brunch/mka), bacon OTA target,
  Soong namespace, build core hook
- config/: common.mk, version.mk, BoardConfigPawlet.mk, BoardConfigSoong.mk,
  privapp-permissions, me.pawlet.android feature XML
- hal/boot_control/rpi/: AIDL boot_control HAL for RPi A/B slot switching
- apps/Updater/: A/B OTA updater (download, verify, install, reboot)
- apps/PawletPlatform/: platform resource APK (device icons, strings)
- overlay/frameworks/base/core/res/: framework config overrides
- prebuilt/, vars/: init rc, aosp_target_release
2026-03-21 19:08:46 -07:00

49 lines
1.6 KiB
C++

/*
* Copyright (C) The Android Open Source Project
* Copyright (C) 2025 oxmc / PawletOS
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include "BootControl.h"
using aidl::android::hardware::boot::BootControl;
using aidl::android::hardware::boot::IBootControl;
// Block device paths — resolved at runtime via the GPT "by-name" symlinks
// that ueventd creates from the partition labels set by mkimg.sh / sgdisk.
static constexpr const char* kMiscDevice = "/dev/block/by-name/misc";
static constexpr const char* kBootADevice = "/dev/block/by-name/boot_a";
static constexpr const char* kBootBDevice = "/dev/block/by-name/boot_b";
int main() {
android::base::InitLogging(nullptr, android::base::KernelLogger);
// Single-threaded is sufficient — update_engine calls are serialised.
ABinderProcess_setThreadPoolMaxThreadCount(0);
auto bc = ndk::SharedRefBase::make<BootControl>(
kMiscDevice, kBootADevice, kBootBDevice);
const std::string instance =
std::string(IBootControl::descriptor) + "/default";
binder_status_t status =
AServiceManager_addService(bc->asBinder().get(), instance.c_str());
if (status != STATUS_OK) {
LOG(FATAL) << "Failed to register " << instance
<< " (binder status=" << status << ")";
return 1;
}
LOG(INFO) << "PawletOS boot_control HAL ready: " << instance;
ABinderProcess_joinThreadPool();
// joinThreadPool only returns on a fatal error.
return EXIT_FAILURE;
}