flash through ch341a on linux

本文介绍如何在Ubuntu 16.04上使用Flashrom工具刷新GD25Q64 SPI闪存芯片。详细步骤包括安装必要的软件包如flashrom和ch341aflasher,使用Flashrom命令行工具进行设备检测、读取、写入和验证闪存操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Problem:

Found ch341a flashing sw have virus, so  move to Ubuntu 16.04 flashing.

Env:

apt-get install flashrom

gd25Q64

ch341a flasher

Steps:

1. help info

sudo flashrom -p ch341a_spi --help
flashrom v0.9.9-rc1-r1942 on Linux 4.4.0-87-generic (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Please note that the command line interface for flashrom has changed between
0.9.5 and 0.9.6 and will change again before flashrom 1.0.

Usage: flashrom [-h|-R|-L|-p <programmername>[:<parameters>] [-c <chipname>]
[-E|(-r|-w|-v) <file>] [-l <layoutfile> [-i <imagename>]...] [-n] [-f]]
[-V[V[V]]] [-o <logfile>]

 -h | --help                        print this help text
 -R | --version                     print version (release)
 -r | --read <file>                 read flash and save to <file>
 -w | --write <file>                write <file> to flash
 -v | --verify <file>               verify flash against <file>
 -E | --erase                       erase flash memory
 -V | --verbose                     more verbose output
 -c | --chip <chipname>             probe only for specified flash chip
 -f | --force                       force specific operations (see man page)
 -n | --noverify                    don't auto-verify
 -l | --layout <layoutfile>         read ROM layout from <layoutfile>
 -i | --image <name>                only flash image <name> from flash layout
 -o | --output <logfile>            log output to <logfile>
 -L | --list-supported              print supported devices
 -p | --programmer <name>[:<param>] specify the programmer device. One of
    internal, dummy, nic3com, nicrealtek, gfxnvidia, drkaiser, satasii, atavia,
    it8212, serprog, buspirate_spi, dediprog, rayer_spi, pony_spi, nicintel,
    nicintel_spi, nicintel_eeprom, ogp_spi, satamv, linux_spi, pickit2_spi,
    ch341a_spi.

2. device detect

 sudo flashrom -p ch341a_spi

flashrom v0.9.9-rc1-r1942 on Linux 4.4.0-87-generic (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Calibrating delay loop... OK.
Found GigaDevice flash chip "GD25Q64(B)" (8192 kB, SPI) on ch341a_spi.

3. nor wirte

sudo flashrom -p ch341a_spi -w FULL_FIRM_8M.bin
flashrom v0.9.9-rc1-r1942 on Linux 4.4.0-87-generic (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Calibrating delay loop... OK.
Found GigaDevice flash chip "GD25Q64(B)" (8192 kB, SPI) on ch341a_spi.
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.

4. nor read

 sudo flashrom -p ch341a_spi -r temp.bin
flashrom v0.9.9-rc1-r1942 on Linux 4.4.0-87-generic (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Calibrating delay loop... OK.
Found GigaDevice flash chip "GD25Q64(B)" (8192 kB, SPI) on ch341a_spi.
Reading flash... done.

 

 

 

 

 

 

### CH341A DKMS Driver Installation and Configuration For systems requiring the use of USB-to-serial converters, particularly those based on the CH340 or CH341 chipset like the CH341A, installing a compatible driver is essential to ensure proper functionality. The following details cover how one might go about setting up such drivers using DKMS (Dynamic Kernel Module Support), which allows for automatic rebuilding of kernel modules when new kernels are installed. #### Installing Dependencies Before proceeding with the installation of any third-party drivers including those for devices utilizing the CH341A chip, it's important that certain dependencies be present within the system environment. These typically involve development tools as well as headers specific to the Linux distribution being used. ```bash sudo apt-get update && sudo apt-get install -y build-essential linux-headers-$(uname -r) ``` #### Obtaining the CH341A Driver Source Code The source code necessary for building the CH341A driver can often be found through various repositories online; however, an official package from WCH (WinChipHead) may not always exist in all distributions' default software sources. One approach involves downloading precompiled binaries or fetching the latest version directly from GitHub projects dedicated to maintaining these drivers[^1]. Once obtained, extract the archive into a suitable directory before continuing further steps related to compilation and integration via DKMS. #### Setting Up DKMS Environment DKMS facilitates managing out-of-tree kernel modules by automatically recompiling them whenever there’s a change in the running kernel. To set this up specifically for the CH341A device: 1. Install `dkms` if not already available: ```bash sudo apt-get install dkms ``` 2. Copy the extracted folder containing the CH341A driver files into `/usr/src/ch341a-$version`, replacing `$version` appropriately according to what was downloaded earlier. 3. Create a configuration file named after your module inside `/etc/dkms/`. An example entry could look something like below but should match exactly whatever naming convention applies here: ```ini PACKAGE_NAME="ch341a" PACKAGE_VERSION="$version" CLEAN="" BUILT_MODULE_NAME[0]="ch341a" DEST_MODULE_LOCATION[0]="/kernel/drivers/usb/serial/" AUTOINSTALL=yes ``` 4. Add the newly created package information so DKMS recognizes it: ```bash sudo dkms add ch341a/$version ``` 5. Build and install the module against currently loaded kernel versions: ```bash sudo dkms build ch341a/$version sudo dkms install ch341a/$version ``` After completing above procedures successfully, verify whether the driver has been correctly registered under the active kernel space along with checking dmesg logs for confirmation messages regarding detection of connected hardware during boot time or upon plugging/unplugging actions performed later on. --related questions-- 1. What other methods besides DKMS can be utilized for loading custom USB serial converter drivers? 2. How does one troubleshoot issues encountered while trying to load the CH341A driver? 3. Is there support provided officially by manufacturers for newer generations of similar chips beyond CH341 series? 4. Can multiple different types of USB-to-UART bridges coexist without conflicts once their respective drivers have been properly configured?
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值