├── upgrade_tool ├── revision.txt └── README.md /upgrade_tool: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vicharak-in/Linux_Upgrade_Tool/HEAD/upgrade_tool -------------------------------------------------------------------------------- /revision.txt: -------------------------------------------------------------------------------- 1 | v1.28 revision: 2 | 1.support to download sparse image and erase verity info 3 | 2.support to erase emmc using erase_lba 4 | 5 | v1.3 revision: 6 | 1.support gpt download 7 | 2.add pl to read partition info from device 8 | 9 | v1.31 revision: 10 | 1.UL decide to if reset or not after upgrade loader 11 | 2.add "rb_check_off"flag in the config.ini.close readback check when set rb_check_off=true 12 | 13 | v1.32 revision: 14 | 1.DI command add -u -t -re for uboot trust resource 15 | 2.DI command chane calling convension of download multi image 16 | 3.config.ini place in the $HOME/.config/upgrade_tool/ 17 | 18 | v1.33 revision: 19 | 1.support fixed uuid in the gpt 20 | add one line as following in the parameter: 21 | uuid:partition_name=00000000-0000-0000-0000-000000000000 22 | 23 | v1.34 revision: 24 | fix prepare_gpt_backup bug 25 | 26 | v1.35 revision: 27 | 1.support do operateion on specific device by sn 28 | 2.add rid rfi rci rcb of shell mode 29 | 3.when not found config.ini in ~./.config/upgrade_tool/,move ./config.ini 30 | 31 | v1.36 revision: 32 | 1.fix move file pointer most in the fill chunk of sparse format 33 | 34 | v1.37 revision: 35 | 1.add EL to erase lba data 36 | 37 | v1.38 revision: 38 | 1.fix get flash size bug when creating gpt bug 39 | 40 | v1.39 revision: 41 | 1.support to write sn into vendor 42 | 2.optimize progress output 43 | 44 | v1.4 revision: 45 | 1.destroy gpt when download parameter 46 | 2.change timeout of usb transfer to 5s 47 | 48 | v1.41 revision: 49 | 1. add RL into console mode 50 | 51 | v1.42 revision: 52 | 1. add release interface into uninitializeUsb 53 | 54 | v1.43 revision: 55 | 1. judge device by location_id in the wait function 56 | 57 | v1.45 revision: 58 | 1.location_id support 7 level 59 | 60 | v1.46 revision: 61 | 1.fix compute last partition size bug during download sparse image 62 | 63 | v1.47 revision: 64 | 1.fix parse uuid bug 65 | 66 | v1.48 revision: 67 | 1.optimize download progress 68 | 2.check size if larger than partition 69 | 70 | v1.49 revision: 71 | 1.support to switch uvc into rockusb 72 | 73 | v1.5 revision 74 | 1.add log on download image 75 | 76 | v1.51 revision 77 | 1.support nor flash erase 78 | 79 | v1.52 revision 80 | 1.support ubi image download 81 | 82 | v1.53 revision 83 | 1.support New IDB download 84 | 85 | v1.54 revision 86 | 1.add gpt command for converting parameter into gpt image 87 | 88 | v1.55 revision 89 | 1.support to run repeatly 90 | 91 | v1.56 revision 92 | 1.support to download loader on spi/sfc nand flash(4k page) 93 | 94 | v1.57 revision 95 | 1.fix download ubi image bug 96 | 97 | v1.58 revision 98 | 1.move libusb_init into search step 99 | 100 | v1.59 revision 101 | 1.fix check download size bug at RKA_File_Download 102 | 103 | v1.6 revision 104 | 1.fix chunk size larger than 4g in sparse download 105 | 106 | v1.61 revision(2021/02/04) 107 | 1.When erasing ubi,cut 4 blocks off 108 | 109 | v1.62 revision(2021/03/23) 110 | 1.modify last use lba on gpt,assure that align with 64 sectors 111 | 112 | v1.63 revision(2021/04/21) 113 | 1.add mutex robust attr to avoid process exit without unlock 114 | 115 | v1.64 revision(2021/04/22) 116 | 1.add 'RUN' to execute code from ram 117 | 118 | v1.65 revision(2021/04/30) 119 | 1.fix last used lba on gpt bug 120 | 121 | v1.66 revision(2021/05/21) 122 | 1.modify default of rb_check_off as true when no config.ini 123 | 2.add log_off into config.ini 124 | 125 | v1.67 revision(2021/07/02) 126 | 1.fix download ubi image bug when ubi image is in the last partition 127 | 128 | v2.0 revision(2021/08/23) 129 | 1.add switch storage function 130 | 2.support upgrade loader with storage 131 | 132 | v2.1 revision(2021/11/11) 133 | 1.add function to check pagesize for ubi image 134 | 2.destrory gpt content when download parameter 135 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Linux Upgrade Tool 2 | 3 | Rockchip's **Linux Upgrade tool** is a proprietary solution developed by the company 4 | for flashing images onto various storage devices such as 5 | `SPI`, `eMMC`, `SD Card`, and more. 6 | Unlike open-source [rkdeveloptool](https://github.com/rockchip-linux/rkdeveloptool) 7 | software, this tool does not provide access to its source code. 8 | 9 | Instead, it is distributed solely in **binary executable** form, 10 | allowing users to utilize the provided executable files for the purpose of 11 | flashing images onto their desired storage devices. 12 | 13 | ## How to use Linux Upgrade Tool 14 | 15 | ### Installing required system dependencies 16 | 17 | Linux Upgrade Tool requires the following dependencies to be installed 18 | on your Debian or Ubuntu system. 19 | 20 | ```bash 21 | sudo apt-get install libudev-dev libusb-1.0-0-dev 22 | ``` 23 | 24 | --- 25 | 26 | For other Linux distributions, please refer to the following table 27 | for the equivalent package names. 28 | 29 | | Debian/Ubuntu | Fedora | Arch Linux | 30 | | :--------------: | :----------: | :--------: | 31 | | libudev-dev | | | 32 | | libusb-1.0-0-dev | libusb-devel | libusb | 33 | 34 | --- 35 | 36 | ### Linux Upgrade Tool Usage 37 | 38 | ```text 39 | ---------------------Tool Usage --------------------- 40 | Help: H 41 | Version: V 42 | Log: LG 43 | ------------------Upgrade Command ------------------ 44 | ChooseDevice: CD 45 | ListDevice: LD 46 | SwitchDevice: SD 47 | UpgradeFirmware: UF [-noreset] 48 | UpgradeLoader: UL [-noreset] [FLASH|EMMC|SPINOR|SPINAND] 49 | DownloadImage: DI <-p|-b|-k|-s|-r|-m|-u|-t|-re image> 50 | DownloadBoot: DB 51 | EraseFlash: EF 52 | PartitionList: PL 53 | WriteSN: SN 54 | ReadSN: RSN 55 | ReadComLog: RCL 56 | CreateGPT: GPT 57 | SwitchStorage: SSD 58 | ----------------Professional Command ----------------- 59 | TestDevice: TD 60 | ResetDevice: RD [subcode] 61 | ResetPipe: RP [pipe] 62 | ReadCapability: RCB 63 | ReadFlashID: RID 64 | ReadFlashInfo: RFI 65 | ReadChipInfo: RCI 66 | ReadSecureMode: RSM 67 | WriteSector: WS 68 | ReadLBA: RL [File] 69 | WriteLBA: WL [SizeSec] 70 | EraseLBA: EL 71 | EraseBlock: EB [--Force] 72 | RunSystem: RUN 73 | ------------------------------------------------------- 74 | ``` 75 | 76 | You can use the above command by using `sudo ./upgrade_tool` prefix 77 | before any of the command. 78 | 79 | **For example to erase flash:** 80 | 81 | ```bash 82 | sudo ./upgrade_tool db 83 | sudo ./upgrade_tool ef 84 | ``` 85 | 86 | ### Flashing RAW image using Linux_Upgrade_Tool 87 | 88 | RAW images can be flashed to any storage device using the `dd` command or the `Linux_Upgrade_Tool`. 89 | 90 | #### Check for connected devices 91 | 92 | ```bash 93 | sudo ./upgrade_tool ld 94 | ``` 95 | 96 | ```text 97 | List of rockusb connected(1) 98 | 99 | DevNo=1 Vid=0x2207,Pid=0x330c,LocationID=7143 Mode=Maskrom SerialNo= 100 | ``` 101 | 102 | #### Flash the loader binary 103 | 104 | ```bash 105 | sudo ./upgrade_tool db rk3399_loader_xxx.bin 106 | ``` 107 | 108 | ```text 109 | Download boot ok. 110 | ``` 111 | 112 | #### Flash the RAW GPT image to storage device 113 | 114 | > :warning: 115 | > Make sure to flash the loader first to the storage device. 116 | 117 | ```bash 118 | sudo ./upgrade_tool wl 0 .img 119 | ``` 120 | 121 | Example: 122 | 123 | ```bash 124 | sudo ./upgrade_tool wl 0 Vicharak_Vaaman_RAW_debian_bullseye_XFCE_beta_v0.1.0_08072023.img 125 | ``` 126 | 127 | ```text 128 | Write LBA OK. 129 | ``` 130 | 131 | #### Reboot the device 132 | 133 | ```bash 134 | sudo ./upgrade_tool rd 135 | ``` 136 | 137 | ```text 138 | [sudo] password for vicharak: 139 | 140 | Reset Device Success! 141 | ``` 142 | 143 | > :grey_exclamation: 144 | > If you encounter **Reset Device Fail!** then try to manually reboot \ 145 | > using the power button on the board. 146 | 147 | --- 148 | 149 | **Alternatively you can directly flash update image to eMMC 150 | using `upgrade firmware` method.** 151 | 152 | ### Flash eMMC image using (upgrade firmware) method 153 | 154 | ```bash 155 | sudo ./upgrade_tool uf .img 156 | ``` 157 | 158 | Example: 159 | 160 | ```bash 161 | sudo ./upgrade_tool uf Vicharak_Vaaman_EMMC_debian_bullseye_XFCE_beta_v0.1.0_03072023.img 162 | ``` 163 | 164 | ```text 165 | [sudo] password for vicharak: 166 | Loading firmware... 167 | Support Type:330C FW Ver:8.1.00 FW Time:2023-07-07 14:11:41 168 | Loader ver:1.1e Loader Time:2023-07-07 14:11:08 169 | Start to upgrade firmware... 170 | Download Boot Start 171 | Download Boot Success 172 | Wait For Maskrom Start 173 | Wait For Maskrom Success 174 | Test Device Start 175 | Test Device Success 176 | Check Chip Start 177 | Check Chip Success 178 | Get FlashInfo Start 179 | Get FlashInfo Success 180 | Prepare IDB Start 181 | Prepare IDB Success 182 | Download IDB Start 183 | Download IDB Success 184 | Download Firmware Start 185 | Download Image... (12%) 186 | ``` 187 | --------------------------------------------------------------------------------