Bifrost Documentation

repository·master·Indexed 23 days ago

https://github.com/zacharee/bifrost

A cross-platform Samsung firmware downloader and decrypter ported from Samloader to Kotlin Multiplatform. Available for Windows, macOS, Linux, Android, and iOS, it features a GUI for downloading device firmware using Country Specific Code (CSC) selection. The documentation covers installation, building from source using Conveyor and Android Studio, CSC database querying via CSCDB, and internal API models like DownloadModel and DecryptModel.

Tokens
2.9K
Snippets
3
Records
19
Agent score
81%

What's inside Bifrost

  1. Configure Fonts for Linux

    master

    To ensure the UI renders correctly on Linux, you must have at least one font family from each of the following categories installed:

    • Sans Serif: Noto Sans or DejaVu Sans
    • Serif: Noto Serif, DejaVu Serif, or Times New Roman
    • Monospace: Noto Sans Mono or DejaVu Sans Mono
    • Cursive: Comic Sans MS
  2. Build Bifrost from source

    master

    Prerequisites

    Build Desktop Binaries (using Conveyor)

    1. Install Conveyor.
    2. Run ./gradlew :desktop:build (or .ash.bat :desktop:build on Windows) in the project root.
    3. Use the conveyor command to package for your target:
    TargetCommand
    Windows (x86)conveyor -Kapp.machines=windows.amd64 make windows-zip
    Windows (ARM64)conveyor -Kapp.machines=windows.arm64 make windows-zip
    Debian (x86)conveyor -Kapp.machines=linux.amd64 make debian-package
    Debian (ARM64)conveyor -Kapp.machines=linux.arm64 make debian-package
    Linux (x86)conveyor -Kapp.machines=linux.amd64 make linux-tarball
    Linux (ARM64)conveyor -Kapp.machines=linux.arm64 make linux-tarball
    Intel Macconveyor -Kapp.machines=mac.amd64 make unnotarized-mac-zip
    Apple Silicon Macconveyor -Kapp.machines=mac.arm64 make unnotarized-mac-zip

    Binaries will be located in the output folder.

    Build Android APK

    Via Command Line:

    ./gradlew :android:build

    (On Windows, use gradlew :android:build). The resulting APK will be in android/build/outputs/apk/debug.

    Via Android Studio GUI:

    1. Open the Gradle view.
    2. Expand android $\rightarrow$ Tasks $\rightarrow$ build.
    3. Double-click build.
    4. Find the APK in android/build/outputs/apk/debug.
    # Example: Building for Windows x86 via Conveyor
    ./gradlew :desktop:build
    conveyor -Kapp.machines=windows.amd64 make windows-zip
  3. Download and Install Bifrost

    master

    Bifrost is a cross-platform Samsung firmware downloader available for Windows, macOS, Linux, Android, and iOS.

    Desktop Downloads

    • Windows: Download the .zip matching your architecture (windows-amd64 for Intel/AMD or windows-aarch64 for ARM64) from bifrost.zwander.dev or the Releases page.
    • macOS: Download the .zip matching your architecture (mac-amd64 for Intel or mac-aarch64 for Apple Silicon).
    • Linux: Download the .deb file for Debian-based systems or the .tar.gz file for other distributions. Choose the amd64 variant for Intel/AMD or arm64/aarch64 for ARM64.

    Mobile Downloads

    • Android: Download and install the bifrost_android_<VERSION>.apk.
    • iOS: Sign up for the TestFlight version here.
  4. How to find your device's CSC

    master

    The CSC (Country Specific Code) is required for downloading firmware. To find yours on a Samsung device:

    1. Open Settings.
    2. Tap About phone (or About tablet).
    3. Tap Software information.
    4. Look at Service provider software version.

    The first three letters on the second line represent your current CSC. The last three letters represent the original/firmware CSC.

    Example: XAA/XAA,XAA/XAU/TMB $\rightarrow$ Current CSC: XAA, Firmware CSC: TMB.

  5. How transparency effects are calculated

    master

    The application determines if transparency effects should be applied by combining the useMicaEffect and useVibrancyEffect settings. If either setting is true, useTransparencyEffects will emit true.

    // Returns a Flow<Boolean> that is true if either Mica or Vibrancy is enabled
    val useTransparencyEffects: Flow<Boolean>
        get() = combine(Keys.useMicaEffect.asMutableStateFlow(), Keys.useVibrancyEffect.asMutableStateFlow()) { m, v -> m || v }
  6. Troubleshoot Bifrost errors

    master

    Common Errors

    • Error 400/401 (Downloading): These are Samsung server-side errors. Try using a different region or CSC.
    • Error 403 (Checking for updates): Samsung may no longer serve firmware for your device or hasn't started yet. Verify your model number and try a different region/CSC.
    • Blank screen on Windows: This is often a GPU rendering issue with Jetpack Compose/Skia. Try running the program as an administrator or switching to a different GPU if you have switchable graphics.
    • Slow download speeds: Samsung servers may throttle downloads to ~3MiB/s. Different regions/CSCs may offer faster speeds.
    • Antivirus Flags: Bifrost may be flagged as a false positive due to a name collision with a Windows malware family named 'Bifrost'.
  7. Filter reportable response codes using isReportableCode()

    master

    The FetchResult base class provides a utility method isReportableCode() to determine if a responseCode should be treated as an error that needs reporting.

    By default, the following codes are considered ignoredCodes and will return false when calling isReportableCode():

    • 408
    • F01

    If the responseCode is not in this list, the method returns true.

  8. Sort CSC items using SortBy

    master

    When working with CSCItem lists, you can use the SortBy sealed class hierarchy to define sorting logic. The SortBy classes provide a sortKey function used to determine the sort order.

    Supported sorting types:

    • SortBy.Code(ascending: Boolean): Sorts by the CSC code.
    • SortBy.Country(ascending: Boolean): Sorts by the resolved country name.
    • SortBy.Carrier(ascending: Boolean): Sorts by the carrier name (if present).
  9. Query the CSC database using CSCDB

    master

    The CSCDB object provides methods to search for Samsung Country Specific Code (CSC) items based on different criteria. It automatically initializes by loading a local CSV resource and attempting to fetch an updated list from a remote GitHub endpoint.

    Available query methods:

    • getAll(): Returns all available CSCItem objects as a list.
    • findForCountryQuery(query: String): Filters items where the country name (resolved from the country code) contains the query string (case-insensitive).
    • findForCscQuery(query: String): Filters items where the CSC code contains the query string (case-insensitive).
    • findForCarrierQuery(query: String): Filters items where any of the associated carrier names contain the query string (case-insensitive).
    • findForGeneralQuery(query: String, items: Set<CSCItem> = this._items.value): A broad search that checks country names, CSC codes, and carrier names simultaneously.