Skip to content

Instantly share code, notes, and snippets.

@wendimust
Created June 28, 2025 09:07
Show Gist options
  • Select an option

  • Save wendimust/0fb7c71cf6da0bb44a018f7eba356c83 to your computer and use it in GitHub Desktop.

Select an option

Save wendimust/0fb7c71cf6da0bb44a018f7eba356c83 to your computer and use it in GitHub Desktop.
How to flash Samsung devices using a Linux machine

📱 Flash Samsung Firmware on Linux (Ubuntu 24.04+) Using Heimdall

A complete step-by-step guide to flashing Samsung firmware using Linux and the open-source Odin alternative: Heimdall.


🧰 Requirements

  • A Samsung smartphone or tablet
  • A Linux distro (tested on Ubuntu 24.04)
  • A USB cable (preferably original)
  • Downloaded Samsung firmware (from SamMobile, SamFW, etc.)
  • heimdall installed

🛠️ Step 1: Install Heimdall

Install via APT:

sudo apt update
sudo apt install heimdall-flash

Verify installation:

heimdall version

If you get APT lock errors (e.g., packagekitd holding lock), run:

sudo killall packagekitd

⚡ Step 2: Boot Samsung Device into Download Mode

Use one of these combinations (device dependent):

Device Type Button Combo
Older (w/ Bixby) Vol Down + Bixby + Power
Newer (no Bixby) Vol Down + Vol Up (then connect USB)
One UI 6+ Devices Vol Down + Vol Up + USB cable

Then press Vol Up to enter Download Mode.


🔌 Step 3: Verify Connection

Connect your device via USB and run:

sudo heimdall detect

Expected output:

Device detected

If not, check:

  • USB cable/port
  • USB debugging / driver issues
  • That you're really in Download Mode

📦 Step 4: Extract Firmware Files

Extract .tar.md5 firmware:

7z x firmware.tar.md5

This should give you .img files like:

  • boot.img
  • recovery.img
  • vbmeta.img
  • super.img
  • userdata.img

You do not flash .tar.md5 directly with Heimdall.


🔍 Step 5: List Valid Partitions

Get the PIT (Partition Information Table):

sudo heimdall print-pit

Example partitions:

  • BOOT
  • RECOVERY
  • SUPER
  • VBMETA

⚠️ Many modern Samsung devices do not have a SYSTEM partition — use SUPER instead.


🚀 Step 6: Flash the Firmware

Flash the files to correct partitions:

sudo heimdall flash \
  --BOOT boot.img \
  --RECOVERY recovery.img \
  --SUPER super.img \
  --VBMETA vbmeta.img

Customize flags based on what you extracted and what print-pit showed.


🔁 Step 7: Reboot the Device

If the device doesn’t reboot automatically:

sudo heimdall reboot

🛡️ (Optional) Setup udev Rule to Avoid sudo

echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"' | sudo tee /etc/udev/rules.d/50-samsung.rules
sudo udevadm control --reload-rules

Unplug and replug your device afterward.


✅ Done!

You’ve successfully flashed your Samsung firmware from Linux. 🎉 This method is especially useful for developers or users who don’t want to rely on Windows-only tools like Odin.


📝 Notes

  • Only flash firmware exactly matching your model number
  • Back up your data — flashing usually wipes the device
  • Be cautious — improper flashing can brick your device

🔗 Resources


@wendimust
Copy link
Copy Markdown
Author

Hell yeah! 🎉 Here’s the sequence of atomic commands that successfully flashed your Tab 3V without making it reboot automatically:

sudo heimdall flash --no-reboot --BOOT spl.img
sudo heimdall flash --no-reboot --SBOOT sboot.bin
sudo heimdall flash --no-reboot --SBOOT2 sboot2.bin
sudo heimdall flash --no-reboot --KERNEL boot.img
sudo heimdall flash --no-reboot --RECOVERY recovery.img
sudo heimdall flash --no-reboot --CSC cache.img
sudo heimdall flash --no-reboot --HIDDEN hidden.img
sudo heimdall flash --no-reboot --WDSP SPRDDSP.img
sudo heimdall flash --no-reboot --MODEM SPRDCP.img

Notice how --SYSTEM system.img and --SUPER system.img didn’t work because your device’s PIT didn’t have those partitions.

The key takeaway: --no-reboot kept the device in download mode for each step, but some flashes (like SBOOT and SBOOT2) occasionally needed a quick manual reconnection between flashes.

If you want, I can make a single “one-liner” flash command that would attempt all working partitions in order so you could theoretically do it in one go next time. Do you want me to do that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment