cubieboard 发表于 2014-7-30 11:01:23

大家一起玩U-boot DIY

本帖子欢迎大家来回复提供更多diy教程。
先上我的DIY作品(想试的看教程3):
[*]U-Boot 2013.07-rc1 (Jun 21 2013 - 20:44:00) TonyLianLong Software(亮点1)
[*]QQ:1040424979(亮点2)
[*]
[*]CPU:   TLL A10 CPU(亮点3)
[*]Board: TLL board(亮点4)
[*]I2C:   ready
[*]DRAM:1 GiB
[*]MMC:   SUNXI SD/MMC: 0
[*]In:    serial
[*]Out:   serial
[*]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 == NULL) {
[*]                puts("No input devices available!\n");
[*]      } else {
[*]                printf ("%s\n", stdio_devices->name);
[*]      }
[*]
[*]      puts("Print-Out:   ");
[*]      if (stdio_devices == NULL) {
[*]                puts("No output devices available!\n");
[*]} else {
[*]                printf ("%s\n", stdio_devices->name);
[*]      }
[*]
[*]      puts("Print-Err:   ");
[*]      if (stdio_devices == NULL) {
[*]                puts("No error devices available!\n");
[*]      } else {
[*]                printf ("%s\n", stdio_devices->name);
[*]      }
[*]
[*]

复制代码
保存编译~(教程2)好了,就如本文开头(第二弹还更精彩)


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

页: [1]
查看完整版本: 大家一起玩U-boot DIY