[Samsung Galaxy A32 5G] Sands207:
Has any one made any progress regarding the missing oem unlock? I know what parameters to add to our kernel v1 to v3 during building to enable oem unlock and add access to fastbootd. Because of project treble our options have changed.

Sources:

Moving Fastboot to Userspace | Android Open Source Project

source.android.com

Lock and unlock the bootloader | Android Open Source Project

source.android.com

Sign in

DOCUMENTATION

Docs

More

Getting Started

Security

Core Topics

Compatibility

Android Devices

Reference

GO TO CODE ➚

Overview

Architecture

Overview

Hardware Abstraction Layer (HAL)

Kernel

HIDL (General)

HIDL (C++)

HIDL (Java)

Configuration

Device Tree Overlays

Vendor NDK

Vendor Interface Object

AIDL

Bootloader

Overview

Boot Reason

Boot Image Header

Implementing Bootconfig

Recovery Images

DTB Images

Supporting OTA Updates

Locking and Unlocking the Bootloader

Version Information in AVB Properties

Fastboot in Userspace

Partitions

Audio

Camera

Connectivity

Data

Display

Fonts

Graphics

Interaction

Media

Performance

Permissions

Power

Runtime

Settings

Storage

Virtualization

Tests

Updates

AOSP

Docs

Core Topics

Was this helpful?

Locking/Unlocking the Bootloader​

bookmark_border

On this page

Unlocking the bootloader

Locking the bootloader

Setting lock/unlock properties

Protecting critical sections

By default, most Android devices ship with a locked bootloader, meaning that users can't flash the bootloader or device partitions. If needed, you (and device users with Developer options enabled) can unlock the bootloader to flash new images.

Unlocking the bootloader​

To unlock the bootloader and enable partitions to be reflashed, run the fastboot flashing unlock command on the device. After setting, the unlock mode persists across reboots.

Devices should deny the fastboot flashing unlock command unless the get_unlock_ability is set to 1. If set to 0, the user needs to boot to the home screen, open the Settings > System > Developer options menu and enable the OEM unlocking option (which sets the get_unlock_ability to 1). After setting, this mode persists across reboots and factory data resets.

When the fastboot flashing unlock command is sent, the device should prompt users to warn them that they might encounter problems with unofficial images. After the user acknowledges the warning, the device should perform a factory data reset to prevent unauthorized data access. The bootloader should reset the device even if it can't reformat it properly. Only after a reset can the persistent flag be set so that the device can be reflashed.

All RAM not already overwritten should be reset during the fastboot flashing unlock process. This measure prevents attacks that read leftover RAM contents from the previous boot. Similarly, unlocked devices should clear RAM at every boot (unless this creates an unacceptable delay), but should leave the region used for the kernel's ramoops.

Locking the bootloader​

To lock the bootloader and reset the device, run the fastboot flashing lock command on the device. Devices intended for retail should be shipped in the locked state (with get_unlock_ability returning 0) to ensure that attackers can't compromise the device by installing a new system or boot image.

Setting lock/unlock properties​

The ro.oem_unlock_supported property should be set at build time based on whether the device supports flashing unlock.

If the device supports flashing unlock, set ro.oem_unlock_supported to 1.

If the device doesn't support flashing unlock, set ro.oem_unlock_supported to 0.

If the device supports flashing unlock, then the bootloader should indicate the lock status by setting the kernel command line variable androidboot.flash.locked to 1 if locked or to 0 if unlocked. This variable must be set in bootconfig instead of in the kernel command line in Android 12.

For devices that support dm-verity, use ro.boot.verifiedbootstate to set the value of ro.boot.flash.locked to 0; this unlocks the bootloader if the verified boot state is orange.