[vc_row][vc_column width=”1/1″][vc_column_text]PcDuino embedded linux development :Modifcation u-boot(—)
u-boot is kind of boot loader,boot loader .This small program with before the run of operating system kernel.Complete this small program,We can be initializes the hardware equipment、and the establishment of memory map,Thus the system hardware and software enviroment to a proper state.Uaually the boot loader is heavily dependent on hardware implementation,Especially in the embedded warld.So in the embedded world to establish a general boot loader is almost impossible.[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column width=”1/1″][vc_tour][vc_tab title=”Offcial u-boot introduction” tab_id=”1387353144-1-87″][vc_column_text]Official provide of u-boot can be perfect boot the kernel,but if used to study the embedded Linux development is not appropriate. The reason was that official provide u-boot without the network configuration information.The best check way serial port connection when system start debugging .when the computer have 3 seconds with stopping that you must enter any buttons,And then perform.
Ping LAN gateway
It will prompt haven’t this Ping of command,also no tftp ,nfs related commands,So what do you do.I will tell you best ways.Then must modified source to git,Pls directly download and used.
Specific modification process is:
Host machine: ubuntu-12.04(64位)
Target machine:pcDuino
Cross compiler: arm-linux-gnueabihf-gcc (安装sudo apt-get install g++-arm-linux-gnueabihf)
Download u-boot sound code:
git clone https://github.com/linux-sunxi/u-boot-sunxi.git
After download, view the branch
pillar@monster:~/study/kernel/u-boot-sunxi/u-boot-sunxi$ git branch -a
* sunxi
remotes/origin/HEAD -> origin/sunxi
remotes/origin/lichee-dev
remotes/origin/lichee-dev-a20
remotes/origin/lichee/lichee-dev
remotes/origin/lichee/lichee-dev-ICS
remotes/origin/lichee/lichee-dev-mmc
remotes/origin/old/sunxi-current
remotes/origin/sunxi
remotes/origin/wip/a20
You can see U-boot afficial website to download with have a lot of branch,So I will explain some problem:
Lichee-dev: support nand and TF card,but does not support network now pcDuino official release;
Sunxi and sunxi – current: support TF card, also support network, but does not support nand boot;
Here can only be changed in the official version, will git to switch to the official version.
git checkout lichee-dev
Before you modify the source code,I will tell you which first open.
NAND open is ROM->Boot0->boot1->uboot->linux kernel
SD open is ROM->spl->uboot->linux kernel
Allwinner have some ways:
First of all, the hardware connection according to the way
PcDuino < – > serial port < – > PC USB
PcDuino < – > OTG < – > PC USB
Open the serial debugging assistants, such as putty or within xshell tools., the system is powered on and then hold down the “1” key on the computer, when the system will automatically install the driver for the first time,finally the pop-up nanda partition
follow picture:
.
You can see the uImage, u – the boot in Linux folder, need only will you develop uImage and u – the boot can be copied to the corresponding position.
Here is how to modify the u – the boot, and then introduces an effective method.
[/vc_column_text][/vc_tab][vc_tab title=”Compile configuration u-boot ” tab_id=”1387353144-2-92″][vc_column_text]Official website to download support pcDuino u – the boot, not called pcDuino, it’s called a10 – evb, here don’t like to do the corresponding modification.
vim boards.cfg
189 sun4i arm armv7 pcDuino allwinner sunxi sun4i:SUNXI_EMAC
190 sun4i_sd arm armv7 a10-evb allwinner sunxi sun4i:SD_UART
191 sun5i_a12 arm armv7 a12-evb allwinner sunxi
192 sun5i_a13 arm armv7 a13-evb allwinner sunxi
193 sun5i_a13_sd arm armv7 a13-evb allwinner sunxi
In 189 lines of position changes, then add to configure the network in sun4i: SUNXI_EMAC, in source level plus pcDuino board support package.
pillar@monster:~/study/kernel/u-boot-sunxi$ cd board/allwinner/
a10-evb/ a13-evb/ pcDuino/
Is the a10 – evb copy into pcDuino, enter pcDuino, modify the inside of the file named pcDuino. C, and then modify the Makefile.
29 COBJS := pcDuino.o
Modify pcDuino
160 #ifdef CONFIG_DISPLAY_BOARDINFO
161 int checkboard(void)
162 {
163 puts(“Board: pcDuino\n”);
164 return 0;
165 }
166 #endif
Began to compile under the u – the boot
cd u-boot-sunxi
mkdir build
make distclean CROSS_COMPILE=arm-linux-gnueabihf-
make sun4i_config CROSS_COMPILE=arm-linux-gnueabihf- O=build
make CROSS_COMPILE=arm-linux-gnueabihf- O=build
After the compilation on pcDuino run, how to do ?
scp u-boot.bin Ubuntu@pcDuino的IP:/home/ubuntu/
sudo mount /dev/nanda /mnt
sudo chmod u+w linux
sudo cd linux
sudo rm u-boot.bin
sudo cp /home/Ubuntu/u-boot.bin .
sudo cd ..
sudo chmod u-w linux
sudo reboot
Stay in 3 seconds after restart stop position
This u-boot also does not support network function ,Just simply modify the board of name,
[/vc_column_text][/vc_tab][vc_tab title=”Modify support network function” tab_id=”1387358067022-2-1″][vc_column_text]First see the sunxi-current with inside source code, found that he has been in the boards initialization of the network, we can start from here
vim ./arch/arm/cpu/armv7/sunxi/board.c #add
157 #if defined(CONFIG_SUNXI_EMAC)
158 /*
159 * Initializes on-chip ethernet controllers.
160 * to override, implement board_eth_init()
161 */
162 int cpu_eth_init(bd_t *bis)
163 {
164 sunxi_emac_initialize(bis);
165
166 return 0;
167 }
168 #endif
Then sunxi – the inside of the current network card driver copy into the lichee – dev
cp ~/u-boot/drivers/net/sunxi_emac.c drivers/net/
Modify Makefile
vim drivers/net/Makefile #add
29 COBJS-$(CONFIG_SUNXI_EMAC) += sunxi_emac.o
Save after compiling, there must be some wrong here, now you only need to solve these errors, you can complete the u – the boot.The following is my all changes:
https://github.com/Pillar1989/sunxi-u-boot/blob/lichee-dev/diff.log
And ++ meaning add then – meaning delete
So you can see my git warehouse https://github.com/Pillar1989/sunxi-u-boot
Download test
sun4i# tftp 0×46000000 uImage
Using emac device
TFTP from server 192.168.2.3; our IP address is 192.168.2.22
Filename ‘uImage’.
Load address: 0×46000000
Loading: #################################################################
#############################################
done
Bytes transferred = 1611552 (189720 hex)
sun4i#tftp 0×49000000 dts/sun4i-a10-cubieboard.dtb
Using emac device
TFTP from server 192.168.2.3; our IP address is 192.168.2.22
Filename ‘dts/sun4i-a10-cubieboard.dtb’.
Load address: 0×49000000
Loading: #
done
Bytes transferred = 7940 (1f04 hex)
sun4i#bootm 0×46000000 – 0×49000000
## Booting kernel from Legacy Image at 46000000 …
Image Name: Linux-3.12.0-10089-gf16892f-dirt
Created: 2013-11-19 12:28:56 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1611488 Bytes = 1.5 MiB
Load Address: 40008000
Entry Point: 40008000
Verifying Checksum … OK
Loading Kernel Image … OK
OK
Starting kernel …
Ending everyone see the perfect support TFTP download,,Next time I will explain what’s TFTP server and nfs server,etc.[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]
Leave a Reply
You must be logged in to post a comment.