[One (M7) Android Development] mike1986.:
​

Hello User! Before you start reading, I must warn you. First of all, flashing your first custom ROM might end up having ORD. What is ORD you can read here.

Secondly, keep in mind whatever you do, you do it at your own risk. Probability that you will brick your device is very, very small, and if you will follow proper guides, read carefully first post of the thread you are going to use ROM/kernel/recovery/other from, it is almost impossible to brick the device. No, my intention is not to encourage you. Don't even enter bootloader mode on your device if you can't/not going to read what others (probably more experienced) users got to say. Unlocking/flashing process is a very easy and short process, but it requires your attention, reading, thinking and understanding ability.

The best place to start is this thread and this video - click here​

I think you are ready now. So where should you start? You probably don't know yet. So let me briefly tell you what options you have:

You might want to root your device and keep 100% stock ROM

You might want to flash custom recovery to be able to create nandroid backups

You might want to flash custom kernel

You might want to flash custom ROM

You might want to have a custom ROM with ability to make you a coffee <--- forget about that one!

You might want to use some UI modifications like % battery

...

Whatever your option is, you need to start from unlocking your bootloader. Unlocking bootloader doesn't mean disabling all security. Your device will remain S-ON, however instead of "LOCKED" from now on it will be "UNLOCKED" or "RELOCKED" (if you decide to lock it back later). What does it mean? Basically you will be able to change content of system, recovery and boot partitions on your device. So let's unlock your device first.

Unlocking bootloader

What you need to know before unlocking the bootloader:

This operation will wipe entire content of your data partition. Read more about negative effects of unlocked bootloader - Negative effects of unlocked bootloader

This operation will not void your warranty, however opinions in this subject are divided. Read more about flashing custom ROMs and warranty - Unlocking bootloader or flashing custom ROM doesn't void your warranty!

If you are not sure if your device has virtual SD card or hardware SD card, read more here - Virtual SD card on Android

HTC One Developer Editions comes with already unlocked bootloader, so you can skip this step if you own HTC One DE.

Download this mini-sdk package and extract it to c:\mini-sdk

Visit htcdev.com site and create your account

Log in into newly created account and on the main site click "Unlock Bootloader" image <click here to see the image>

Click on "Get started" button <click here to see the image>

Expand the list of supported devieces and search for your device model name <click here to see the image>

If you can not find your device on the list, select "All Other Supported Models" <click here to see the image>

Click on "Begin Unlock Bootloader" button

On the "Are you sure you want to continue?" screen click on "Yes" button <click here to see the image>

Tick both boxes and click on "Procced to Unlock Instructions" <click here to see the image>

Follow carefully first 4 steps and click on "Proceed To Step 5" button. Ignore "Required Resources" section on the right side of the screen

Skip Step 5, 6, 7 and click on "Proceed To Step 8" button.

Open up command prompt ( Start > Run > type cmd and hit enter ). The window that appears is called Command Prompt. <click here to see the image>

Navigate to where you unzipped "mini-sdk" package (type in Command Prompt: cd c:\mini-sdk). Note: make sure the path is not c:\mini-sdk\mini-sdk

Follow very carefully steps 8 and 9. At the end click on "Submit" button.

You will receive an e-mail from HTCDev with Unlock_code.bin file attached and a link to the second part of the instructions.

Download Unlock_code.bin file from the e-mail you received and save it to c:\mini-sdk location.

In the Command Prompt type following command: fastboot flash unlocktoken Unlock_code.bin

On your device screen you will be now asked if you are sure that you want to unlock your bootloader. With volume keys navigate to proper answer and press power button to confirm. Keep in mind this procedure will wipe content of your data partition, including virtual SD card.

After it's done, your bootloader should have "UNLOCKED" text at the top.

Your bootloader is now unlocked. Whatever you want to do next, you need custom recovery for it. Every Android device has recovery partition, but with stock Android recovery you can't do much. Custom recoveries allows you to perform nandroid backup (backup content of your system, userdata and boot partitions) flash .zip packages (custom ROMs, mods, themes etc.) wipe content of your device and more. So let's flash custom recovery first. There are plenty of recoveries, including 4EXT, CWM, TWRP and more. Find the one you believe is best for you (make sure it's compiled for your device model!) and

Flashing custom recovery

What you need to know before flashing custom recovery:

After flashing custom recovery you can always revert to your stock recovery. This procedure will be described later.

Your bootloader needs to be "UNLOCKED". "LOCKED" or "RELOCKED" bootloaders can't flash custom recovery.

This operation will cause your bootloader to show "TAMPERED" text below "UNLOCKED".

For safety reasons, first what you should do is nandroid backup inside recovery. You might need it during "going back to stock" procedure.

Download custom recovery of your choice and rename it to recovery.img

Move recovery.img to c:\mini-sdk location

Connect your device to the PC

Boot your device in fastboot mode (like you did during unlocking bootloader - power off the device and turn it on using power + vol down buttons and select "FASTBOOT")

Open up command prompt ( Start > Run > type cmd and hit enter ). The window that appears is called Command Prompt. <click here to see the image>

Navigate to where you unzipped "mini-sdk" package (type in Command Prompt: cd c:\mini-sdk). Note: make sure the path is not c:\mini-sdk\mini-sdk

In the Command Prompt type following command: fastboot boot recovery.img (this command might not with newer hboots)

Command above will not permantently flash custom recovery, but it will just boot it. Why? Because that way we can backup your original, stock recovery image before we replace it with custom one.

Perform a nandroid backup.

After nandroid backup is done, reboot the device in fastboot mode again.

In the Command Prompt type following command: fastboot flash recovery recovery.img

Now that your bootloader is unlocked and you have custom recovery flashed, you should decide what you want to do next. Let's assume you want to flash a custom ROM.

Flashing custom ROM

What you need to know before flashing custom ROM:

There are many custom ROMs out there. Some of them are more or less modified versions of HTC stock ROMs with HTC Sense. You might also find some AOSP, AOKP or CM ROMs based on pure Android UI without any HTC software on it. Choice is yours. Personally, I recommend you optimized ROMs with HTC Sense on board.

After flashing custom ROM you can always revert to your stock ROM. This procedure will be described later.

Download custom ROM of your choice and copy it to the internal memory of your device (virtual SD card or other)

Boot your device in recovery mode (power off the device and turn it on using power + vol down buttons and select "RECOVERY")

In main menu, select "install zip from sdcard" and "choose zip from sdcard".

Navigate to the location of custom ROM (zip) package and confirm flashing procedure.

Follow the steps on the screen. Every developer use slightly different options in his ROM installer, so just make sure you read it carefully.

If you can't flash custom ROM due to AROMA freezes, there is nothing to be worried about. Just ask for help the developer of your custom ROM.

After flashing process is complete, reboot the device.

However, you might not want to use any of the custom ROMs available, but just be able to have root access on your device. This also can be easily done!

Rooting stock ROM

What you need to know before rooting stock ROM:

You can "un-root" it easily.

As long as you won't change any files on system partition, you still will be able to download and install official OTA updates.

Download Rooting Tools

Boot your device in recovery mode (power off the device and turn it on using power + vol down buttons and select "RECOVERY")

In main menu, select "install zip from sdcard" and "choose zip from sdcard".

Navigate to the location of Rooting Tools (zip) package and confirm flashing procedure.

After flashing process is complete, reboot the device. Your device has now SuperUser.apk, su binary and busybox installed.

If you are not happy with being rooted, or you can't find any custom ROM for your needs, or you need to sell/return your device and you want it to have stock software on board, it's very easy operation.

Going back to stock

What you need to know before going back to stock:

Your bootloader will never be "LOCKED" again. You can't restore it. You can only relock it.

"TAMPERED" text in bootloader will disappear only after proceeding method 2.

There are 3 main methods. All three will be described below.

Method 1 - only for users with .401 devices (for more info click here - RUU variants)

Visit this thread - [ROM] HTC One *STOCK* ROM

Download stock odexed version of most recent firmware and recovery.img

Move recovery.img to c:\mini-sdk location

Boot your device in recovery mode (power off the device and turn it on using power + vol down buttons and select "RECOVERY")

In main menu, select "install zip from sdcard" and "choose zip from sdcard".

Navigate to the location of stock ROM (zip) package and confirm flashing procedure.

After flashing process is complete, reboot the device in bootloader mode.

Connect your device to the PC

Boot your device in fastboot mode (like you did during unlocking bootloader - power off the device and turn it on using power + vol down buttons and select "FASTBOOT")

Open up command prompt ( Start > Run > type cmd and hit enter ). The window that appears is called Command Prompt. <click here to see the image>

Navigate to where you unzipped "mini-sdk" package (type in Command Prompt: cd c:\mini-sdk). Note: make sure the path is not c:\mini-sdk\mini-sdk

In the Command Prompt type following command: fastboot flash recovery recovery.img

You have now stock boot, system and recovery partitions. Time to relock your bootloader.

In the Command Prompt type following command: fastboot oem lock

Method 2 - flashing RUU (ROM Update Utility)

Visit this or this thread.

Find proper RUU for your device

Connect your device to the PC

Boot your device in fastboot mode (like you did during unlocking bootloader - power off the device and turn it on using power + vol down buttons and select "FASTBOOT")

Open up command prompt ( Start > Run > type cmd and hit enter ). The window that appears is called Command Prompt. <click here to see the image>

Navigate to where you unzipped "mini-sdk" package (type in Command Prompt: cd c:\mini-sdk). Note: make sure the path is not c:\mini-sdk\mini-sdk

In the Command Prompt type following command: fastboot oem lock

Flash RUU and follow on screen instructions.

You have now completely stock software on your device.

Method 3 - flashing nandroid backup

In custom recovery restore nandroid backup you did after flashing custom recovery for the first time.

If you performed nandroid backup before permanently flashing custom recovery, your stock recovery should be now flashed.

If you still have custom recovery, extract recovery.img from your nandroid backup.

Move recovery.img to c:\mini-sdk location

Connect your device to the PC

Boot your device in fastboot mode (like you did during unlocking bootloader - power off the device and turn it on using power + vol down buttons and select "FASTBOOT")

Open up command prompt ( Start > Run > type cmd and hit enter ). The window that appears is called Command Prompt. <click here to see the image>

Navigate to where you unzipped "mini-sdk" package (type in Command Prompt: cd c:\mini-sdk). Note: make sure the path is not c:\mini-sdk\mini-sdk

In the Command Prompt type following command: fastboot flash recovery recovery.img

You have now stock boot, system and recovery partitions. Time to relock your bootloader.

In the Command Prompt type following command: fastboot oem lock

Here are some videos you might find helpful:

1) by Flow-Wolf

How to Unlock the bootloader

How to Flash the recovery

How to root the HTC One

2) by udimars30

How to Unbrick/Unroot/Flash stock Rom Back on HTC ONE