URL
https://opencores.org/ocsvn/ao68000/ao68000/trunk
Subversion Repositories ao68000
[/] [ao68000/] [trunk/] [doc/] [doxygen/] [html/] [page_soc_linux.html] - Rev 17
Compare with Previous | Blame | View Log
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>ao68000: System-on-Chip example with ao68000 running Linux</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.2 --> <div class="navigation" id="top"> <div class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Design Unit List</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="navpath"> <ul> <li><a class="el" href="index.html">index</a> </li> </ul> </div> </div> <div class="header"> <div class="headertitle"> <h1>System-on-Chip example with <a class="el" href="classao68000.html" title="ao68000 top level module.">ao68000</a> running Linux </h1> </div> </div> <div class="contents"> <p>The <a class="el" href="classao68000.html" title="ao68000 top level module.">ao68000</a> IP Core is capable of booting the Linux kernel (<a href="http://www.kernel.org">http://www.kernel.org</a>) up to the <code>init</code> program search.</p> <h3>Requirements</h3> <ul> <li>Linux kernel sources (<a href="http://www.kernel.org">http://www.kernel.org</a>), tested with version 2.6.33.1,</li> <li>a MC68000 toolchain (<a href="http://www.gnu.org">http://www.gnu.org</a>), tested with binutils-2.20 and gcc-core-4.4.3,</li> <li>a development board to run the system, tested with Terasic DE2-70 board (<a href="http://www.terasic.com.tw">http://www.terasic.com.tw</a>),</li> <li>a SDHC card,</li> <li>a serial cable to view the output of kernel execution on a serial terminal program.</li> </ul> <h3>System-on-Chip</h3> <p>In order to test the <a class="el" href="classao68000.html" title="ao68000 top level module.">ao68000</a> processor by booting the Linux kernel, a System-on-Chip is prepared and located at: <code>./tests/soc_for_linux_on_terasic_de2_70/verilog/</code>. The system consists of:</p> <ul> <li>an early boot state machine: early_boot.v,</li> <li>a SDHC card controller: sd.v,</li> <li>a serial line transmitter: serial_txd.v,</li> <li>a SSRAM controller: ssram.v,</li> <li>a simple timer: timer.v,</li> <li>a top level module, that instantiates the above modules and the <a class="el" href="classao68000.html" title="ao68000 top level module.">ao68000</a> processor: soc_for_linux.v.</li> </ul> <h3>Step-by-step instruction to prepare the system</h3> <ul> <li>download the Linux kernel (linux-2.6.33.1.tar.bz2),</li> <li>download the toolchain (binutils-2.20.tar.bz2, gcc-core-4.4.3.tar.bz2),</li> <li>configure and make Binutils: <br/> <code>./configure --prefix=(build prefix) --target=m68knommu-none-linux</code> <br/> <code>make</code> <br/> <code>make install</code> <br/> </li> <li>configure and make GCC: <code>./../gcc-4.4.3/configure --prefix=(build prefix) --target=m68knommu-none-linux --disable-threads --disable-shared --disable-libmudflap --disable-libssp --disable-libiberty --disable-zlib --disable-libgomp</code> <br/> <code>make</code> <br/> <code>make install</code> <br/> </li> <li>patch the Linux kernel sources by copying the contents of the directory <code>./tests/soc_for_linux_on_terasic_de2_70/software/linux-2.6.33.1-ao68000/</code> into the Linux kernel sources directory,</li> <li>configure and make the Linux kernel: <br/> <code>make menuconfig ARCH=m68knommu CROSS_COMPILE=(build prefix)/bin/m68knommu-none-linux-</code> <br/> <code>make ARCH=m68knommu CROSS_COMPILE=(build prefix)/bin/m68knommu-none-linux-</code> <br/> </li> <li>convert the Linux kernel binary in ELF format into a flat binary format: <code>(build prefix)//bin/m68knommu-none-linux-objcopy -O binary vmlinux vmlinux.bin</code> <br/> </li> <li>synthesise the <code>soc_for_linux</code> with the Altera Quartus II tool. The instructions to perform the synthesis are located in the makefile located at: <code>./Makefile</code>,</li> <li>prepare a SDHC card with the software:<ul> <li>copy the first 8 bytes of memory form the file <code>./tests/soc_for_linux_on_terasic_de2_70/sd_card/sector0.dat</code>: <br/> <code>dd if=sector0.dat of=/dev/(SD card device)</code> This file contains the SSP and PC values read by the <a class="el" href="classao68000.html" title="ao68000 top level module.">ao68000</a> processor after booting.</li> <li>copy the Linux kernel flat binary, at offset 1024: <br/> <code>dd if=vmlinux.bin of=/dev/(SD card device) bs=1024 seek=1</code> <br/> </li> </ul> </li> <li>insert the SDHC card into the reader in the Terasic DE2-70 board,</li> <li>load the synthesised SOF file into the FPGA</li> <li>look at the output of the kernel console by opening a serial terminal application and reading the output of the board.</li> </ul> <h3>Notes</h3> <ul> <li>the SLOB allocator and not the default SLAB allocator had to be selected because of a problem in the kernel sources (in_interrupt() check before enabling the interrupts (at in ./kernel/slab.c:2109)),</li> <li>the source file in the Linux kernel: <code>./init/initramfs.c</code> compiled with the GCC option <code>-m68000</code> contains illegal code to execute on a MC68000 (copy a long word from an unaligned address). Even after correcting this problem, the kernel did not want to boot reliably (sometimes it booted and found the init program, sometimes not).</li> </ul> <h3>Linux console output</h3> <p>The output of the running kernel is presented below: </p> <div class="fragment"><pre class="fragment">Linux version 2.6.33.1 (alek@gesserit) (gcc version 4.4.3 (GCC) ) #11 Sun Mar 21 13:47:14 CET 2010 AO68000 support Aleksander Osman <alfik@poczta.fm> uClinux/AO68000 Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne Built 1 zonelists in Zone order, mobility grouping off. Total pages: 254 Kernel command line: PID hash table entries: 16 (order: -6, 64 bytes) Dentry cache hash table entries: 1024 (order: 0, 4096 bytes) Inode-cache hash table entries: 1024 (order: 0, 4096 bytes) Memory available: 400k/1024k RAM, (492k kernel code, 74k data) Hierarchical RCU implementation. RCU-based detection of stalled CPUs is enabled. NR_IRQS:32 console [ttyDE20] enabled Calibrating delay loop... 6.55 BogoMIPS (lpj=32768) Mount-cache hash table entries: 512 Switching to clocksource jiffies Freeing unused kernel memory: 20k freed (0x81000 - 0x85000) Warning: unable to open an initial console. Kernel panic - not syncing: No init found. Try passing init= option to kernel. Stack from 000c6f9a: 000c6fca 0007272a 00077560 00087332 00087332 00000400 000765f6 000c6fd6 00000001 00080fb8 00000698 000765ee 00080ff8 00000752 000765f6 000765ee 000765e4 000765da 000765cf 0008691c 000811f8 00000b00 000862d4 00000dc2 00000000 Call Trace with CONFIG_FRAME_POINTER disabled: [0007272a] [00077560] [00000400] [000765f6] [00000698] [000765ee] [00000752] [000765f6] [000765ee] [000765e4] [000765da] [000765cf] [000811f8] [00000b00] [00000dc2] </pre></div> </div> <hr class="footer"/><address class="footer"><small>Generated on Sun Jan 16 2011 11:00:03 for ao68000 by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.2 </small></address> </body> </html>