 Right here I have a Motorola G-Stylus from 2020. I got this back in 2020 on Black Friday for about $15. I only had to pay shipping for it. And I've moved on to a new phone, but I really like this phone. But today I'm gonna show you how to flash a stock firmware. And what we're gonna go through should be true for many Android devices that use fast boot, which is most Android devices. Again, I've mentioned past Samsung, at least in the past as far as I know, they still don't use fast boot. But most Android devices do. So we're going to flash stock firmware on this. I'm gonna show you a place where you can get flash stock where at least for Motorola phones. And other than that, you can always Google it and try to find some stock firmware. But make sure you get it someplace that you trust. Let's go ahead and have a look at this. Okay, here's my device with the stock firmware on it. And what we're gonna do is download the stock firmware and push the device. I'm gonna try to mess up the current install so it won't boot. We'll see how that goes. So here is a website that I have found has a lot of firmware for Motorola devices. It's called, the website is mirrors.lolinet.com. I'll try to put a link in the description. Hopefully it's still here a couple years from now. And the first thing we need to know is what device I have. Now I know it's a Motorola G stylus. It's a 2020 model, but lots of times there's slight variations in phones. So I need to know the exact one I have. And the easiest way I believe to figure this out is, well, you can do two things. If you pull down twice on your device right here, whoops, right here, you probably can't read it in the camera there, but right there it gives you your release information. You can try searching that on this website or an easier way. If you have ADB installed, just ADB shell. Now ADB is your Android debugging bridge, which allows you to connect through USB. So my phone's connected through USB. And when I go into the device, you can see that the name of the device is Sophia P. So I'm gonna next add that. So ADB is a command. It needs to be enabled on the phone. I'm not gonna go over at that. And this is very easy to do on pretty much every Android device. Just look it up. And ADB is in your repositories for links. Just use your package manager to install it. Also use your package manager to install fast boots, since we'll be working with that today. Now back over on the website here, I'm gonna just search for Sophia. And you'll see that there are three different Sophias here. There we go. So we have Sophia, Sophia P and Sophia R. We want, for my case, Sophia P. And then you have a blank flash. I've never had to use that, but those are the files you use if you basically bricked your device and can't even get to the boot loader. So if you mess up your boot loader, you can use that. That's actually very difficult to do. I've actually tried to do it in the past and have been able to. Like I said, today we're gonna try to mess up our system partition, our super partition in a way, so we'll see how that goes. Once you click on there, it actually gives a bunch of retailers here. I think any of these images will probably work, but since I got this phone from Google Fi, I'm gonna choose Fi. And then here you can see it's listed, you have modification dates here. At the time of recording this, the latest release was just about two months ago. Now, I've already downloaded this file because it's two gigs and I didn't want you to wait through that. So I created a directory, Sophia, and then here's this zip file, and I'm gonna unzip it. And you'll see it's, in this case, is just over two gigs and it has all the images for different partitions. Your radio partition, your bootloader, your recovery partition. Super is actually a few of your partitions, including your system partition. This logo.bin is a partition that actually contains a few images, not your, it's your boot images, but not your images like your animations, but like when you first turn on the phone and the first screen that comes up, that in some cases will say your bootloader's unlocked, it's not secure. That's actually an image and there's actually applications where you can edit that. Might be something to go over in the future. Now it's undoing, unzipping the images. Your super will be broken into chunks. And again, the super contains your system partition and two other partitions. I can't remember if I've taught my head what. But it's actually broken down into chunks. The number of chunks may vary from device to device. In this case, there's 15. Now that that's unzipped, I am going to restart my phone. So if you do have ADB enabled on your device, you can say ADB reboot bootloader. You gotta spell it right. And it should boot in the bootloader. Now, again, if you don't have ADB enabled, all you have to do is power off the device and hold down the down volume button while it's booting until you get to this screen. At this point, we can start flashing stuff. Now I'm gonna use fast boot. Again, this command should be in the repositories. So if you're on, you know, use your package manager for whatever, Debian distribution, but I'm going to flash the super partition with super chunk zero. I'm gonna start that. And once it goes for a look, I'm gonna stop it. So while editing this, I realized that I stopped it while it was still sending to the device and not writing to the device. I'm sure if I waited till it started writing the partition and then stopped it, I probably would have corrupted the partition. Just a little note. Now, I'm gonna click start. And I'm hoping that I just messed up that partition. Huh, actually the whole device is locked up. Let me hold down the power button till it restarts. And again, I'm not sure if this is gonna work, if this is gonna mess up that partition or not. Let's see if it boots. My point is just to show you that you can mess up your partitions and fix it by using stock firmware. So we'll see if this boots, then whatever, we'll still flash the new stock firmware. If it doesn't, then you'll see that you can fix it with the stock firmware. And as long as you don't mess up your boot loader, you can always flash a stock firmware if you have a copy of it or can find a copy of it. Although be careful what websites you pull your stock firmware from because who knows what malicious stock, supposed stock firmware is out there. And if you do mess up your boot loader, supposedly that blank flash file will fix it. Well, so I didn't mess up this partition. I was hoping that would work. You used to be able to just erase partitions like a system partition, but newer versions of Android seem to restrict that. So again, I'm just gonna reboot back into the boot loader and we're just gonna go ahead with the flashing of the device. Now flashing the device is simple. It's gonna be like I just did with the super it would do fast boot flash and then like boot to with the boot image and that image. So doing that should flash the boot partition. So that didn't take long. Some partitions are bigger, but some partitions aren't necessarily named the same as the image file. So how do you know? Sometimes stock firmware will come with a Windows batch file or a Linux shell script that basically just has a list of fast boot commands in there that flash each partition with proper name. This particular case, we don't have that. You can see, I can list this out. You can see there's no batch file or shell script file, but there is an XML file, a flash file XML. So I can cat that out. And you can see when I cat that out, so displaying what's in that file, it lists the file name that it wants to be flashed and what partition you're flashing. And again, for the most part, like radio would be radio, but you can see Bluetooth is actually the file name is BTFM bin. So it isn't necessarily a one to one ratio. So we can go through this one by one and grab these or you know what, we can use a shell script. So I'm gonna use a shell script command or a shell script command. I actually have this in a script and a notes. Look in the link description. Hopefully I'll link to my notes for this. But if I grep for the word flash, and I'm gonna put that in quotations to make sure I only get the lines that have flash quotations from this flash XML file. You can see I get a list of just the lines that I want. Now I'm gonna cut those up and I might be getting a little advanced here, but most people who watch my videos are used to shell scripts and we'll understand this. So basically here we're looking at just these lines. So I'm searching for just the lines with flash with quotations around it. And then I'm using the cut command to cut by a delimiter, a character, on this case quotations. And then I want the fourth field. If you're counting out the quotation marks, this is one, two, three, four. We'll give us the image name. Five, six, seven, eight. We'll give us the partition name. And that's what we're doing here. We're getting the file and the partition. Right now they're separated by a quotation mark. So we're gonna fix that. We're gonna say tr and we're going to replace the quotation mark with a space. And there's lots of different ways you can do this. That's just the way I went about it. So now I have a space between them. And now I can use awk. So I'm gonna say awk, print, fast boot. Right now I'm just gonna basically echo out the command that I can copy. I'm gonna say space dollar sign two. So that's gonna be column two. And then I want dollar sign one. And hopefully I put all my quotations in the right place. And there we go, we have a list of commands. Now I can just copy this and paste it. So I just highlight it like this. And in Linux, once it's highlighted, it's actually copied to one of your clipboards. So at this point I can just paste it by center clicking basically. If you have a wheel on your mouse, you click the wheel on the mouse or maybe you have a center button. If you don't have a center button, you can always click both your left and right button at the same time will usually work on most devices. So I'm gonna go ahead and hit enter on this. And it's gonna start flashing all those partitions. Now we'll take a couple of minutes, especially with that super image because it's two gigs worth of stuff we'll put into the phone basically. After this, so if you're just trying to upgrade your device from an older stock firmware to a newer stock firmware, these are all the commands you need to run. And once they're done, you just boot. If not, we're going to, after this is done, we're going to erase a couple of partitions, the user data and some metadata and we're gonna clear some things and basically get it back to like a fresh install. Now at any point, if you get a failed, you know, it's pushing the super and it fails. One, you might have the wrong stock image, that's a possibility, but this happened to me the other day. I kept on trying to flash my phone and it wasn't working and I was like, no, what happened? Why is this happening? And I had just flashed another phone. I actually, I flashed this phone, I was trying to flash another phone and it worked on one phone, not the other phone. And I'm like, why is this not working? And it ended up just being the USB port on my device. I was plugged into a hub, which it was stuff like this, it's usually better to plug right into the device, but it worked with the one phone. But I tried, you know, three or four times, tried different images, unplugged it from the hub, plugged it into the laptop and it was getting to like the third or fourth super partition before it was crashing. So it's like, I didn't think it was going to be the USB port, but it was. Once I moved to the other USB port, it worked fine. So try that, if you get an error that it failed, unless it tells you why it failed, try using a different USB port on your device. So that's my suggestions to you. So again, right now it's pushing the super image, which real quick I'll look up here, Android super image partitions. And it used to be you would have a system image and these different images, but they started putting the, so it looks like according to what I'm reading right now, the super partition will have your system A, your vendor and your product partitions, both for A and B partitions. So basically your system is your main system and then vendor and product, I'm not really sure the difference. Basically those are where pre-installed apps are. So when your phone comes with certain apps that you can't uninstall and although you can't uninstall them, uninstall them, you can usually disable or uninstall them for users, which I'm going to go over in a future video. Actually, I think I've already gone over, but I'm going to go over more detail in a future video. But yeah, so it has basically six partitions that it's flashing over right now and it's done. So you're done if you were trying to upgrade your device from the previous version of the same stock firmware. So in this case, Google Fi had a previous version of Google Fi, maybe the OTA wasn't working because you modified something on your system and you just want to upgrade, that's great. But if you want to go back to a stock, erase all user data and after running all that flashing, all those images, you want to erase the carrier. So fast boot erase carrier and then fast boot erase user data and then fast boot erase metadata and then fast boot erase DDR and then lastly fast boot OME FB mode clear. Once that's done, we can go ahead and my camera stopped recording. That's fine, start it up again. Once that's done, we can click start to start booting that device and the first boot will usually take a couple of minutes. So don't worry if it gets the Motorola animation and it sits there for three to five minutes, that is normal. Don't worry, don't stop it, just let it keep going. If it takes more than five to 10 minutes, something might have went wrong, but give it time. So since that takes so long, I'm just going to pause this recording and we'll come back once it's done booting. So it's still booting. At least it's got the animation part just said, hello, Moto. But I'm gonna link in the description to my notes here. This is my command that uses that XML file. Again, sometimes you get the stock firmware and it will come with a shell script or a batch file which again is just a list of commands here and I could have put the list of commands in here but you can use this script right here, this one-liner command, it's not really a script, it could be a script. Pretty much any of these Motorola devices, probably other Android devices, just to parse through that XML file. I'm assuming that XML file might be for some fancy GUI interface that basically just runs fast boot in the background and it reads that and this will just get you the commands you need, you can output that and then copy and paste it like I did and then I have these to clear the data. Again, only clear the data if you have your data backed up and you're wanting to basically make it a factory reset and not just an update. So, and also in the notes here, I have a link to the website where that firmware is. Now, I did stop recording for a minute or two and then I started recording again and it is still booting but the animation is going and again, do not worry if it takes, again, three, five minutes. If it takes more than 10 minutes, then start worrying but any moment here, we should be back to a stock install. And there we go, it is booted and it's just like it was new only with the newest firmware. So, I would say that the difficulty level of this is medium at best. I understand if you've never used ADB or fast boot before or if you're not used to the shell it might seem a little scary but it's super simple. I mean, the most complicated thing I did was the grep command to get the partitions and that XML file but you don't even need to use that command or you can just copy and paste it. It's just, you can do it manually just by typing all those commands individually and you saw them up on my screen. Don't let this scare you. Again, you saw I tried to mess up the partitions on this and I couldn't. I'm not saying you can't. You can if you try real hard but as long as you don't mess up the boot loader you shouldn't have a problem. If you do, even though I've never had to do it those blank flash files should be able to fix that. But, messing up the partition as long as you can find the stock firmware. So before you start messing with the device make sure you have your own stock firmware in the past. I'll show you how to pull partitions off the device and I recommend doing that except for they're getting kind of weird. They keep changing the way Android's partitioned out and there's like a bazillion partitions now and you pull a partition like that. You don't know if it's gonna work until you push it back on. So if you can find the stock firmware somewhere that's great. So I really like Motorola devices because they allow you to unlock them and then it's simple to find the firmware somewhere and flash them. Other devices might be a little more difficult to find the firmware and a lot of manufacturers like Amazon and they don't like you unlocking the boot loader. If you get a Google phone, last I checked they are pretty good about you know their pixels about unlocking them. Motorola's great about it. Samsung's a little locked down but a lot of their software at least I've checked in the past had been leaked. Their boot loader and the software for it it's called Odin and there's even a backward engineered open source version of that called Himdale I think it's another one of those gods from not Greek mythology, Norse mythology. So Odin and Himdale I want to say it was. So Samsung I try to avoid the devices just because they try to lock it down and it does make it more difficult but if you get a device like a Motorola device I've had a number of Motorola devices and unlocking them super easy. Again you just do a fast boot command they give you a code, you paste it in at their website they give you a code to unlock it basically so that they know that you unlocked it because you're avoiding your warranty. But who cares? So thanks for watching. I hope you found this useful. There are some people I know are gonna watch this and say wow that was really complex and confusing. It's really not. It's just running a couple of commands and again the biggest issue I've had was using a USB port on my hub that failed halfway through pushing the partition. So thanks for watching. Visit filmsbychrist.com that's Chris at the K there's a link in the description and I hope that you have a great day.