[Samsung Galaxy Tab A series ROMs, Kernels, Recover] olaf81825:
Detailed installation procedure...

Many thanks for the great work. This is a nice device, much more so with the right firmware :)

It took me several attempts to get the installation right, so here's what I got from experimenting and reading the hints in the other thread about the LineageOS version. Can the experts perhaps look over that and correct anything which is wrong.

Preparation:

Use a good USB cable and connect that to the PC. Best without a hub in between. If using Linux, see next post about Heimdall.

Installation procedure, coming from the original Samsung firmware:

1. Do a factory reset, leading to a reboot.

2. Go through the initial setup procedure, skip all the account setup stuff, but connect via WiFi to the Internet in the process.

3. Enable developer mode and (if not done already) OEM unlock.

It looks like these exact steps are required to get the bootloader really unlocked. Failure to do so will result in problems when re-flashing stock, then unofficial firmware again.

4. Power off the device.

5. Go into bootloader by holding down both volume keys and connecting the USB cable.

6. If not done already, unlock the bootloader by long press on Volume up. This will cause another reboot, then proceed at 4.

7. Flash the new firmware, ultimately leading to a reboot.

8. Hold the Volume up key while rebooting (not sure if this is strictly needed, but it should boot into recovery)

9. In recovery, FORMAT (not wipe) the data partition.

Failure to do so will keep parts of the data partition encrypted and cause weird errors like "can not install certain apps, e.g. browsers".

10. Reboot. Finally the new system should start.

If something is broken, re-flash the original Samsung firmware and start over at step 1 (!!) (perhaps it is a bit easier to boot into Samsung recovery first (hold Vol-up on boot) and do factory reset from there, I haven't investigated that though).

My understanding (and experience with several failed flash attempts) is that as long as you don't repartition and don't flash the BOOTLOADER partition, it will always be possible to recover by re-flashing the Samsung firmware.

---------- Post added 11th March 2020 at 12:07 AM ---------- Previous post was 10th March 2020 at 11:28 PM ----------

The Linux application to flash Samsung devices is heimdall (note the double l). The version available in the Ubuntu repository causes a lot of USB error messages -7 meaning timeout and aborted flashes. So I took the source from https: //gitlab.com/ BenjaminDobell/ Heimdall.git and applied some patches to increase the timeouts. Compiling Heimdall is easier than using this forum :mad:

It also seems to help to connect the USB cable to an USB 2 only port, slower is better here.

Heimdall needs the firmware files unpacked and the individual members uncompressed. Best do this manually once. I tried the Java version of Odin (which is just a frontend for heimdall too), found it extremely slow and needing extreme amounts of memory to unpack, and worse it does it every single time anew, so I took that only as a hint to see how this all works and then used the command line version of heimdall. The heimdall-frontend, OTOH, is much too much clickwork.

I ended up writing up a script like this

heimdall flash --verbose \
--pit ../samsung.pit \
--BOOT boot.img \
--PARAM param.bin \
--RECOVERY recovery.img \
--SYSTEM system.img \
--VENDOR vendor.img \
--VBMETA vbmeta.img \
--PRODUCT product.img

where I obtained the samsung.pit file with

heimdall --download-pit --output ...

and verified the partition to image file mapping (obvious in this case, a little more complicated in the Samsung firmware) with

heimdall --print-pit --file ...

Running such a script (PLEASE verify that every partition is correct, NEVER copy/paste these kinds of scripts) does the whole flashing. With the timeout patch I still get occasional USB error messages but eventually it recovers.

Here's the timeout patch.

--- a/heimdall/source/BridgeManager.cpp
+++ b/heimdall/source/BridgeManager.cpp
@@ -573,3 +573,3 @@
ResponsePacket *endSessionResponse = new ResponsePacket(ResponsePacket::kResponseTypeEndSession);
-	success = ReceivePacket(endSessionResponse);
+	success = ReceivePacket(endSessionResponse, 10000);
delete endSessionResponse;
@@ -620,3 +620,3 @@
{
-	static const int retryDelay = 250;
+	static const int retryDelay = 500;

@@ -626,3 +626,3 @@
// Retry
-	for (int i = 0; i < 5; i++)
+	for (int i = 0; i < 50; i++)
{
@@ -665,3 +665,3 @@
{
-	static const int retryDelay = 250;
+	static const int retryDelay = 500;

@@ -671,3 +671,3 @@
// Retry
-	for (int i = 0; i < 5; i++)
+	for (int i = 0; i < 50; i++)
{
diff --git a/heimdall/source/BridgeManager.h b/heimdall/source/BridgeManager.h
index a674767..006b939 100644
--- a/heimdall/source/BridgeManager.h
+++ b/heimdall/source/BridgeManager.h
@@ -82,5 +82,5 @@
{
-	kDefaultTimeoutSend = 3000,
-	kDefaultTimeoutReceive = 3000,
-	kDefaultTimeoutEmptyTransfer = 100
+	kDefaultTimeoutSend = 7000,
+	kDefaultTimeoutReceive = 7000,
+	kDefaultTimeoutEmptyTransfer = 300