Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12589 Discussions

Booting Linux on MAX10 FPGA Development kit (ACDS v17.0)

Altera_Forum
Honored Contributor II
2,523 Views

Hello! 

I’m trying to run Linux kernel 4.9.76-ltsi-rt from altera opensources with buildroot 2017.11 on MAX10 FPGA Development kit with NIOS II, but it’s fail.  

I use this instruction (https://rocketboards.org/foswiki/documentation/alteramax1010m50revcdevelopmentkitlinuxsetupv170) from rocketboards and it works with prebuild linux image. After recompilation linux, the system does not respond. 

I was able to start the kernel after adding .dts file to the configuration. The problem is that the system does not see qspi flash with jffs file system and rootfs. There is a kernel panic. What's wrong? 

 

I'm using: 

Altera MAX10 10M50 Rev C development kit. 

Quartus Prime Standart Edition 17.0 

ACDS version 17.0 

Sourcery CodeBench Lite 2017.11-14 

kernel 4.9.76-ltsi-rt 

rootfs buildroot 2017.11 

 

Log file and dts file in attachment
0 Kudos
13 Replies
Altera_Forum
Honored Contributor II
1,332 Views

Hi, 

 

 

--- Quote Start ---  

 

I was able to start the kernel after adding .dts file to the configuration. The problem is that the system does not see qspi flash with jffs file system and rootfs. There is a kernel panic. What's wrong? 

 

--- Quote End ---  

 

 

Where did you download your 'rootfs.hex' ? 

 

partition@qspi-rootfs { /* 56MB for jffs2 data. */ label = "Flash 0 jffs2 Filesystem"; reg = <0x00C00000 0x03600000>; };  

 

To 0x00C00000 of CFI_512 Mb ? 

 

Regards, 

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
1,332 Views

 

--- Quote Start ---  

 

 

To 0x00C00000 of CFI_512 Mb ? 

 

 

--- Quote End ---  

 

 

You're right. 

New kernel doesn't fit into region 0x0 - 0x00A00000. Rootfs is located in 0x00C00000 - 0x0360000.  

 

https://alteraforum.com/forum/attachment.php?attachmentid=15119&stc=1  

 

Rootfs works if I check Initial RAM filesystem an RAM disk support in kernel config. The SPI flash does not work yet. I check SPI support and Altera SPI controller in kernel config, but it's still not work.
0 Kudos
Altera_Forum
Honored Contributor II
1,332 Views

Hi,  

 

 

--- Quote Start ---  

 

New kernel doesn't fit into region 0x0 - 0x00A00000. Rootfs is located in 0x00C00000 - 0x0360000.  

 

--- Quote End ---  

 

 

 

How about the address range ? 0x0360000 is correct ? 

 

Regards, 

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
1,332 Views

 

--- Quote Start ---  

Hi,  

 

How about the address range ? 0x0360000 is correct ? 

 

Regards, 

 

Kazu 

--- Quote End ---  

 

 

Yes, it's no matter. I tried changing the range to 0x00C00000 - 0x0380000. 

I think the problem is in the driver SPI. No messages about SPI in the kernel console. How correctly to include the SPI driver?
0 Kudos
Altera_Forum
Honored Contributor II
1,332 Views

Hi, 

 

 

--- Quote Start ---  

Yes, it's no matter. I tried changing the range to 0x00C00000 - 0x0380000. 

I think the problem is in the driver SPI. No messages about SPI in the kernel console. How correctly to include the SPI driver? 

--- Quote End ---  

 

 

I think the correct value may be 0x0340000 for your 512Mb spi flash, 

And I also think you stored your kernel code and booted it successfully from your spi flash, 

So may be the SPI driver is working correctly, 

 

Regards, 

 

Kazu 

 

P.S. 

 

In the kernel booting time, the CPU reads the contents of flash memory and copies those to the RAM. 

It only uses spi hardware and has no need to use Linux spi (software) driver.
0 Kudos
Altera_Forum
Honored Contributor II
1,332 Views

 

--- Quote Start ---  

 

In the kernel booting time, the CPU reads the contents of flash memory and copies those to the RAM. 

It only uses spi hardware and has no need to use Linux spi (software) driver. 

--- Quote End ---  

 

 

Bootlodaer works correctly. It's copies the image (vmlinux and rootfs) to the RAM and jumps to the kernel. Linux kernel doesn't search MTD partitions and it's fail. 

 

This is "true" log for the rocketboards linux (kernel 3.10.31-ltsi-02998).  

 

 

--- Quote Start ---  

Linux version 3.10.31-ltsi-02998-g28bac3e (esv@pg-iccf0369) (gcc version 4.7.3 (Sourcery CodeBench Lite 2013.05-43) )# 1 Tue May 2 12:31:17 MYT 2017 

On node 0 totalpages: 65536 

free_area_init_node: node 0, pgdat c83290a0, node_mem_map c834a3a0 

Normal zone: 512 pages used for memmap 

Normal zone: 0 pages reserved 

Normal zone: 65536 pages, LIFO batch:15 

pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768 

pcpu-alloc: [0] 0 

Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024 

Kernel command line: debug console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2 

PID hash table entries: 1024 (order: 0, 4096 bytes) 

Dentry cache hash table entries: 32768 (order: 5, 131072 bytes) 

Inode-cache hash table entries: 16384 (order: 4, 65536 bytes) 

Sorting __ex_table... 

Memory available: 125420k/3348k RAM (2509k kernel code, 839k data) 

NR_IRQS:64 nr_irqs:64 0 

Calibrating delay loop... 36.60 BogoMIPS (lpj=73216) 

pid_max: default: 32768 minimum: 301 

Mount-cache hash table entries: 512 

devtmpfs: initialized 

NET: Registered protocol family 16 

bio: create slab <bio-0> at 0 

Switching to clocksource timer 

NET: Registered protocol family 2 

TCP established hash table entries: 2048 (order: 2, 16384 bytes) 

TCP bind hash table entries: 2048 (order: 1, 8192 bytes) 

TCP: Hash tables configured (established 2048 bind 2048) 

TCP: reno registered 

UDP hash table entries: 256 (order: 0, 4096 bytes) 

UDP-Lite hash table entries: 256 (order: 0, 4096 bytes) 

NET: Registered protocol family 1 

RPC: Registered named UNIX socket transport module. 

RPC: Registered udp transport module. 

RPC: Registered tcp transport module. 

RPC: Registered tcp NFSv4.1 backchannel transport module. 

jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc. 

msgmni has been set to 244 

Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253) 

io scheduler noop registered 

io scheduler deadline registered 

io scheduler cfq registered (default) 

Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled 

18001600.serial: ttyS0 at MMIO 0x18001600 (irq = 2) is a 16550A 

console [ttyS0] enabled 

ttyJ0 at MMIO 0x18001530 (irq = 7) is a Altera JTAG UART 

loop: module loaded 

2 ofpart partitions found on MTD device n25q512a 

Creating 2 MTD partitions on "n25q512a": 

0x000000000000-0x000000a00000 : "Flash 0 Raw Data" 

0x000000a00000-0x000004000000 : "Flash 1 jffs2 Filesystem" 

libphy: altera_tse: probed 

altera_tse 400.ethernet (unregistered net_device): MDIO bus altera_tse-0: created 

altera_tse 400.ethernet: Altera TSE MAC version 17.0 at 0x00000400 irq 3/5 

mousedev: PS/2 mouse device common for all mice 

TCP: cubic registered 

NET: Registered protocol family 17 

VFS: Mounted root (jffs2 filesystem) on device 31:1. 

devtmpfs: mounted 

Freeing unused kernel memory: 108K (c8275000 - c8290000) 

Starting logging: OK 

Initializing random number generator... done. 

Starting network... 

 

Welcome to Nios II 

nios2 login: 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
1,332 Views

Hi,  

 

Maybe you need a kernel command line. 

 

debug console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2 

 

And did you enable the MTD (Memory Technology Device )partition support ? 

 

Regards, 

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
1,332 Views

MTD is enable. 

 

I can't find altera qspi driver in linux kernel. How it works? U-Boot has altera_qspi.c and it works fine. The kernel does not understand "compatible = "altr,quadspi-1.0"" in dts file.
0 Kudos
Altera_Forum
Honored Contributor II
1,332 Views

Hi, 

 

 

--- Quote Start ---  

MTD is enable. 

 

I can't find altera qspi driver in linux kernel. How it works? U-Boot has altera_qspi.c and it works fine. The kernel does not understand "compatible = "altr,quadspi-1.0"" in dts file. 

--- Quote End ---  

 

 

Maybe the next page will help you. 

 

https://patchwork.kernel.org/patch/6532891/ 

 

But I don't know the patch can be used for Linux ver. 4.9.76. 

 

Regards, 

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
1,332 Views

Thank you! It works with few changes. 

It's best to use this patch for altera quadspi flash controller v2 (https://patchwork.kernel.org/patch/9810039/) with updates in Quartus project.
0 Kudos
Altera_Forum
Honored Contributor II
1,332 Views

Hi, 

 

 

--- Quote Start ---  

Thank you! It works with few changes. 

It's best to use this patch for altera quadspi flash controller v2 (https://patchwork.kernel.org/patch/9810039/) with updates in Quartus project. 

--- Quote End ---  

 

 

You are welcome. And also thank you for your feedback. 

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
1,332 Views

Did you get this to work? I too am having essentially the same problem.  

 

I modified the DTS to include the quadspi and also update the kernel cmdline 

 

With loglevel 7 set what I see is that the altera_quadspi is very unhappy when probed. 

 

>altera_quadspi 180014a0.quadspi: bank setup failed 

>altera_quadspi: probe of 180014a0.quadspi failed with error -22 

 

-dcat
0 Kudos
Altera_Forum
Honored Contributor II
1,332 Views

Hi, 

 

 

--- Quote Start ---  

Did you get this to work? I too am having essentially the same problem.  

 

I modified the DTS to include the quadspi and also update the kernel cmdline 

 

With loglevel 7 set what I see is that the altera_quadspi is very unhappy when probed. 

 

>altera_quadspi 180014a0.quadspi: bank setup failed 

>altera_quadspi: probe of 180014a0.quadspi failed with error -22 

 

 

--- Quote End ---  

 

 

Would you show me your DTS file? 

 

Regards, 

 

Kazu
0 Kudos
Reply