forked from EliasKotlyar/Xiaomi-Dafang-Hacks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rework for better understandability
- Loading branch information
Showing
1 changed file
with
36 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,89 @@ | ||
# Flashing an Open-Source U-Boot | ||
# Flashing an open source U-Boot bootloader | ||
|
||
## What benefits does this open source bootloader have? | ||
|
||
1. You can use H264 FullHD Streaming (1920x1080)(128MB devices only) | ||
2. You can boot your own kernel/rootfs/whatever from MicroSD | ||
1. You can use H264 FullHD streaming (1920x1080)(on 128MB devices only) | ||
2. You can boot your own kernel/rootfs from MicroSD | ||
3. You can change your kernel boot-parameters (uEnv.txt) | ||
4. You can flash your NAND using this bootloader | ||
5. It should work on nearly all T20 based devices. | ||
5. It should work on most T20 based devices. | ||
6. The parameters could be changed through fw_printenv | ||
7. It is completely open source - Check the source here: https://github.com/Dafang-Hacks/uboot | ||
|
||
7. It is completely [open source](https://github.com/Dafang-Hacks/uboot) | ||
|
||
## What are the disadvantages? | ||
You can brick your device, if you flash the wrong u-boot. I am not taking any responsibility for that! | ||
If you flash the wrong u-boot, you can brick your device. I am not taking any responsibility for that! | ||
|
||
## Requirements: | ||
|
||
1. Find out how much RAM your device have by running following command via SSH: | ||
1. Determine how much RAM your device has by running following command via SSH: | ||
```$bash | ||
[root@DafangHacks:~]# cat /proc/cmdline | ||
cat /proc/cmdline | ||
``` | ||
|
||
|
||
You will get an output similar to that: | ||
You should get an output like this: | ||
|
||
```$bash | ||
console=ttyS1,115200n8 mem=104M@0x0 ispmem=8M@0x6800000 rmem=16M@0x7000000 init=/linuxrc root=/dev/mmcblk0p2 rootwait rootfstype=ext4 rw mtdparts=jz_sfc:256k(boot),2048k(kernel),3392k(root),640k(driver),4736k(appfs),2048k(backupk),640k(backupd),2048k(backupa),256k(config),256k(para),-(flag) | ||
``` | ||
|
||
Count together the values from each "mem"-section: | ||
Sum up the values from each "mem"-section: | ||
|
||
mem = 104M | ||
|
||
rmem = 16M | ||
|
||
ispmem = 8M | ||
|
||
-> Together 128M -> You have a 128Mb Ram Device | ||
-> Together 128M -> You have a device with 128 Mb RAM. | ||
|
||
## Flashing U-Boot: | ||
## Flashing the U-Boot bootloader: | ||
|
||
1. Login via SSH | ||
2. Get one of the following Files according to your amount of Ram & your device: | ||
https://github.com/Dafang-Hacks/uboot/tree/master/compiled_bootloader | ||
|
||
3. Put the File to your microsd | ||
4. **Verify the MD5 Hash of the file!! Do not skip this step, or you may brick your cam!** | ||
3. Run following command | ||
2. Get the correct [bootloader](https://github.com/Dafang-Hacks/uboot/tree/master/compiled_bootloader) for your device and RAM size. | ||
3. Put the bootloader file on your microsd | ||
4. **Verify the MD5 hash of the file!! Do not skip this step or you may brick your camera!** | ||
3. Run following commands | ||
|
||
```bash | ||
flash_eraseall /dev/mtd0 | ||
``` | ||
```bash | ||
dd if=<filename.bin> of=/dev/mtd0 | ||
``` | ||
Don't do anything stupid inbetween. | ||
If you crash your camera, you end up without a working bootloader. | ||
|
||
## Verify that the U-Boot-Loader works correctly | ||
1. Get an uEnv.bootfromnand.txt file from *__* this repository. | ||
2. Rename the uEnv.bootfromnand.txt to uEnv.txt | ||
3. Reboot your camera | ||
|
||
## Verifying the U-Boot-Loader | ||
1. Get a uEnv.bootfromnand.txt file from*__* this repository. | ||
1. Rename the uEnv.bootfromnand.txt to uEnv.txt | ||
2. Boot your camera | ||
|
||
The bootloader is configured to enable the blue-led if it takes the configuration from the uEnv.txt as soon as it boots up. | ||
The bootloader is configured to enable the blue led if it has found a valid uEnv.txt during boot up. | ||
Take a look at your LED when it first turns on. | ||
|
||
If it turns yellow -> The normal configuration is being taken | ||
If the led turns yellow -> The default configuration is used. | ||
|
||
If it turns blue -> Custom Configuration from uEnv.txt is being taken. | ||
If the led turns blue -> The custom configuration from uEnv.txt is used. | ||
|
||
If its not turning blue despite that you have a uEnv.txt on your microsd - try to format it as FAT16 and try again | ||
If the led is not turning blue despite having an uEnv.txt on your microsd - try to format the sdcard as FAT16 and try again. | ||
|
||
|
||
## Turning on FULLHD(128Mb Devices only): | ||
## Enable FullHD (on 128 Mb devices only): | ||
|
||
Open up the uEnv.txt file and change the "boot-line" from | ||
|
||
mem=104M@0x0 ispmem=8M@0x6800000 rmem=16M@0x7000000 | ||
`mem=104M@0x0 ispmem=8M@0x6800000 rmem=16M@0x7000000` | ||
|
||
to | ||
|
||
mem=87M@0x0 ispmem=9M@0x5700000 rmem=32M@0x6000000 | ||
`mem=87M@0x0 ispmem=9M@0x5700000 rmem=32M@0x6000000` | ||
|
||
|
||
Check if its being applied using the following command: | ||
Check if the bootline has been applied properly using the following command: | ||
|
||
```$bash | ||
[root@DafangHacks:~]# cat /proc/cmdline | ||
``` | ||
|
||
|
||
|
||
## My camera doesn't boot/I have failed flashing the bootloader - what now? | ||
You will need to desolder your chip, reflash it and solder it back. | ||
Here is information about how to do it: | ||
https://github.com/Dafang-Hacks/spiflasher | ||
## My camera doesn't boot/I have failed to flash the bootloader. What can I do now? | ||
You will need to desolder your bootrom, [reflash it](https://github.com/Dafang-Hacks/spiflasher) and solder it back. |