I would like to thanks PetaLogix for lending Xilinx s3e1600E board and Xilinx for providing ML505 and s3adsp1800 boards.
If you want something to know please send email to microblaze mailing list with CC to me. (archive, archive-gmane)
Latest code is available at GIT server. http://git.monstr.eu/git/gitweb.cgi
MICROBLAZE ARCHITECTURE P: Michal Simek M: monstr@monstr.eu L: microblaze-uclinux@itee.uq.edu.au W: http://www.monstr.eu/fdt/ T: git git://git.monstr.eu/linux-2.6-microblaze.git S: Supported F: arch/microblaze/
Before sending your patches please do:
For working with FDT kernel you need to have DTS file which describes your Microblaze SoC.
mkdir -p ~/microblaze-fdt/hardware/edk_user_repository/ cd ~/microblaze-fdt/hardware/edk_user_repository/
tar xvfz fdt-bsp.tar.gz
This chapter is only for user which wants to update BSP.
git clone git://git.monstr.eu/top-bsp.git
git clone git://git.monstr.eu/uboot-bsp.git
git clone git://git.monstr.eu/device-tree.git
For creating DTB which is passing to Linux kernel you need DTC
mkdir -p ~/microblaze-fdt/tools/bin/src cd ~/microblaze-fdt/tools/bin/src
git clone git://git.jdl.com/software/dtc.git cd dtc
make
cp ~/microblaze-fdt/tools/bin/src/dtc/dtc ~/microblaze-fdt/tools/bin cd ~/microblaze-fdt/tools/bin export PATH=$PATH:`pwd`
make install
We will use for storing hw design special folder
mkdir -p ~/microblaze-fdt/hardware/hw_design
For example if you want to add/copy your design (ml505) to this folder. Create new folder (ml505) and add them hw files.
mkdir -p ~/microblaze-fdt/hardware/hw_design/ml505
You should able to see there mhs, mss, xmp and date folder with ucf files.
ls -R ~/microblaze-fdt/hardware/hw_design/ml505/ ~/microblaze-fdt/hardware/hw_design/ml505/: data system.mhs system.mss system.xmp ~/microblaze-fdt/hardware/hw_design/ml505/data: system.ucf
Please check your system.xmp (or *.xmp which you use) that ModuleSearchPath is set correctly
cd ~/microblaze-fdt/hardware/hw_design/ml505 grep "ModuleSearchPath" system.xmp ModuleSearchPath: ../../edk_user_repository/
Please choose TOP BSP and set values there. For example fragment from *.mss file for ml505
BEGIN OS PARAMETER OS_NAME = top PARAMETER OS_VER = 1.00.b PARAMETER PROC_INSTANCE = microblaze_0 PARAMETER timer = xps_timer_1 PARAMETER ethernet = Hard_Ethernet_MAC PARAMETER sysace = SysACE_CompactFlash PARAMETER iic = IIC_EEPROM PARAMETER gpio = LEDs_8Bit PARAMETER lmb_memory = dlmb_cntlr PARAMETER flash_memory = FLASH PARAMETER main_memory = DDR2_SDRAM PARAMETER stdin = RS232_Uart_1 PARAMETER stdout = RS232_Uart_1 END
For example fragment from *.mss file for s3e1600
BEGIN OS PARAMETER OS_NAME = top PARAMETER OS_VER = 1.00.b PARAMETER PROC_INSTANCE = microblaze_0 PARAMETER timer = xps_timer_1 PARAMETER ethernet = Ethernet_MAC PARAMETER gpio = LEDs_6Bit PARAMETER lmb_memory = dlmb_cntlr PARAMETER flash_memory = FLASH PARAMETER main_memory = DDR_SDRAM PARAMETER stdin = RS232_DTE PARAMETER stdout = RS232_DTE END
make -f system.make libs
Before you start to build hardware you should choose our booting strategy. I would like to give you some options what you can choose.
| Description | Own | FS-Boot | U-BOOT |
|---|---|---|---|
| Memory consumption | Depends on your features | 8k BRAM | >128k |
| Functions | Depends on what you want to develop | Copy SREC to memory, Boot kernel from Flash - reading | Full Flash, System ACE, Network-emaclite,emac,ll_temac, gpio, booting all kernel and a lot of others |
| Time of developing | Depends on your features but it is huge in compare to standard solution | - | Only adding features which are not there |
| Source code maintaining | Customer must care about | PetaLogix | me |
| Stability | uknown | ~99.9% stable | ~99% stable - Depends on setting |
You can use our own bootloader in all variants but be sure you have time and developer who will do it. Keep in your mind that if you want to use it after some years again someone take care about. Please counted how much money this option cost. You will not have any support of it.
make -f system.make init_bram
mkimage executable files
mkdir -p ~/microblaze-fdt/software/ cd ~/microblaze-fdt/software/ git clone git://git.monstr.eu/u-boot-microblaze.git
cp ~/microblaze-fdt/hardware/hw_design/ml505/microblaze_0/libsrc/uboot_v4_00_c/config.mk ~/microblaze-fdt/software/u-boot-microblaze/board/xilinx/microblaze-generic/config.mk cp ~/microblaze-fdt/hardware/hw_design/ml505/microblaze_0/libsrc/uboot_v4_00_c/xparameters.h ~/microblaze-fdt/software/u-boot-microblaze/board/xilinx/microblaze-generic/xparameters.h
export CROSS_COMPILE=microblaze-uclinux-
make microblaze-generic_config
make
cat <<EOF >xmd.ini connect mb mdm dow u-boot exit EOF
xmd
cat u-boot.srec > /dev/ttyS0
cp ~/microblaze-fdt/software/u-boot-microblaze/tools/mkimage ~/microblaze-fdt/tools/bin/mkimage
mkdir -p ~/microblaze-fdt/software/ cd ~/microblaze-fdt/software/
git clone git://git.monstr.eu/linux-2.6-microblaze.git cd linux-2.6-microblaze
export CROSS_COMPILE=microblaze-uclinux-
export CROSS_COMPILE=mb-linux-
make menuconfig
# # Automatic platform settings from Kconfig.auto # CONFIG_KERNEL_BASE_ADDR=0x90000000 CONFIG_XILINX_MICROBLAZE0_FAMILY="virtex5" CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR=1 CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR=1 CONFIG_XILINX_MICROBLAZE0_USE_BARREL=1 CONFIG_XILINX_MICROBLAZE0_USE_DIV=1 CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL=2 CONFIG_XILINX_MICROBLAZE0_USE_FPU=2 CONFIG_XILINX_MICROBLAZE0_HW_VER="7.10.d"
make
mkimage -A microblaze -O linux -T kernel -C none -a 0x90000000 -e 0x90000000 -n "Microblaze FDT kernel without FS" -d arch/microblaze/boot/linux.bin /tftpboot/image.ub
mkimage -A microblaze -O linux -T ramdisk -C none -n "Microblaze ROOTFS" -d arch/microblaze/platform/generic/image.img /tftpboot/romfs.ub;
mkimage -A microblaze -O linux -T kernel -C none -a 0x90000000 -e 0x90000000 -n "Microblaze MMU FDT kernel" -d arch/microblaze/boot/linux.bin /tftpboot/image.ub
cd hw_design/ml505/microblaze_0/libsrc/device-tree_v1_01_a/
dtc -f -O dtb -b 0 -V 16 xilinx.dts > system.dtb
cp system.dtb /tftpboot/system.dtb
Kernel can be place to almost every position. There are some limitation like. The last instruction of kernel cannot exceed limit which is placed approximately 16 kB from the end of memory. You have to calculate with size of file system too.
For noMMU kernel → here is separated Rootfs and kernel
tftp 0x90780000 system.dtb fdt addr 0x90780000 fdt list / fdt print / tftp 0x90800000 image.ub tftp 0x90A00000 romfs.ub bootm 0x90800000 0x90A00000 0x90780000
For MMU kernel → initramfs is included in image.ub file
tftp 0x90780000 system.dtb fdt addr 0x90780000 fdt list / fdt print / tftp 0x90800000 image.ub bootm 0x90800000 - 0x90780000
If you see message below you have problem with overriding DTB with kernel image. You should change fdt address.
ERROR: Did not find a cmdline Flattened Device Tree
From the lowest to the highest priority
Setup nfsroot bootargs
bootargs = "console=ttyUL0,115200 highres=on ip=dhcp root=/dev/nfs rw nfsroot=192.168.0.102:/tftpboot/rootnommu";
Setup current configs in menuconfig
CONFIG_IP_PNP=y CONFIG_IP_PNP_DHCP=y - for dhcp usage CONFIG_ROOT_NFS=y
| Rootfs on SystemACE | root=/dev/xsa2 |
| NFS rootfs | root=/dev/nfs rw nfsroot=192.168.0.102:/tftpboot/rootnfs |
| Console on uart16550 or old uartlite | console=ttyS0,115200 |
| Console on uarlite | console=ttyUL0,115200 |
| Turn off console | silent=off |
| Single user mode | single |
| tmpfs as root | devfs=mount rw rootfstype=tmpfs root=/dev/ram |
# # Serial drivers # # CONFIG_SERIAL_8250 is not set # # Non-8250 serial port support # CONFIG_SERIAL_UARTLITE=y CONFIG_SERIAL_UARTLITE_CONSOLE=y CONFIG_SERIAL_CORE=y CONFIG_SERIAL_CORE_CONSOLE=y
# # Serial drivers # CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_8250_NR_UARTS=4 CONFIG_SERIAL_8250_RUNTIME_UARTS=4 # CONFIG_SERIAL_8250_EXTENDED is not set # # Non-8250 serial port support # # CONFIG_SERIAL_UARTLITE is not set CONFIG_SERIAL_CORE=y CONFIG_SERIAL_CORE_CONSOLE=y CONFIG_SERIAL_OF_PLATFORM=y
I recommend you in developing to enable CONFIG_IKCONFIG, CONFIG_IKCONFIG_PROC for compiled in .config
gunzip < /proc/config.gz >/tmp/.config
[/home/kernel/]$ cat System.map | grep __log_buf 201c4624 b __log_buf
=================================================
FS-BOOT First Stage Bootloader (c) 2006 PetaLogix
=================================================
FS-BOOT: System initialisation completed.
FS-BOOT: Booting from FLASH. Press 's' for image download.
FS-BOOT: Booting image...
U-Boot-mONStR> run d
TFTP from server 192.168.0.5; our IP address is 192.168.0.3
Filename 'system.dtb'.
Load address: 0x21900000
Loading: #
done
Bytes transferred = 6912 (1b00 hex)
TFTP from server 192.168.0.5; our IP address is 192.168.0.3
Filename 'image.ub'.
Load address: 0x20a00000
Loading: #################################################################
#############################################################
done
Bytes transferred = 1847360 (1c3040 hex)
TFTP from server 192.168.0.5; our IP address is 192.168.0.3
Filename 'romfs.ub'.
Load address: 0x21400000
Loading: #################################################################
###########################
done
Bytes transferred = 1341504 (147840 hex)
## Booting kernel from Legacy Image at 20a00000 ...
Image Name: kernel bez FS
Image Type: MicroBlaze Linux Kernel Image (uncompressed)
Data Size: 1847296 Bytes = 1.8 MB
Load Address: 20000000
Entry Point: 20000000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
## Loading init Ramdisk from Legacy Image at 21400000 ...
Image Name: fs v no network
Image Type: MicroBlaze Linux RAMDisk Image (uncompressed)
Data Size: 1341440 Bytes = 1.3 MB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
## Transferring control to Linux (at address 20000000) ...
aaaa
bbb
Booting using OF flat tree...root=romfs, 0x21400040, 0x21900000
================================================= FS-BOOT First Stage Bootloader (c) 2006 PetaLogix ================================================= FS-BOOT: System initialisation completed. FS-BOOT: Booting from FLASH. Press 's' for image download. FS-BOOT: Booting image...
U-Boot-mONStR> md 201c4624 201c4624: 3c353e46 6f756e64 20464454 20617420 <5>Found FDT at 201c4634: 30783231 39303030 30300a3c 353e4c69 0x21900000.<5>Li 201c4644: 6e757820 76657273 696f6e20 322e362e nux version 2.6. 201c4654: 32342d6d 4f4e5374 522d6733 38333939 24-mONStR-g38399 201c4664: 62373720 286d6f6e 73747240 6d6f6e73 b77 (monstr@mons 201c4674: 74722e65 75292028 67636320 76657273 tr.eu) (gcc vers 201c4684: 696f6e20 332e342e 31202820 50657461 ion 3.4.1 ( Peta 201c4694: 4c696e75 7820302e 32302042 75696c64 Linux 0.20 Build 201c46a4: 202d7263 31203035 30363037 20292920 -rc1 050607 )) 201c46b4: 23322046 7269204d 61792031 36203134 #2 Fri May 16 14 201c46c4: 3a32333a 32382043 45535420 32303038 :23:28 CEST 2008 201c46d4: 0a3c363e 73657475 705f6370 75696e66 .<6>setup_cpuinf 201c46e4: 6f3a2069 6e697469 616c6973 696e670a o: initialising. 201c46f4: 3c363e73 65747570 5f6d656d 6f72793a <6>setup_memory: 201c4704: 206d6178 5f6d6170 6e723a20 30783232 max_mapnr: 0x22 201c4714: 3030300a 3c363e73 65747570 5f6d656d 000.<6>setup_mem U-Boot-mONStR> 201c4724: 6f72793a 206d696e 5f6c6f77 5f70666e ory: min_low_pfn 201c4734: 3a203078 32303030 300a3c36 3e736574 : 0x20000.<6>set 201c4744: 75705f6d 656d6f72 793a206d 61785f6c up_memory: max_l 201c4754: 6f775f70 666e3a20 30783230 30300a3c ow_pfn: 0x2000.< 201c4764: 373e4f6e 206e6f64 65203020 746f7461 7>On node 0 tota 201c4774: 6c706167 65733a20 38313932 0a3c373e lpages: 8192.<7> 201c4784: 20204e6f 726d616c 207a6f6e 653a2036 Normal zone: 6 201c4794: 34207061 67657320 75736564 20666f72 4 pages used for 201c47a4: 206d656d 6d61700a 3c373e20 204e6f72 memmap.<7> Nor 201c47b4: 6d616c20 7a6f6e65 3a203020 70616765 mal zone: 0 page 201c47c4: 73207265 73657276 65640a3c 373e2020 s reserved.<7> 201c47d4: 4e6f726d 616c207a 6f6e653a 20383132 Normal zone: 812 201c47e4: 38207061 6765732c 204c4946 4f206261 8 pages, LIFO ba 201c47f4: 7463683a 300a3c37 3e20204d 6f766162 tch:0.<7> Movab 201c4804: 6c65207a 6f6e653a 20302070 61676573 le zone: 0 pages 201c4814: 20757365 6420666f 72206d65 6d6d6170 used for memmap U-Boot-mONStR> 201c4824: 0a3c353e 53656c66 206d6f64 69666965 .<5>Self modifie 201c4834: 6420636f 64652065 6e61626c 650a3c34 d code enable.<4 201c4844: 3e427569 6c742031 207a6f6e 656c6973 >Built 1 zonelis 201c4854: 74732069 6e205a6f 6e65206f 72646572 ts in Zone order 201c4864: 2c206d6f 62696c69 74792067 726f7570 , mobility group 201c4874: 696e6720 6f6e2e20 20546f74 616c2070 ing on. Total p 201c4884: 61676573 3a203831 32380a3c 353e4b65 ages: 8128.<5>Ke 201c4894: 726e656c 20636f6d 6d616e64 206c696e rnel command lin 201c48a4: 653a2063 6f6e736f 6c653d74 7479554c e: console=ttyUL 201c48b4: 302c3131 35323030 206c6f67 6c657665 0,115200 logleve 201c48c4: 6c3d3135 0a3c363e 786c6e78 2c787073 l=15.<6>xlnx,xps 201c48d4: 2d696e74 632d312e 30302e61 20233020 -intc-1.00.a #0 201c48e4: 61742030 78343030 30303030 302c206e at 0x40000000, n 201c48f4: 756d5f69 72713d38 2c206564 67653d30 um_irq=8, edge=0 201c4904: 78300a3c 343e5049 44206861 73682074 x0.<4>PID hash t 201c4914: 61626c65 20656e74 72696573 3a203132 able entries: 12 U-Boot-mONStR> 201c4924: 3820286f 72646572 3a20372c 20353132 8 (order: 7, 512 201c4934: 20627974 6573290a 3c363e78 6c6e782c bytes).<6>xlnx, 201c4944: 7870732d 74696d65 722d312e 30302e61 xps-timer-1.00.a 201c4954: 20233020 61742030 78343034 30303030 #0 at 0x4040000 201c4964: 302c2069 72713d30 0a3c363e 44656e74 0, irq=0.<6>Dent 201c4974: 72792063 61636865 20686173 68207461 ry cache hash ta 201c4984: 626c6520 656e7472 6965733a 20343039 ble entries: 409 201c4994: 3620286f 72646572 3a20322c 20313633 6 (order: 2, 163 201c49a4: 38342062 79746573 290a3c36 3e496e6f 84 bytes).<6>Ino 201c49b4: 64652d63 61636865 20686173 68207461 de-cache hash ta 201c49c4: 626c6520 656e7472 6965733a 20323034 ble entries: 204 201c49d4: 3820286f 72646572 3a20312c 20383139 8 (order: 1, 819 201c49e4: 32206279 74657329 0a3c363e 4d656d6f 2 bytes).<6>Memo 201c49f4: 72793a20 32393130 346b2f33 32373732 ry: 29104k/32772 201c4a04: 6b206176 61696c61 626c650a 00000000 k available..... 201c4a14: 00000000 00000000 00000000 00000000 ................ U-Boot-mONStR>
There is second way how to read Linux kernel log buffer via XMD. This features is not available for free users. Here is the log to show you how this options works. There are new built-in features in xmd called log. The script find-out log buffer from latest Linux kernel code and you can just type log command to show whole log buffer.
If you write __log_buf, you see these messages on MMU kernel - your problem is that your initramfs is too big that kernel can't do early page alloc.
Found FDT at 0x9e800000 Kernel panic - not syncing: ERROR: Failed to allocate 0x1000 bytes below 0x91000000.
Here you can see that max_mapnr is zero and there is no any mem base + size printk message → means your DTB is wrong.
<5>Found FDT at 0x90780000 <5>Linux version 2.6.29-mONStR-00426-g432b099-dirty (monstr@monstr.eu) (gcc version 3.4.1 ( PetaLinux 0.20 Build -rc1 050607 )) #2 Tue Mar 24 20:49:09 CET 2009 <6>setup_cpuinfo: initialising <6>setup_cpuinfo: Using full CPU PVR support <6>setup_memory: kernel addr=0x90000000-0x904c6000 size=0x004c6000 <6>setup_memory: max_mapnr: 0x0 <6>setup_memory: min_low_pfn: 0x20000 <6>setup_memory: max_low_pfn: 0x22000 <4>BUG: failure at mm/bootmem.c:320/mark_bootmem()! <0>Kernel panic - not syncing: BUG! <0>Rebooting in 120 seconds..<5>Machine restart... <6> <6>Stack: <6> 90299ec4 90215fc0 902b1318 00090000 00000001 90022c14 90208f6c 00000000 <4> 00000001 00000000 000000e2 000000b7 900127bc 00000001 000904c6 00090000 <4> 00000000 00000000 0001d4bf 902a4360 9020b4b8 00000078 902b3c44 ffffffff <5>Call Trace: <5> <4>[<90022c14>] emergency_restart+0xc/0x20 <4>[<900127bc>] panic+0x180/0x224 <4>[<902a4360>] mark_bootmem+0x128/0x17c <4>[<902a44d0>] reserve_bootmem+0x34/0x48 <4>[<902a0e98>] setup_memory+0x310/0x364 <4>[<9029f9c8>] setup_arch+0x84/0x98 <4>[<90000000>] _start+0x0/0x20 <4>[<9029a5cc>] start_kernel+0xa8/0x41c <4>[<9000005c>] no_fdt_arg+0x28/0x44 <4>[<90003ef4>] machine_halt+0x0/0x20 <5>
It is caused with mishmash in stat.h. Solution is use new toolchain.
Freeing unused kernel memory: 19387k freed Mounting proc: /etc/rc: line 6: mount: Value too large for defined data type Mounting var: /etc/rc: line 9: mount: Value too large for defined data type Populating /var: /etc/rc: line 14: mkdir: Value too large for defined data type Running local start scripts. (none) login:
There were bug in ROMFS implementation - for fix this issue please use latest ROMFS version or use this tar.gz.
git clone rsync://rsync.kernel.org/pub/scm/devel/sparse/sparse.git make install PREFIX=/Go to Linux kernel code and run
make C=1