Mainline Linux 2.6 kernel for Microblaze, Linux on Microblaze

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

Linux maintaining fragment

Known BUGs

TODO

What is different?

  • Code is based on the latest code from PetaLogix
  • Kernel is compatible with latest Linux code
  • The all code is cleaned according to Linux coding style
  • There are no driver in pure Linux kernel (only some) but it is compatible with PetaLogix distribution and drivers and it is possible to join it together
  • Completely redesign initialization part of kernel
  • Completely redesign memory part of kernel
  • The code has the same performance as common Microblaze code with static constant - that's amazing

Patch submission

Before sending your patches please do:

  1. Check for-linus, fixes-for-linus and next branch for latest rc changes
  2. Check it with checkpatch.pl script which is in linux kernel and run sparse (make C=1) for checking too. I will reject all patches which break coding style.
  3. Sending only in-line patches (git-send-email is recommended) do not attach them - it is better for reviewing.
  4. Send the smallest patches as possible and fix only one issue separately.
  5. Look at Documentation/SubmittingPatches for proper line.

Toolchain

How to boot Microblaze FDT kernel?

Vocabulary

  • EDK → Xilinx Embedded Development Kit - development environment where you can create/build your FPGA SoC
  • Microblaze → Xilinx soft core CPU
  • BSP
    • board support package → means full package for specific board (currently this means is not used)
    • EDK BSP → scripts which add functionality to EDK in software part.
  • DTS file → text file which contains detailed information about SoC. Currently this file is automatically generated by Device tree BSP.
  • DTB file → compiled DTS file.
  • DTC → device tree compiler which create DTB file from DTS.
  • FDT → flat device tree
  • OF → open firmware
  • BRAM → block ram memory → you can stored program there with bitstream

BSP

For working with FDT kernel you need to have DTS file which describes your Microblaze SoC.

  • Create new working folder
  • Download FDT BSP pack fdt-bsp.tar.gz
  • Use latest device-tree BSP device-tree_latest.tar.gz
  • Copy fdt-bsp.tar.gz to ~/microblaze-fdt/hardware/edk_user_repository/
  • Unpack all BSP
  • Currently you have all BSP which you need for working with FDT Microblaze linux kernel.

BSP updates

This chapter is only for user which wants to update BSP.

Prepared pack contains three BSP
  1. Top BSP which helps you with generation all BSP with one setting. For more information look at this site.
  2. U-BOOT bsp which generate files for U-BOOT bootloader. For more information look at this site.
  3. Device tree BSP which generates DTS setting file
Cloning BSP from GIT server

Device tree compiler

For creating DTB which is passing to Linux kernel you need DTC

Hardware design

Hardware requirements

  • FDT kernel should be able to boot on any HW.
  • Please do not use Microblaze version 7.00a without tactical patch.
  • Please do not enable FULL PVR with MMU on Microblaze version 7.00.a/b.
  • Please check that your FLASH memory baseaddr is on higher address than your Main memory due to U-BOOT bootloader (U-BOOT BSP check it).
  • I recommend you enable FULL PVR setting - Linux kernel check that your kernel and DTS file is correct for your CPU

Please check your system.xmp (or *.xmp which you use) that ModuleSearchPath is set correctly

Please choose TOP BSP and set values there.

For example fragment from *.mss file for ml505

For example fragment from *.mss file for s3e1600

Bootloader options

Before you start to build hardware you should choose our booting strategy. I would like to give you some options what you can choose.

  1. Create your own bootloader
  2. Use common bootloader
    1. Use small bootloader - FS-BOOT
    2. Use advanced bootloader - U-BOOT
DescriptionOwnFS-BootU-BOOT
Memory consumptionDepends on your features8k BRAM>128k
FunctionsDepends on what you want to developCopy SREC to memory, Boot kernel from Flash - readingFull Flash, System ACE, Network-emaclite,emac,ll_temac, gpio, booting all kernel and a lot of others
Time of developingDepends 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 aboutPetaLogixme
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.

  1. System has no non-volatile memory (without FLASH, SPI flash, SystemACE)
    • Use FS-BOOT which waits for SREC through serial line
      • copy advanced bootloader to ram and start it - recommended way
        • + add more functionality
        • - you want to boot any kernel - you must have any different way how to get kernel to memory
        • loading around 30s (baudrate 115200)
      • copy directly linux kernel to memory and boot it
        • + simply
        • - time wasting
  2. System has FLASH memory - NOR
    • Use FS-BOOT and place it to BRAM
      • Only start kernel stored in FLASH (Kernel is stored to FLASH via JTAG)
      • Start U-BOOT and use U-BOOT for advanced booting - recommended way
    • Use any simple bootloader which only jump to flash memory and boots whatever
  3. System has FLASH memory - NAND, Spansion FLASH
    • Use U-BOOT which can work with NAND flashes
  4. System has System.ACE
    • Create own bootloader which will read file from CF and loads it to memory and boots - it is possible load U-BOOT too
    • Use .ACE file with FS-BOOT and boots kernel or U-BOOT stored in flash
    • Use .ACE file with U-BOOT - recommended way
  5. System has SPI flash
    • Currently I don't know about any standard solution. Recommended way is stored U-BOOT there and create simple bootloader which copy it to main memory and jump to start.

Hw build

  • Do hardware build
  • If you want to use any bootloader in BRAM you should add it to EDK project.

U-BOOT bootloader

mkimage executable files

Linux Microblaze FDT kernel

Creating DTB file

FDT Kernel booting

Memory layout

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 the size of file system too.

U-BOOT

For noMMU kernel -> here is separated Rootfs and kernel

For MMU kernel -> initramfs is included in image.ub file

If you see message below you have problem with overriding DTB with kernel image. You should change fdt address.

Booting from others bootloaders

  • Register R5: command line
  • Register R6: physical address to ramdisk. (Build in fs == 0)
  • Register R7: physical address to DTB file

Command line priorities

From the lowest to the highest priority

  • Passing command line through r5
  • CONFIG_CMDLINE in menuconfig
  • dts command line
  • CONFIG_CMDLINE with CONFIG_CMDLINE_FORCE in menuconfig

NFS rootfs

Setup nfsroot bootargs

Setup current configs in menuconfig

Command line options summaru

Rootfs on SystemACEroot=/dev/xsa2
NFS rootfsroot=/dev/nfs rw nfsroot=192.168.0.102:/tftpboot/rootnfs
Console on uart16550 or old uartliteconsole=ttyS0,115200
Console on uarliteconsole=ttyUL0,115200
Turn off consolesilent=off
Single user modesingle
tmpfs as root devfs=mount rw rootfstype=tmpfs root=/dev/ram
setup ipaddr by dhcpip=dhcp
setup static ipaddrip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
ip=192.168.10.2:192.168.10.1:192.168.10.1:255.255.255.0:test:eth0:on

Serial console

Uartlite

Uart16550

Extract compiled in .config

Showing linux kernel buffer

Via U-BOOT

  • Find on your x86 or whatever where log buffer is
  • Starting your board
  • Something is wrong. -> restart board
  • Show your log buffer

Via XMD

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.

FIXME

HeartBeat function

Saving value in Microblaze ASM

Store byte

        ori     r10, r0, 0x12345678
        addik   r11, r0, r0_ram + 0x300
        addik   r12, r0, r0_ram + 0x304
        sb      r10,r0,r11
        sbr     r10,r0,r12

XMD% mrd 0xd02b602c 10
D02B602C:   00000078
D02B6030:   78000000
D02B6034:   00000000

Half word

        ori     r10, r0, 0x12345678
        addik   r11, r0, r0_ram + 0x300
        addik   r12, r0, r0_ram + 0x304
        sh      r10,r0,r11
        shr     r10,r0,r12

XMD% mrd 0xd02b602c 10
D02B602C:   00005678
D02B6030:   78560000
D02B6034:   00000000

Word

        ori     r10, r0, 0x12345678
        addik   r11, r0, r0_ram + 0x300
        addik   r12, r0, r0_ram + 0x304
        sw      r10,r0,r11
        swr     r10,r0,r12

XMD% mrd 0xd02b602c 10
D02B602C:   12345678
D02B6030:   78563412
D02B6034:   00000000

Error logs

Initramfs bug

stat.h

ROMFS on 2.6.29-rc2/rc3

Broken setgroups syscall

noMMU No init found

Sparse Installation

fdt/fdt.txt · Last modified: 2020/09/01 10:59 by 127.0.0.1
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0