 So, it's night time and my kids should be sleeping. As I mentioned in the last video, we're going to be looking at the Moto G4 here, unlocking its boot loader, putting customer recovery, custom mod on there, and then, you know, making some custom images of our own that run some scripts for us that we need for a project. Again, this is for a project that we're going to be putting one of these onto a drone to collect information as it flies around. And originally we're working with a Raspberry Pi, but the phone should be able to do everything it needs and we don't need extra wires and units for batteries and GPS units because it's all built into the phone. So hopefully the phone is all we need and we're going to go ahead and work on unlocking the boot loader today, which will most likely void your warranty. And I'm going over the Moto G today, but as long as your phone is running fast, which most Android phones do, the process should be similar. You know, Samsung uses their own boot loader, but most Android devices, the majority of them, I should say, not even most of them, but the majority at least, are running fast boot. And also unlocking the boot loader will, in most cases, wipe the device so it's to prevent people from getting access to your personal data. So basically it does a factory reset when you unlock it. Motorola is great about letting you unlock the phone, unlock the boot loader. You just have to go to their site, you know, create an account and log in and they'll give you instructions, which we're going to go over today. And of course it's going to, again, void your warranty, but you just need to get a special code from them, but they let you unlock it and so that's what we're going to do today. Okay, first things first, going to hook up the USB cable to my computer. The phone is on. I'm just going to hold down the power button and power off. And then to boot into the boot loader is a little different on each device, but on these Motorola devices you're going to hold down the volume down and the power button. So let's wait. Okay, shut off. Volume down, power down, wait a few seconds. Let go of the power button and there we go. We're in the boot loader. So I'm working on a Linux system and by default Linux already has drivers in most cases built into the kernel for Android devices, but you still need the tools to access it. In this case we're going to work with fastboot and ADBs. So on a Debian-based system, sudo apt install fastboot and ADB, go ahead and type in your super secret password and I already have both those installed and they're up to date. Now depending on your user's permissions, you may have to run this as sudo or root if you have permissions you don't need to, but the way I have my system set up I'm going to say sudo fastboot and then I'm going to say devices which will list all fastboot devices hooked to this computer. Go ahead and hit enter and there you can see it's showing one device with a serial number there and it's saying that's running fastboot. Now if you have more than one Android device at its boot loader hooked up to the machine at once it will list more than once and that is the serial number for the device. Back on the screen of the phone, you can see we're in the fastboot and it also lists the serial number there. So if you have more than one device you can tell which one's which by the serial number and the output we had from the command on the screen. Okay so again I'm working with Motorola phone here, you have to go to the Motorola website I'll put a link in the description of this video and it will give us instructions that we're about to go over to get the code for this phone to unlock it. Now you're going to have to get it by running these commands and then paste them into the website and they're going to give you a code to unlock the phone. So the next command we're going to run is sudo fastboot oem get underscore unlock underscore data and that will give us this number here. So what we need to do is take each one of these lines without the boot loader information at the beginning there and put it into a single string. Now you could just copy and paste each one of those lines and make it a single line but we're cooler than that right? So we're going to do something a little cooler, we're going to pipe it but you can't just pipe it. So let's say I just wanted to pipe it and grab the lines that say boot loader. I can try to grab boot loader and you can see that didn't quite work because I got all the lines and that's because this is coming as error out rather than standard out on the output. So to fix that we need to add to our line here and all this is saying right here is saying to greater than which is saying take the error out and ampersand one make it standard out. Then we can put that into grep, hit enter and now we only have lines that start with boot loader or contain the word boot loader. Adding on to that command we can now pipe it into awk and say to only print the second column and there you go we have each line we just need to put each of them basically remove the new line character so we're going to use said to remove the new line character and here is just a basic example of removing new line characters using said we'll go ahead and hit enter and now are into the entire boot loader fast-boot code here is all on one line or of course you could just copy and paste depends on how cool you are and now for the moment of truth we'll take the code that we just got pasted into this line on the Motorola website and click the button can my device be unlocked next we're going to agree to their terms and request unlock key it warns us that we're going to avoid the warranty do we want to continue are you sure okay and now we patiently wait for the email to come away it's 2017 emails are almost instant let's check it out and there it is you can look at this code it's going to be different for your phone it's not going to work for you you go ahead and try if you would like I guess I should mention earlier you can also on some devices is pseudo fast-boot OEM OEM unlock and that might unlock but in this particular case it doesn't because we need that code but we do the same thing and add in the code that we were just email and hit enter well that didn't work time to do some googling okay Google told me to go into settings on the phone going developer mode so I'm going to about phone and I think it's the currently click on a couple of times no maybe the build number there we go seven times I think as you click it and when you go back out there's a developer mode probably know this ah look at this OEM unlock allow bootloader unlock enable okay so that was not available on the Motorola instructions I don't remember having do that on my previous phone but it's possible I did it's been two years since I unlocked that phone but it does not say that on the Motorola website so that's good to know you have to go into the settings on the phone enable developer options enable OEM unlock so let's now give it a try again so again we're going to turn the phone off power off also if you have adb installed or I'm sorry enabled on the phone you can reboot the bootloader by doing adb reboot bootloader command on your computer now I'm going to hold down volume down let it finish shutting down so I see battery symbol okay volume down hold down the power button for a couple of seconds till the screen goes black there made a few seconds let go and there we go we're back at the boot loader there's the error from last time but let's try the same command again pseudo fastboat OME unlock and the code we got in our email across our fingers yay bootloader phone is unlocked successfully and right here on the phone you can see devices unlock status code 3 we should be good I know you can't read this in the phone but it says start right there you go through the options by hand volumes up and down and I'm just going to go ahead and click start to restart the phone and this time we get a warning that the bootloader is unlocked well that's it the bootloader is unlocked and that's the hardest thing if you can unlock the bootloader on any Android device you're you're pretty much set so that's what we did here warning unlock new bootloader basically makes it more like a desktop computer so I can walk up to any desktop computer plug-in a flash drive put a CD-ROM in there or or even you know put a floppy drive in if there's a floppy into a floppy drive and boot from that device and that's basically what unlocking the bootloader will allow people to do so like just like I can walk up to any Windows Mac or a Linux machine pop a Linux live CD-R I now have full access to everything on the machine it's kind of the same thing when you unlock the bootloader on the phone the bootloader is locked so you can't boot things other than those already on the phone but having unlocked gives you more freedom to be able to do those sort of things and am I in focus there we go the again once you unlock it it is going to wipe the phone so that's to protect you so anytime you lock or unlock the phone bootloader why don't look when you lock it but anytime you unlock it it's going to wipe out everything all your personal data to prevent people from stealing it once it's unlocked well your phone is fair game but it is giving more more you know things you can do with the phone which is exactly what I need now you can make changes now and then relock it if you want and lock it will suggest that for what I'm doing it's going on a drone for testing it's not going to have any my personal data in there it's just going to be used as a device so I'm going to leave it unlocked and continue watching again this is the first in a series we're next we're going to go looking into putting a custom recovery on this phone then modifying the the boot sector on the phone the boot partition so that we can run our own scripts and do a few other fun things so continue watching if you enjoyed it please you know subscribe comment below if you enjoyed this be sure to like it and share it thank you for watching visit films by chris.com that's chris the k there's a link in the description there you can support me in the support section using paypal or you can support me through patreon patreon.com for metal x1000 so link to that in the description as well as always I thank you for watching and I hope that you have a great day oh and be sure to check out the link in the description to the full playlist if a video is not available that means it hasn't been published yet it will be just keep coming back subscribe and then you'll have a great day