U-bootMore and more development boards are supported by processors that support multiple architectures. BecauseBootloaderIs completely dependent on the hardware platform, so it needs to be transplanted on the new circuit boardU-bootProgram.
Start portingU-bootBefore that, you must be familiar with hardware circuit boards and processors. ConfirmU-bootWhether the processors andI/ODevice. Assume thatU-bootA very similar circuit board is already supported, so the porting process will be very simple.
PortU-bootThe job is to add the development board hardware-related files, configuration options, and then configure the compilation.
Before starting the migration, analyzeU-bootThe supported development board compares the Development Board with the closest hardware configuration. The principle is that the processor architecture is the same first, and then the peripheral interfaces such as Ethernet interfaces. Also verifyU-bootAt least the compilation can be configured.
with S3C2410 processor development board as an example, U-Boot-1.1.2 version smdk2410 Development Board. We can port a smdk2410 , first, set smdk2410 compiled.
We useS3C2410Development BoardFs2410For example. Migration Process referenceSmdk2410Development Board,Smdk2410InU-Boot-1.1.2.
PortU-bootThe basic steps are as follows.
(1) At the top layerMakefileAdd new configuration options for the development board. Use an existing configuration item as an example.
Smdk2410_config: unconfig
@./Mkconfig $ (@: _ Config =) arm ARM920T smdk2410 null s3c24x0
Refer to the above2Line, add the following2Line.
Fs2410_config: unconfig
@./Mkconfig $ (@: _ Config =) arm ARM920T fs2410 null s3c24x0
(2) Create a new directory to storeCodeAnd add files.
Board/fs2410/config. mk
Board/fs2410/flash. c
Board/fs2410/fs2410.c
Board/fs2410/makefile
Board/fs2410/memsetup. s
U-boot.lds/board/fs2410/
(3) Add a new configuration file for the Development Board
You can copy and modify the configuration file of the Development Board. For example:
$ CP include/configs/smdk2410.h include/configs/fs2410.h
For a newCPUAnd create a new directory for storage.CPURelated code.
(4) Configure the Development Board
$ Make fs2410_config
(5) CompileU-boot
RunMakeCommand.U-bootImage. Some errors are related to the configuration options. Generally, opening some function options will lead to some errors. You can try to make the same configuration as the reference board at the beginning.
(6) Add driver or function options
On the basis of compilationU-bootEthernet interface,FlashWrite and erase functions.
ForFs2410Ethernet driver andSmdk2410They are identical, so they can be used directly.CS8900The driver file is as follows.
Drivers/cs8900.c
Drivers/cs8900.h
ForFlashThe selection is much more troublesome,FlashChip prices or procurement factors have an impact. The size and model of most development boards are different. Therefore, you also need to PortFlash. Under each Development Board directoryFlash. cThis file depends on the specificFlashType modification. For example:
Board/fs2410/flash. c
(7) DebuggingU-bootSource codeUntilU-bootIt can be started properly on the Development Board.
The debugging process may be difficult and requires tools, and some problems may be difficult for a long time.