你們一塊兒玩U-boot DIY

本帖子歡迎你們來回復提供更多diy教程。
先上個人DIY做品(想試的看教程3):php

U-Boot 2013.07-rc1 (Jun 21 2013 - 20:44:00) TonyLianLong Software(亮點1)
linux

QQ:1040424979(亮點2)
git

CPU:   TLL A10 CPU(亮點3)
ubuntu

Board: TLL board(亮點4)
網絡

I2C:   ready
app

DRAM:  1 GiB
函數

MMC:   SUNXI SD/MMC: 0
oop

In:    serial
ui

Out:   serial
spa

Err:   serial

Net:   emac

Hit any key to stop autoboot:  0 

sun4i#version

U-Boot 2013.07-rc1 (Jun 21 2013 - 20:44:00) TonyLianLong Software

QQ:1040424979(這也是)

arm-linux-gnueabi-gcc (Ubuntu/Linaro 4.7.1-5ubuntu1~ppa1) 4.7.1

GNU ld (GNU Binutils for Ubuntu) 2.22.52.20120713


教程0,下載uboot源碼:
這裏從http://www.tonylianlong.com下載,TLL提供技術和空間支持

wget http://www.tonylianlong.com/file/2013-6-21/u-boot-sunxi.zip

unzip u-boot-sunxi

cd u-boot-sunxi


教程1,添加驅動(以NAND爲例):
A 一個一個添加:

nano include/config_cmd_default.h


而後在裏面(#endif前)添加:

#define CONFIG_CMD_NAND


便可
提供驅動表,按照上面的方式,只不過是要把CONFIG_CMD_NAND替換成你要的:

The default command configuration includes all commands

                except those marked below with a "*".

不帶*的是必須的

                CONFIG_CMD_ASKENV        * ask for env variable

                CONFIG_CMD_BDI                  bdinfo

                CONFIG_CMD_BEDBUG        * Include BedBug Debugger

                CONFIG_CMD_BMP                * BMP support

                CONFIG_CMD_BSP                * Board specific commands

                CONFIG_CMD_BOOTD          bootd

                CONFIG_CMD_CACHE        * icache, dcache

                CONFIG_CMD_CONSOLE          coninfo

                CONFIG_CMD_CRC32        * crc32

                CONFIG_CMD_DATE                * support for RTC, date/time...

                CONFIG_CMD_DHCP                * DHCP support

                CONFIG_CMD_DIAG                * Diagnostics

                CONFIG_CMD_DS4510        * ds4510 I2C gpio commands

                CONFIG_CMD_DS4510_INFO        * ds4510 I2C info command

                CONFIG_CMD_DS4510_MEM        * ds4510 I2C eeprom/sram commansd

                CONFIG_CMD_DS4510_RST        * ds4510 I2C rst command

                CONFIG_CMD_DTT                * Digital Therm and Thermostat

                CONFIG_CMD_ECHO                  echo arguments

                CONFIG_CMD_EDITENV          edit env variable

                CONFIG_CMD_EEPROM        * EEPROM read/write support

                CONFIG_CMD_ELF                * bootelf, bootvx

                CONFIG_CMD_ENV_CALLBACK        * display details about env callbacks

                CONFIG_CMD_ENV_FLAGS        * display details about env flags

                CONFIG_CMD_EXPORTENV        * export the environment

                CONFIG_CMD_EXT2                * ext2 command support

                CONFIG_CMD_EXT4                * ext4 command support

                CONFIG_CMD_SAVEENV          saveenv

                CONFIG_CMD_FDC                * Floppy Disk Support

                CONFIG_CMD_FAT                * FAT command support

                CONFIG_CMD_FDOS                * Dos diskette Support

                CONFIG_CMD_FLASH          flinfo, erase, protect

                CONFIG_CMD_FPGA                  FPGA device initialization support

                CONFIG_CMD_FUSE                  Device fuse support

                CONFIG_CMD_GETTIME        * Get time since boot

                CONFIG_CMD_GO                * the 'go' command (exec code)

                CONFIG_CMD_GREPENV        * search environment

                CONFIG_CMD_HASH                * calculate hash / digest

                CONFIG_CMD_HWFLOW        * RTS/CTS hw flow control

                CONFIG_CMD_I2C                * I2C serial bus support

                CONFIG_CMD_IDE                * IDE harddisk support

                CONFIG_CMD_IMI                  iminfo

                CONFIG_CMD_IMLS                  List all images found in NOR flash

                CONFIG_CMD_IMLS_NAND          List all images found in NAND flash

                CONFIG_CMD_IMMAP        * IMMR dump support

                CONFIG_CMD_IMPORTENV        * import an environment

                CONFIG_CMD_INI                * import data from an ini file into the env

                CONFIG_CMD_IRQ                * irqinfo

                CONFIG_CMD_ITEST          Integer/string test of 2 values

                CONFIG_CMD_JFFS2        * JFFS2 Support

                CONFIG_CMD_KGDB                * kgdb

                CONFIG_CMD_LDRINFO          ldrinfo (display Blackfin loader)

                CONFIG_CMD_LINK_LOCAL        * link-local IP address auto-configuration

                                          (169.254.*.*)

                CONFIG_CMD_LOADB          loadb

                CONFIG_CMD_LOADS          loads

                CONFIG_CMD_MD5SUM          print md5 message digest

                                          (requires CONFIG_CMD_MEMORY and CONFIG_MD5)

                CONFIG_CMD_MEMINFO        * Display detailed memory information

                CONFIG_CMD_MEMORY          md, mm, nm, mw, cp, cmp, crc, base,

                                          loop, loopw

                CONFIG_CMD_MEMTEST          mtest

                CONFIG_CMD_MISC                  Misc functions like sleep etc

                CONFIG_CMD_MMC                * MMC memory mapped support

                CONFIG_CMD_MII                * MII utility commands

                CONFIG_CMD_MTDPARTS        * MTD partition support

                CONFIG_CMD_NAND                * NAND support

                CONFIG_CMD_NET                  bootp, tftpboot, rarpboot

                CONFIG_CMD_PCA953X        * PCA953x I2C gpio commands

                CONFIG_CMD_PCA953X_INFO * PCA953x I2C gpio info command

                CONFIG_CMD_PCI                * pciinfo

                CONFIG_CMD_PCMCIA                * PCMCIA support

                CONFIG_CMD_PING                * send ICMP ECHO_REQUEST to network

                                          host

                CONFIG_CMD_PORTIO        * Port I/O

                CONFIG_CMD_READ                * Read raw data from partition

                CONFIG_CMD_REGINFO        * Register dump

                CONFIG_CMD_RUN                  run command in env variable

                CONFIG_CMD_SANDBOX        * sb command to access sandbox features

                CONFIG_CMD_SAVES        * save S record dump

                CONFIG_CMD_SCSI                * SCSI Support

                CONFIG_CMD_SDRAM        * print SDRAM configuration information

                                          (requires CONFIG_CMD_I2C)

                CONFIG_CMD_SETGETDCR          Support for DCR Register access

                                          (4xx only)

                CONFIG_CMD_SF                * Read/write/erase SPI NOR flash

                CONFIG_CMD_SHA1SUM          print sha1 memory digest

                                          (requires CONFIG_CMD_MEMORY)

                CONFIG_CMD_SOFTSWITCH        * Soft switch setting command for BF60x

                CONFIG_CMD_SOURCE          "source" command Support

                CONFIG_CMD_SPI                * SPI serial bus support

                CONFIG_CMD_TFTPSRV        * TFTP transfer in server mode

                CONFIG_CMD_TFTPPUT        * TFTP put command (upload)

                CONFIG_CMD_TIME                * run command and report execution time (ARM specific)

                CONFIG_CMD_TIMER        * access to the system tick timer

                CONFIG_CMD_USB                * USB support

                CONFIG_CMD_CDP                * Cisco Discover Protocol support

                CONFIG_CMD_MFSL                * Microblaze FSL support


提示:適合cb的網絡驅動官方沒有,我看見論壇裏好像有個教程帖子能夠弄

B 直接把全部驅動和命令都弄上:
在源碼包裏:

cd include

cp config_cmd_all.h config_cmd_default.h

cp config_cmd_all.h config_cmd_defaults.h

cd ..


而後編譯試試~
提示:若是不想要所有驅動,能夠編輯 include/config_cmd_default.h


教程2 編譯:

make cubieboard CROSS_COMPILE=arm-linux-gnueabi-

dd if=spl/sunxi-spl.bin of=/dev/sdb bs=1024 seek=8

dd if=u-boot.bin of=/dev/sdb bs=1024 seek=32

/dev/sdb是你的卡的號

教程3 DIY:
亮點1和2:
修改 include/configs/sunxi-common.h文件裏面的

#define CONFIG_IDENT_STRING                " Allwinner Technology"

我改爲

#define CONFIG_IDENT_STRING " TonyLianLong Software\nQQ:1040424979"

能夠用搜索功能,nano裏的CTRL+W
提示\n是換行
亮點3,4:
修改board/sunxi/board.c

int checkboard(void)

{

printf("Board: %s\n", CONFIG_SYS_BOARD_NAME);

        return 0;

}


int checkboard(void)

{

        //printf("Board: %s\n", CONFIG_SYS_BOARD_NAME);

        printf("Board: TLL board\n"); //改你要的

        return 0;

}


修改

void spl_display_print(void)

{

printf("Board: %s\n", CONFIG_SYS_BOARD_NAME);


void spl_display_print(void)

{

        //printf("Board: %s\n", CONFIG_SYS_BOARD_NAME);

        printf("Board: TLL board\n");

}


把要刪掉的東西打上註釋是個好習慣

而後改arch/arm/cpu/armv7/sunxi/cpu_info.c
把print_cpuinfo函數改爲這樣:

int print_cpuinfo(void)

{

#ifdef CONFIG_SUN4I

        puts("CPU:   TLL A10 CPU\n"); //改這有用,若是用cubieboard的配置編譯

#elif defined CONFIG_SUN5I

        /* TODO: Distinguish A13/A10s */

        puts("CPU:   Allwinner A13/A10s (SUN5I)\n"); //改這是A13和A10S的

#else

#warning Please update cpu_info.c with correct CPU information

        puts("CPU:   TLL other SUNXI CPU\n"); //改這是其餘sunxi處理器顯示的

#endif

        return 0;

}

【第二彈】
修改common/main.c

#ifdef CONFIG_MENUPROMPT

        printf(CONFIG_MENUPROMPT);

#else

        if (bootdelay >= 0)

                printf("Hit any key to stop autoboot: %2d ", bootdelay);

#endif


到:

#ifdef CONFIG_MENUPROMPT

        printf(CONFIG_MENUPROMPT);

#else

        if (bootdelay > 0){

                printf("Hit any key to enter command: %2d ", bootdelay);

        }else{

                printf("No boot delay,start booting");

        }

#endif


修改common/cmd_bootmenu.c把裏面的這個if改爲這樣:

        if (menu->delay > 0) {

                printf(ANSI_CURSOR_POSITION, menu->count + 5, 1);

                printf("  Hit any key to enter command: %2d ", menu->delay);

        }else{

                printf("  No boot delay,start booting");

        }


修改include/configs/sun4i.h:

#define CONFIG_SYS_PROMPT               "sun4i#"



到:

#define CONFIG_SYS_PROMPT               "cubie-u-boot#"


修改common/console.c:

  puts("Print-In:    ");

        if (stdio_devices[stdin] == NULL) {

                puts("No input devices available!\n");

        } else {

                printf ("%s\n", stdio_devices[stdin]->name);

        }

        puts("Print-Out:   ");

        if (stdio_devices[stdout] == NULL) {

                puts("No output devices available!\n");

} else {

                printf ("%s\n", stdio_devices[stdout]->name);

        }

        puts("Print-Err:   ");

        if (stdio_devices[stderr] == NULL) {

                puts("No error devices available!\n");

        } else {

                printf ("%s\n", stdio_devices[stderr]->name);

        }



保存編譯~(教程2)好了,就如本文開頭(第二彈還更精彩)


原文做者:tll

原文連接:http://forum.cubietech.com/forum.php?mod=viewthread&tid=631&extra=page%3D2

相關文章
相關標籤/搜索