yashsingh1/xdaforums huggingface dataset:
[Moto G4 Plus Questions & Answers] akash0007:
my model no is g4 plus xt1643, what should i do?

and i have tried to flash hw via fastboot but it failed.......

as m.swasthik said there is __UG_TAIL__ just After __UG_TAIL__ in my backup hw script......

i attached my hw in google drive just check and tell me what is wrong and what should i edit in this file.

https://drive.google.com/file/d/0B8nEH28zFn3SdWhTOWlGblB2Tjg/view?usp=sharing
[Moto G4 Plus Questions & Answers] givitago:
The file I based my patch on was from an XT1642. There seems to be a difference in the null character in your hw file vs mine (XT1644). Mine is 0x00, yours is 0x20. Maybe that is why the patch script isn't working for everyone.

Anyway, I merged the first 520 bytes into your file and replaced any 00s with 20s.

Extract the file from the attached zip and flash it. Please let us know if this resolves it for you.

fastboot flash hw hwXT1643.img

View attachment hwXT1643.zip
[Moto G4 Plus Questions & Answers] akash0007:
thanx buddy for your support, You took time and edit my hw file
[Moto G4 Plus Questions & Answers] mexifunk:
It worked?

I have the same problem but with a XT1641 single sim
[Moto G4 Plus Questions & Answers] akash0007:
it is showing me this error the hw file is not flashing

C:\Users\biznis\Desktop\mfastboot-v2>fastboot flash hw hwXT1643.img

'fastboot' is not recognized as an internal or external command,

operable program or batch file.

---------- Post added at 06:26 PM ---------- Previous post was at 06:21 PM ----------

it is showing

C:\Program Files (x86)\Minimal ADB and Fastboot>fastboot flash hw hwXT1643.img

(bootloader) slot-count: not found

(bootloader) slot-suffixes: not found

(bootloader) slot-suffixes: not found

(bootloader) has-slot:hw: not found

target reported max download size of 536870912 bytes

sending 'hw' (8192 KB)...

OKAY [ 0.267s]

writing 'hw'...

(bootloader) flash permission denied

FAILED (remote failure)

finished. total time: 0.275s

and not flashing
[Moto G4 Plus Questions & Answers] mexifunk:
use mfastboot instead of fastboot
[Moto G4 Plus Questions & Answers] akash0007:
the second post is by fasboot method
[Moto G4 Plus Questions & Answers] givitago:
Never had that issue. Search other threads for this error. Some suggestions I found were to run the cmd prompt using administrator. Try another usb cable. Ensure that you are using the moto-g version of fastboot. Others suggested setting lock screen pin to None before flashing. If you can get the file onto your phone (adb push), you could also overwrite the partition using dd.
[Moto G4 Plus Questions & Answers] akash0007:
i am noob and i dont know anyy thing abou dd please tell me how i overwrite the hhw partition using dd... please:crying::crying::crying::crying::crying:
[Moto G4 Plus Questions & Answers] akash0007:
if it is possible please make a youtube video how to replace hw partition..... it will more helpfull for us.....
[Moto G4 Plus Questions & Answers] akash0007:
i haven't any backup of my phone do you have any idea how do i get signal...
[Moto G4 Plus Questions & Answers] givitago:
Perhaps the restore of the TWRP backup was unnecessary. I'd guess that it was the modem replacement that may have fixed the issue.

If it were me, I'd follow the instructions here, including re-downloading the fastboot files.

Stock Firmware Sept 01 Security Patch to the letter (not running the batch file but rather using the manual method.

I would leave out the unlocking/locking of the bootloader and also flash the HW file.

These are the lines you should run, one by one in order and from the dos command prompt. Ensure all the files including hwXT1643.img are in the fastboot folder.

fastboot flash partition gpt.bin
fastboot flash bootloader bootloader.img
fastboot flash logo logo.bin
fastboot flash boot boot.img
fastboot flash recovery recovery.img
fastboot flash dsp adspso.bin
fastboot flash oem oem.img
fastboot flash system system.img_sparsechunk.0
fastboot flash system system.img_sparsechunk.1
fastboot flash system system.img_sparsechunk.2
fastboot flash system system.img_sparsechunk.3
fastboot flash system system.img_sparsechunk.4
fastboot flash system system.img_sparsechunk.5
fastboot flash system system.img_sparsechunk.6
fastboot flash system system.img_sparsechunk.7
fastboot flash modem NON-HLOS.bin
fastboot flash hw hwXT1643.img
fastboot erase modemst1
fastboot erase modemst2
fastboot flash fsg fsg.mbn
fastboot erase cache
fastboot erase userdata
fastboot erase customize
fastboot erase clogo
fastboot reboot
[Moto G4 Plus Questions & Answers] akash0007:
nothing happned, i flashed every thing line by line.

and when i flashed hw file it gives me error

C:\Program Files (x86)\Minimal ADB and Fastboot>fastboot flash hw hwXT1643.img

(bootloader) slot-count: not found

(bootloader) slot-suffixes: not found

(bootloader) slot-suffixes: not found

(bootloader) has-slot:hw: not found

target reported max download size of 536870912 bytes

sending 'hw' (8192 KB)...

OKAY [ 0.274s]

writing 'hw'...

(bootloader) flash permission denied

FAILED (remote failure)

finished. total time: 0.284s
[Moto G4 Plus Questions & Answers] lCrD512:
You can't flash hw image like that its not a part of those stock flashable images via fastboot.

Try to use adb push instead: adb push hw.img /dev/block/mmcblk0p43
[Moto G4 Plus Questions & Answers] akash0007:
please tell me the whole process because i dont know any thing about this pull push technique
[Moto G4 Plus Questions & Answers] lCrD512:
Assuming you have the same issue as mentioned in the OP, missing fp, imei, no network etc. You can try the following steps:

Note: If your device is rooted you can do this without rebooting to twrp (skip that particular step). Remember to give access to adb when prompted. If you are not rooted and also do not wish to flash custom recovery, you can temporarily boot through twrp for this purpose instead of flashing it using "fastboot boot twrp.img" without quotes.

Download this zip, extract them in your adb directory, it contains the required images to be pushed via adb: https://drive.google.com/file/d/0B9tngVBGIajVOFFUeDRlTHg4a3c/view

Flash TWRP recovery: https://dl.twrp.me/athene/twrp-3.1.1-0-athene.img

Reboot to twrp (can skip this only if your device is rooted) > connect your device to PC > open cmd in the same directory i.e., where you have adb and those image files > type "adb devices" (without quotes) and hit enter to make sure your device is recognized via adb in recovery. It will show your device serial number probably. If not recognized check your adb setup, drivers etc. there are tons of guide here in xda for that.

If recognized, execute the following adb commands one by one:

adb push modem.img /dev/block/mmcblk0p1
adb push fsg.img /dev/block/mmcblk0p16
adb push hw.img /dev/block/mmcblk0p43

Once done flash the latest firmware from here, read the instructions carefully: https://xdaforums.com/moto-g4-plus/how-to/stock-rom-npjs25-93-14-4-march-1-t3608138

Hope this helps:fingers-crossed:
[Moto G4 Plus Questions & Answers] akash0007:
you are such a genius man after doing this my fingerprint is start working but i dont have the network i manullay search for the network but it gives me error that unable to search the network.... please do some thing for the network... you are such a g4 hero for me

---------- Post added at 07:41 PM ---------- Previous post was at 07:15 PM ----------

finally i fix my phone i flash my hw edited file using adb push my fingerprint and network is working...

thank you all who helped me in this issue special thanx to [MENTION=8274594]givitago[/MENTION] who edit my hw file. and lCrD512 who teach me how to do partition of.... this work for me :good::good::good::good::good::good:
[Moto G4 Plus Questions & Answers] DevilsReign:
So, I've a unlocked bootloader Moto G4 Plus XT-1643 (Got same problems like akash)

but when i push the hw file that he provided, it stuck at 100% and i need to close adb to get out of that stucked adb.

So, I made a backup of my HW and attached here, can someone please help me and edit my hw so that it will load with 100% and properly. Is there any other way to push hw file in ?? Please help me my networks and all doesn't working from past 1 year my phone is just a ipod.:confused::(
[Moto G4 Plus Questions & Answers] m.swastik:
Weird, I thought I was the only one having this issue. I thought it was maybe due to I messed up my phone while troubleshooting this issue.

Does anyone know what could be causing this issue?

I noticed my /proc/mounts file doesn't have hw partition details. For those whose phone is fully working does your /proc/mounts have hw partition mount details.
[Moto G4 Plus Questions & Answers] DevilsReign:
You knew swastik you shared a post quite a while back with a link to a blank flashing method ?? Just try flashing all the blank flash and then load the new bootloader and got that they provided in the post then try pushing that hw.img of akash :confused: then it might work. I'll do it but in my net is not working properly.
[Moto G4 Plus Questions & Answers] givitago:
Here is the editted file. Yours seems to be filled with 0x00 bytes, rather than akash0007's space (0x20) bytes.

View attachment hwXT1643_0s.zip

I don't think the contents of the file will have anything to do with your ADB issues. Did you boot into twrp recovery before trying the adb push?

I'm curious about the the fastboot flash command. I thought it was equivalent to adb push but took the extra step of looking up the partition name in the partition table. Obviously my noob ignorance here.

Reading here:

How to Discover Hidden Fastboot Commands

it seems fastboot has some idea about what partitions are OK to flash and what ones are not. I wonder if running:

fastboot flashing unlock

or

fastboot flashing unlock_critical

would allow the hw partition to be uploaded via fastboot as I originally suggested to [MENTION=6322395]akash0007[/MENTION]. You could try it I suppose. If anyone cares to enlighten me, I'd appreciate it.

Another option would be to put the file on an sdcard or try pushing it to a mounted folder and using dd to overwrite it.

adb push hwXT1643_0s.img /data/media/0/hwXT1643_0s.img
adb shell dd if= /data/media/0/hwXT1643_0s.img of=/dev/block/mmcblk0p43

Not sure if that one is only related to mounted file systems. hw is basically a binary file stored in a partition and is not mounted.

In the backup script I posted, I use this to list the partitions:

part_dir=$(find /dev/block/platform -name by-name)
$(ls -la $part_dir | awk '{if ( $10 == "->") print $9 ">" $11 }')
[Moto G4 Plus Questions & Answers] DevilsReign:
So, I run both the commands and the results are like this :

First i run :

fastboot flashing unlock

I got it is already unlocked

secondly i run:

fastboot flashing unlock_critical

I got this result :

C:\Program Files (x86)\Minimal ADB and Fastboot>fastboot flashing unlock_critical
(bootloader) slot-count: not found
(bootloader) slot-suffixes: not found
(bootloader) slot-suffixes: not found
...
(bootloader) Not supported. Must use OEM signed bootloader.
OKAY [ 0.016s]
finished. total time: 0.016s

Details are my bootloader is unlocked and my phone is not rooted. Is there any problem regarding this as when i switch on my phone it is already in bootloader screen with these info :

https://drive.google.com/file/d/0Bz3zWKsYsrF2Y1N6X1dYY2MxYjQ/view?usp=sharing

And for the second option it shows on the shell command this result:

C:\Program Files (x86)\Minimal ADB and Fastboot>adb shell dd if= /data/media/0/hw.img of=/dev/block/mmcblk0p43
Segmentation fault

Yep i push it in the directory of my internal storage the hw fie that you edited.

Here is my boot.img link, Please check it as it is okie as i can't even lock my bootloader as it ask me to have a signed boot.img

https://drive.google.com/open?id=0Bz3zWKsYsrF2MnB1SW9JTlNKWEU
[Moto G4 Plus Questions & Answers] lCrD512:
Might be an issue with your adb or twrp. There should not be any problem with the steps I mentioned earlier unless something is wrong with adb setup or the adb not working properly in the recovery mode or twrp you are using. Anyhow try again with official twrp, make sure your device is recognized in recovery when you execute adb devices. After pushing modem, fsg and hw images don't forget to flash latest 14-10 September firmware.

I have no idea about that edited hw image. I don't think its even required. I pulled them directly from stock 14-8 firmware using XT1643. Also there's no way you gonna get success flashing these 3 image files through fastboot it will fail always they are not fastboot flashable. Just reminding again after pushing the files successfully don't forget to flash the 14-10 stock firmware. :)
[Moto G4 Plus Questions & Answers] lCrD512:
Latest firmware and instructions to re-lock bootloader are given here https://xdaforums.com/moto-g4-plus/how-to/stock-rom-npjs25-93-14-4-march-1-t3608138
[Moto G4 Plus Questions & Answers] m.swastik:
I don't think its an issue with adb or recovery, I have successfully flashed fsg and modem files through same process. It only hangs while flashing hw file.
[Moto G4 Plus Questions & Answers] lCrD512:
What firmware you were running on earlier? and which hw image you tried to push as I see there are some edited images too here? because in the screen shot I provided in my previous post by some other user here, he had no issues pushing the hw image.
[Moto G4 Plus Questions & Answers] givitago:
Sorry, there was some whitespace in there - there should be no whitespace after if=

Try:

adb shell dd if=/data/media/0/hw.img of=/dev/block/mmcblk0p43 bs=1 count=512 conv=notrunc
[Moto G4 Plus Questions & Answers] DevilsReign:
Right now i'm on latest 14-10 firmware and before this i think i'm on 14-8, The recovery twrp that i'm using is of moto g twrp 3.1.1-0 athene. Actually i tried all hw one by one but it stuck at 100% or 20% and i need to close the adb after that means the hw partition is not replacing with the file we are pushing. I don't know why this thing is happening.:rolleyes::confused:

---------- Post added at 04:17 PM ---------- Previous post was at 03:51 PM ----------

I did this and get this result :

C:\Program Files (x86)\Minimal ADB and Fastboot>adb shell dd if=/data/media/0/hw.img of=/dev/block/mmcblk0p43 bs=1 count=512 conv=notrunc
512+0 records in
512+0 records out
512 bytes (512B) copied, 0.093314 seconds, 5.4KB/s

C:\Program Files (x86)\Minimal ADB and Fastboot>

Is it Pushed Properly ??

---------- Post added at 04:39 PM ---------- Previous post was at 04:17 PM ----------

I tried everything but nothing worked

The hw command always hangs up the twrp and that adb stuff stops at 100% each and everytime and even in adb shell push the adb terminal got stuck after i pressed enter the command only this above command works but i don't know what it did as i went back to my device and it is still moto g(4).

I think why not try to push the image with another recovery but i can't manage to put stock recovery back for that i think i need to relock the bootloader

Let me check the hw image, maybe it did some miracle lol let me pull out my hw image again

Edited

No the Hw is unchanged :confused::(
[Moto G4 Plus Questions & Answers] m.swastik:
I tried flashing two different hw one mentioned in this post (https://drive.google.com/file/d/0B9tngVBGIajVOFFUeDRlTHg4a3c/view) and another i got it from a guy on telegram. I am on build 14-8.
[Moto G4 Plus Questions & Answers] givitago:
Seems like it was successful based off of the message. Are you sure the copy of in /data/media/0/ hw.img is a good one?

What is the output of this?

adb shell dd if=/data/media/0/hw.img of=/dev/block/mmcblk0p43 bs=512 count=1 conv=notrunc
adb shell dd if=/data/media/0/hw.img bs=512 count=1 | hexdump -C
adb shell dd if=/dev/block/mmcblk0p43 bs=512 count=1 | hexdump -C

The latter commands should show the first 512 bytes of the source and destination files.
[Moto G4 Plus Questions & Answers] DevilsReign:
Here is the result that hexdump command is not recognized :confused:

C:\Program Files (x86)\Minimal ADB and Fastboot>adb shell dd if=/data/media/0/hw.img of=/dev/block/mmcblk0p43 bs=512 count=1 conv=notrunc
1+0 records in
1+0 records out
512 bytes (512B) copied, 0.089628 seconds, 5.6KB/s

C:\Program Files (x86)\Minimal ADB and Fastboot>adb shell dd if=/data/media/0/hw.img bs=512 count=1 | hexdump -C
'hexdump' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files (x86)\Minimal ADB and Fastboot>adb shell dd if=/dev/block/mmcblk0p43 bs=512 count=1 | hexdump -C
'hexdump' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files (x86)\Minimal ADB and Fastboot>

Also whenever i run this command

( Fasboot oem hw ) i got this blank result

C:\Program Files (x86)\Minimal ADB and Fastboot>fastboot oem hw
(bootloader) slot-count: not found
(bootloader) slot-suffixes: not found
(bootloader) slot-suffixes: not found
...
OKAY [ -0.000s]
finished. total time: -0.000s

Also recently i check my computer directories and found this rom and i think i flash this back in days, maybe this cause some problem in gpt partition.

BUILD REQUEST INFO:
SW Version: athene-user 7.0 NPJ25.93-14 16 release-keysM8952_70030.25.03.62R
MBM Version: B1.03
Modem Version: M8952_70030.25.03.62R
FSG Version: FSG-8952-05.30
Build Fingerprint: motorola/athene/athene:7.0/NPJ25.93-14/16:user/release-keys

VERSION INFO FOUND UNDER 'ABOUT PHONE' SCREEN:
System Version: Unknown
Model number: Moto G (4)
Android Version: 7.0
Baseband Version: M8952_70030.25.03.62R
Build Number: athene-user 7.0 NPJ25.93-14 16 release-keys
Build Date: Fri Jan 6 04:58:11 CST 2017

OTHER MISC VERSION INFO:
Subsidy Lock Config: slcf_rev_d_default_v1.0.nvm
Regulatory Info (eLabel): regulatory_info_default.png
Blur Version: Unknown
Version when read from CPV: athene-user 7.0 NPJ25.93-14 16 release-keys
[Moto G4 Plus Questions & Answers] DevilsReign:
I think i found out the solution to this problem, It is basically in Partition GPT.bin that we are currently stucked on.

So, Here is the case

I tried i mean everything possible way of making that HW file and mmc block 43 to stay stuck at edited on but somehow every restart makes it set to default or you can say the one where UTAG and UTAIL are on same line because i think we can't write this partition at all. I think we have the read only permission set to true in gpt.bin and we can't write this partition. So, Anyone please look into it as i replaced all the files related to that specific HW in adb with the good ones and try to change the permission of files but it isn't helping at all the movement the phone restart it turns back.

I don't know what other thing might cause this problem but to the closest this is the case probably. Hope it is the case

So, Someone around here who can edit the gpt.bin file and somehow make false the read only command from the HW partition.:confused::(
[Moto G4 Plus Questions & Answers] lCrD512:
hmm sounds like messing up even more. I would never touch gpt or any image files at the first place also I have no idea if edited gpt would even flash successfully or not like chances are it might give an error. As you mentioned earlier that you had already updated to 14-10, if anyone could provide the necessary image files from a working xt1643 model you can try that or else wait till I get my athene back. We can still try with 14-10 images (the one I posted earlier were from 14-8) but before pushing it flash the whole 14-10 firmware through fastboot then push the images and flash 14-10 firmware again. Editing gpt, hws etc have risk of messing up the device even more.
[Moto G4 Plus Questions & Answers] m.swastik:
You are talking about the partition layout file, you don't need to do anything to it.

It is the hw partition in our phone which is not writeable or maybe not mounted. We need to mount it with read/write permission.

Can anybody confirm how can we check whether partition is mounted with read/write permission.

EDIT: Tried to mount partition hw/mmcblk0p43 with mount command but got error 'hw' not in /proc/mounts. [MENTION=455354]ICrD512[/MENTION] can you share your /proc/mounts
[Moto G4 Plus Questions & Answers] DevilsReign:
Yep there is no information of Block 43 in mounts :confused: I think if someone with a working Moto g4 could share these 2 files

1. Proc/mounts

2. Etc/mtab
[Moto G4 Plus Questions & Answers] lCrD512:
mounts file and hw from 14-10 in attachment
[Moto G4 Plus Questions & Answers] mexifunk:
Hello, i have lost my fingerprint too, the problem is that i dont know how to edit my hw file.

Can someone helpme?

My model is xt1641 single sim from México.

Here is my hw file: https://drive.google.com/file/d/0B_PMUIWWZZbWVm9YU2xWYlhjREk/view?usp=sharing

Thanks in advance.
[Moto G4 Plus Questions & Answers] givitago:
I'm not sure if you are not barking up the wrong tree with the whole mount thing. I'm just guessing but I think hw is simply a file and not a file system of any sort that is mounted. I asked you to use hexdump in the script I posted a few posts back just to be 100% certain that dd did in fact successfully update the file. Looks like the TWRP shell is a pretty limited shell if hexdump isn't available. You could install it manually into twrp via busybox if you google how.

Anyway, it seems likely that you may have edited it but it gets overwritten on boot, perhaps due to the same cause as what originally corrupted the image. The reason I wrote the Complete Partition Backup Script was an attempt to solve this issue on my phone. The idea was to get all of the smaller partitions, along with a checksum of each so that I could compare my backup along with a working backup from someone with a working phone. Nobody ever did post a backup for me to compare and the hw patch I did solved the problem for me.

If you could convince someone with an XT1643 to run the script and post the partitions.txt at a minimum, it might give you a place to start. My guess is that on boot, some problem is detected and the firmware attempts to update the system to "fix" it , but does a lousy job somehow. There are several xxxbak partitions that likely serve this purpose.
[Moto G4 Plus Questions & Answers] m.swastik:
I think you're right that this is not about mount as both the file doesn't have mount details for hw partition.

But your guess that it's overwritten during boot is wrong, since whether we try to manually write to hw file or flash it, adb hangs, this is an abnormal behavior whatever abnormality is happening at this stage not during boot.

My guess is permission issue due to which adb hangs.
[Moto G4 Plus Questions & Answers] givitago:
I realize adb/fastboot are not working. I was attempting to verify if dd is failing to write to the file as well. That was what the hexdump was all about.
[Moto G4 Plus Questions & Answers] m.swastik:
Yes, dd also hangs tried it the first time you mentioned it.
[Moto G4 Plus Questions & Answers] eudiegoliveira:
Help me please!

Hello guys!

I am also with the same problem Slot 1 always without service but with IMEI Slot 2 even disappeared IMEI nor appears typing * # 06 # fingerprint also does not work nor appears in the settings maybe with the method here made using dd to recover the partitions hw fsg modem modemst1 modemst2 work the problem is that bootloader is still blocked and I do not have root access whenever I try to unlock return message:

(bootloader) Unlock data unnavailable

I will be very grateful if any of you can help me with this problem because at the moment my bike g4 plus xt1640 dual-sim is stopped saved :crying::crying::crying:
[Moto G4 Plus Questions & Answers] m.swastik:
[MENTION=8603570]DevilsReign[/MENTION] Can you first do blankflash and then try to flash hw file, we have a chance here.
[Moto G4 Plus Questions & Answers] DevilsReign:
I'll try it but the problem is my phone starts at fastboot and wasn't detected as a qualcom device in my computer, So can you tell me a workaround to install it, as soon as i connect to the pc my phone switch on in fastboot mode :confused: