Forum Discussion
Altera_Forum
Honored Contributor
21 years agoHow to porting u-boot to my own board?
Hello, everyone
I want to use u-boot on my board. I have two questions. 1. Before I use u-boot on my board, I just try to compile u-boot first. So, I follow the readme file. I use make PK1C20_config make all But there have errors. <div class='quotetop'>QUOTE </div> --- Quote Start --- In file included from /usr/include/sys/unistd.h:9, from /usr/include/unistd.h:6, from img2srec.c:61: /usr/include/sys/types.h:106: conflicting types for `int8_t' /usr/include/stdint.h:38: previous declaration of `int8_t' /usr/include/sys/types.h:108: warning: redefinition of `int16_t' /usr/include/stdint.h:39: warning: `int16_t' previously declared here /usr/include/sys/types.h:110: warning: redefinition of `int32_t' /usr/include/stdint.h:40: warning: `int32_t' previously declared here /usr/include/sys/types.h:112: warning: redefinition of `int64_t' /usr/include/stdint.h:45: warning: `int64_t' previously declared here make[1]: *** Error 1 make[1]: Leaving directory `/cygdrive/d/My_Project/MtxCyclone_uBoot/BootLoader/u-boot-1.1.3/tools make: *** [tools] Error 2[/b] --- Quote End --- I search the forum and find the answer given by smcnutt. <div class='quotetop'>QUOTE </div> --- Quote Start --- This looks like the sources directly from sourceforge.net ... this tree assumes you have an appropriately configured native gcc and shell environment -- which doesn't come with the nios2 toolchain 8-P The easiest thing to do is get the source tree from http://www.pysent.com/download (http://www.pysent.com/download) -- this tree has certain "nips & tucks" made to build cleanly with the default nios2 toolchain (under cygwin) -- and it's more up-to-date than the sourceforge tree (WRT Nios-II, the sourceforge tree has been lagging by several months).[/b] --- Quote End --- But I can not access the web link. Can give me the right link or the files? 2. If I want use u-boot on my MtxCyclone Board, how can I do? Just what should I do according to the PK1C20.h? Can give me more information or detailed steps than readme file? Thank you very much, LiangYi36 Replies
- Altera_Forum
Honored Contributor
Hi Scott,
I search the files related with flash in u-boot directory and find some > ..\u-boot\common\cmd_flash.c > ..\u-boot\common\env_dataflash.c > ..\u-boot\common\env_flash.c > ..\u-boot\common\flash.c > ..\u-boot\drivers\cfi_flash.c > ..\u-boot\include\flash.h > ..\u-boot\include\dataflash.h > ..\u-boot\board\altera\common\flash.c > ..\u-boot\board\altera\dk1c20\flash.c > ..\u-boot\board\altera\common\AMDLV065D.c > ..\u-boot\board\psyent\common\AMDLV065D.c > .. and the cfi_flash.c you send to me I have found that all *.c files are based on flash.h, what the relationship between these files? I know the function below, they are flash driver for u-boot. > ..\u-boot\board\altera\common\flash.c > ..\u-boot\board\altera\dk1c20\flash.c > ..\u-boot\board\altera\common\AMDLV065D.c > ..\u-boot\board\psyent\common\AMDLV065D.c But, the files below play what function. Do they have relation with u-boot flash driver? > ..\u-boot\common\cmd_flash.c > ..\u-boot\common\env_dataflash.c > ..\u-boot\common\env_flash.c > ..\u-boot\common\flash.c > ..\u-boot\drivers\cfi_flash.c Thanks, LiangYi - Altera_Forum
Honored Contributor
Hi LiangYi,
> But, the files below play what function. Do they have relation with u-boot flash driver? > ..\u-boot\common\cmd_flash.c This implements all of the flash commands (e.g.: erase, protect, etc.) > ..\u-boot\common\env_dataflash.c Used for storing non-volatile environment. > ..\u-boot\common\env_flash.c Used for storing non-volatile environment. > ..\u-boot\common\flash.c Implements some higher-level flash routines. > ..\u-boot\drivers\cfi_flash.c Low-level CFI flash driver implementation. This can be used rather than implementing your own flash driver in your board-specific source tree. Many boards have their own "flash.c" file that is customized for the specific flash device on the board. But don't take my word ... the best way to understand how things work is to read through the code yourself ;-) Start with the following: common/cmd_flash.c -- start with do_flerase(). common/cmd_mem.c -- start with do_mem_cp(). It should all become clear. Regards, --Scott - Altera_Forum
Honored Contributor
Hi Scott,
> Until you can successfully write your environment to flash you will get the warning message. Also, I tried the cfi_flash.c that I sent you on two different boards (EP1C20 and PCI-5441) and it works ok for me. However, both boards use 8-bit devices and do not implement data cache. If you have a data cache, I don't think cfi_flash.c will work -- it's currently not coded to use the ld/st io instructions. Thank for your remind. I use nios/f core before, so when I change to nios/s core. My flash seems to work. I download uImage(kernel) to my flash(offset=0x0) and run ==>bootm 0, my kernel is booted. <div class='quotetop'>QUOTE </div> --- Quote Start --- ==> bootm 0 # # Booting image at 00000000 ... ?nbsp; Image Name:?nbsp; Mtx uClinux 1.4 ?nbsp; Image Type:?nbsp; Nios-II Linux Kernel Image (gzip compressed) ?nbsp; Data Size:??753694 Bytes = 736 kB ?nbsp; Load Address: 01000000 ?nbsp; Entry Point:?01000000 ?nbsp; Verifying Checksum ... OK ?nbsp; Uncompressing Kernel Image ... OK Linux version 2.6.11-uc0 (LiangYi@liangyi) (gcc version 3.4.1 (Altera Nios II 5.0 b73))# 1 Fri Sep 30 00:36:27 2005 uClinux/Nios II Altera Nios II support ?2004 Microtronix Datacom Ltd. setup_arch: No persistant network settings signature at 003F0000 Built 1 zonelists Kernel command line: root=/dev/mtdblock0 ro PID hash table entries: 64 (order: 6, 1024 bytes) Dentry cache hash table entries: 2048 (order: 1, 8192 bytes) Inode-cache hash table entries: 1024 (order: 0, 4096 bytes) Memory available: 6352k/8192k RAM, 0k/0k ROM (1426k kernel code, 295k data) Mount-cache hash table entries: 512 (order: 0, 4096 bytes) NET: Registered protocol family 16 NIOS serial driver version 0.0 ttyS0 (irq = 2) is a builtin NIOS UART Serial: JTAG UART driver $Revision: 1.4 $ ttyJ0 at MMIO 0x80800800 (irq = 1) is a jtag_uart io scheduler noop registered io scheduler anticipatory registered io scheduler deadline registered io scheduler cfq registered RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize eth0: Open Ethernet Core Version 1.0 ?oeth_probe: 65536 Khz Nios: 16 RX, 16 TX buffs ???????NO Custom HW ALIGN. ???????CONFIG_NIOS2_HW_MULX??defined. ???????CONFIG_NIOS2_HW_MUL_OFF NOT defined. Microtronix map: Found 1 x16 devices at 0x0 in 16-bit bank Amd/Fujitsu Extended Query Table at 0x0040 number of CFI chips: 1 cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness. cmdlinepart partition parsing not available RedBoot partition parsing not available Using Microtronix development partition definition Creating 2 MTD partitions on "Microtronix map": 0x00200000-0x00800000 : "romfs" mtd: partition "romfs" extends beyond the end of device "Microtronix map" -- size truncated to 0x200000 0x00000000-0x00200000 : "loader/kernel" NET: Registered protocol family 2 IP: routing cache hash table of 512 buckets, 4Kbytes TCP established hash table entries: 512 (order: 0, 4096 bytes) TCP bind hash table entries: 512 (order: -1, 2048 bytes) TCP: Hash tables configured (established 512 bind 512) NET: Registered protocol family 1 NET: Registered protocol family 17 Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,0)[/b] --- Quote End --- I can not load filesystem. I first build filesystem project in Nios IDE, then I gzip the romfs.bin > romfs.bin.gz. I download romfs.bin.gz to flash at offset=0x200000. Right? How you do it? I have run Mtx uClinux ok in my board under Nios IDE(Directly upload .bin to board). Misfortune, the board I use is borrowed from other people. I have to return it today. Thank you all the same. LiangYi - Altera_Forum
Honored Contributor
Hi LiangYi,
>so when I change to nios/s core. My flash seems to work. Good -- from a u-boot point-of-view, we're done ;-) > I can not load filesystem. Ok ... but this is not a u-boot issue. You should probably start a new topic so people who are not interested in u-boot will contribute. Regards, --Scott - Altera_Forum
Honored Contributor
To LiangYi,
<div class='quotetop'>QUOTE </div> --- Quote Start --- Creating 2 MTD partitions on "Microtronix map": 0x00200000-0x00800000 : "romfs" mtd: partition "romfs" extends beyond the end of device "Microtronix map" -- size truncated to 0x200000 0x00000000-0x00200000 : "loader/kernel"[/b] --- Quote End --- Your mtd partition definition has a little error. Seconed, Could you not zip "romfs.bin" first, just upload to flash with original "romfs.bin"? However, I'd like to know/discuss how to implement the zipped "romfs.bin" to reduce flash capicity. - Altera_Forum
Honored Contributor
> I'd like to know/discuss how to implement the zipped "romfs.bin" to reduce flash
> capicity. As long as you're using an read-only file system, you might want to consider cramfs ... it works quite well ... and it is supported by u-boot. But please see: http://www.niosforum.com/forum/index.php?s...=2383&hl=cramfs (http://www.niosforum.com/forum/index.php?showtopic=2383&hl=cramfs) Regards, --Scott