Flash Barcelona Firmware (SPI Nor Flash) - ihipop/winsun_mininas_v1 GitHub Wiki
Required files
gen5_dc2G.bin
Intel CEFDK bootloader for barcelona, provided by inventec
gen5_pm8051.bin
8051 firmware for barcelona, provided by inventec
kbl
kbl stands for kernel boot loader. The file is renamed from a bzImage (kernel) file generated in custom CEFDK build.
logo.bmp
splash screen image file. optional.
Objective
Following is an example result.
Type ID Active Offset Size Label
cefdk_s1 00 YES 0x00000000 0x00010000
cefdk_s2 00 YES 0x00010000 0x0006F000
cefdk_s1h 00 YES 0x0007f000 0x00000800
cefdk_s2h 00 YES 0x0007f800 0x00000800
uc8051_fw 00 YES 0x00080800 0x00010000
plat_params 00 YES 0x00090800 0x00010000
cefdk_params 00 YES 0x000a0800 0x000005F0
script 00 YES 0x000a0df0 0x00000800
kernel 00 YES 0x000a15f0 0x002AAD10
user flash 00 NO 0x00400000 0x00000000
The first four entries are CEFDK bootloader file, provided by gen5.bin. uc8051_fw
is 8051 firmware.
platform_params
, cefdk_params
and script
are data generated by CEFDK shell commands. They all have fixed size. Their order depends on the order you issue CEFDK shell commands. The order doesn't matter.
kernel
is our kbl, kernel bootloader, which is itself a linux kernel but used to boot another linux kernel.
The SPI Nor flash size is 4M Bytes on Barcelona. user flash
is the boundary between CEFDK managed region and user managed region. Here we set it to 4M Bytes to let the CEFDK manage whole flash.
All entries before kernel have fixed size; the kbl size may change, depending on kernel build configuration and ramdisk files.
It's possible to flash a splash
screen image file into SPI Nor Flash. This is optional.
Terminal
You need a serial terminal emulator software (such as minicom on linux) to communicate with Barcelona via on-board UART port.
The terminal software must support ymodem protocol for sending files to Barcelona.
It is recommended to do these steps on Windows, because CEFDK shell seemingly assumes a DOS terminal.
minicom works, but many symbols (lines, tabulation symbols, etc) are incorrectly displayed.
Let's Do It
WARNING
The first step, mfh init
command is dangerous. It is the only command you can brick the board. Be sure when you issue this command, there is a reliable power supply to the board.
Flash CEFDK bootloader
Boot bacelona into CEFDK shell, and:
shell > mfh init 0x400000
A warning displayed, press ENTER to pass it.
Press Ctrl-A
, then z, then s, choose ymodem in upload list.
Press ENTER. input the full path to gen5_dc2G.bin file and press ENTER.
Waiting for a while, if upload is success, the CEFDK will flash the chip and returns to shell, indicating a success. If upload fails, it's OK. Error message will be displayed in shell and you can try the command again. There is no danger as long as the power supply is good.
Now the mfh list looks like this:
shell > mfh list
MFH Entry List
Type ID Active Offset Size Label
cefdk_s1 00 YES 0x00000000 0x00010000
cefdk_s2 00 YES 0x00010000 0x0006F000
cefdk_s1h 00 YES 0x0007f000 0x00000800
cefdk_s2h 00 YES 0x0007f800 0x00000800
user flash 00 NO 0x00400000 0x00000000
If you reboot the board via reset
command, the brand new CEFDK will prompt several questions, because platform parameters are lost. You can type c
to cancel and proceed to next step.
It is not necessary and not recommended to reboot the board now.
Flash 8051 firmware
The command is:
> mfh add 8051_fw 0
then upload gen5_pm8051.bin
through ymodem protocol.
Now MFH list looks like this:
shell> mfh list
MFH Entry List
Type ID Active Offset Size Label
cefdk_s1 00 YES 0x00000000 0x00010000
cefdk_s2 00 YES 0x00010000 0x0006F000
cefdk_s1h 00 YES 0x0007f000 0x00000800
cefdk_s2h 00 YES 0x0007f800 0x00000800
uc8051_fw 00 YES 0x00080800 0x00010000
user flash 00 NO 0x00400000 0x00000000
cefdk_params
Create cefdk_params
stores user settings after you issue settings
command. Much like the BIOS settings in PC.
Do this:
> settings
There are three sections: About, Standard Features and Advanced Features.
Actually the default settings are prefect for production. Nothing need to be changed. So just press F3
to save default settings into flash.
shell> mfh list
MFH Entry List
Type ID Active Offset Size Label
cefdk_s1 00 YES 0x00000000 0x00010000
cefdk_s2 00 YES 0x00010000 0x0006F000
cefdk_s1h 00 YES 0x0007f000 0x00000800
cefdk_s2h 00 YES 0x0007f800 0x00000800
uc8051_fw 00 YES 0x00080800 0x00010000
cefdk_params 00 YES 0x00090800 0x000005F0
user flash 00 NO 0x00400000 0x00000000
plat_params
Create platform parameters includes some data that is not a part of BIOS setting but required by CEFDK bootloader, including but not limited to:
- serial number
- part number
- p2p uid
- eth mac address
Add serial number, the serial number is printed on the label on board.
> mfh add serial_num 801DNN00006
Add P2P UID, p2p uid is 20 characters long. We have no idea what's it for. But if we do not provide this number, each time the board is rebooted, a question will be prompted to ask for it.
> mfh add p2p_uid 12345678901234567890
Add Ethernet MAC address. The MAC address is also printed on label.
> mfh add lan_eeprom 0x00 0x1E 0x33 0x10 0x40 0x05
shell> mfh list
MFH Entry List
Type ID Active Offset Size Label
cefdk_s1 00 YES 0x00000000 0x00010000
cefdk_s2 00 YES 0x00010000 0x0006F000
cefdk_s1h 00 YES 0x0007f000 0x00000800
cefdk_s2h 00 YES 0x0007f800 0x00000800
uc8051_fw 00 YES 0x00080800 0x00010000
cefdk_params 00 YES 0x00090800 0x000005F0
plat_params 00 YES 0x00090df0 0x00010000
user flash 00 NO 0x00400000 0x00000000
Create boot script
issue script on
command, input boot command as following, press ENTER twice.
shell> script on
Item not found in mfh table
No auto script in flash.
If want to keep current script, please just hit 'Enter'.
>>> bootkernel -id 0 "console=tty0 console=ttyS0,115200"
>>>
Now
shell> mfh list
MFH Entry List
Type ID Active Offset Size Label
cefdk_s1 00 YES 0x00000000 0x00010000
cefdk_s2 00 YES 0x00010000 0x0006F000
cefdk_s1h 00 YES 0x0007f000 0x00000800
cefdk_s2h 00 YES 0x0007f800 0x00000800
uc8051_fw 00 YES 0x00080800 0x00010000
cefdk_params 00 YES 0x00090800 0x000005F0
plat_params 00 YES 0x00090df0 0x00010000
script 00 YES 0x000a0df0 0x00000800
user flash 00 NO 0x00400000 0x00000000
Flash kernel bootloader
> mfh add kernel 0
upload kbl file to flash. This takes quite a few minutes.
Now, the final result is here:
shell> mfh list
MFH Entry List
Type ID Active Offset Size Label
cefdk_s1 00 YES 0x00000000 0x00010000
cefdk_s2 00 YES 0x00010000 0x0006F000
cefdk_s1h 00 YES 0x0007f000 0x00000800
cefdk_s2h 00 YES 0x0007f800 0x00000800
uc8051_fw 00 YES 0x00080800 0x00010000
cefdk_params 00 YES 0x00090800 0x000005F0
plat_params 00 YES 0x00090df0 0x00010000
script 00 YES 0x000a0df0 0x00000800
kernel 00 YES 0x000a15f0 0x00227A30
user flash 00 NO 0x00400000 0x00000000
Now you can reboot the board via reset
command. If either USB bootable disk is plugged or emmc partition is bootable, the board will boot into linux system. Otherwise, it will boot into a shell.
Observe this in the serial console.