2017-04-11 84 views
6

我爲Altera DE2-115提取並構建linux-socfpa。我用來構建它。它啓動但沒有文件系統。我有一個SD卡插入FPGA,有什麼方法可以使用SD卡作爲文件系統?如何使用Nios II MMU和Linux啓用SD卡4.9

系統信息:

Linux version 4.9.0-00104-g84d4f8a-dirty ([email protected]) (gcc version 6.2.0 (S7 
bootconsole [early0] enabled 
early_console initialized at 0xe8001400 
ERROR: Nios II DIV different for kernel and DTS 
Warning: icache size configuration mismatch (0x8000 vs 0x1000) of CONFIG_NIOS2_e 
Warning: dcache size configuration mismatch (0x8000 vs 0x800) of CONFIG_NIOS2_De 
On node 0 totalpages: 32768 
free_area_init_node: node 0, pgdat c0527bb4, node_mem_map c0545b80 
    Normal zone: 256 pages used for memmap 
    Normal zone: 0 pages reserved 
    Normal zone: 32768 pages, LIFO batch:7 
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768 
pcpu-alloc: [0] 0 
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512 
Kernel command line: console=ttyAL0,115200 
PID hash table entries: 512 (order: -1, 2048 bytes) 
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes) 
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes) 
Sorting __ex_table... 
Memory: 124516K/131072K available (2834K kernel code, 84K rwdata, 568K rodata,) 
NR_IRQS:64 nr_irqs:64 0 
clocksource: nios2-clksrc: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_nss 
Calibrating delay loop (skipped), value calculated using timer frequency.. 100.) 
pid_max: default: 32768 minimum: 301 
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes) 
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes) 
devtmpfs: initialized 
cpu cpu0: Error -2 creating of_node link 
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 191s 
NET: Registered protocol family 16 
random: fast init done 
clocksource: Switched to clocksource nios2-clksrc 
NET: Registered protocol family 2 
TCP established hash table entries: 1024 (order: 0, 4096 bytes) 
TCP bind hash table entries: 1024 (order: 0, 4096 bytes) 
TCP: Hash tables configured (established 1024 bind 1024) 
UDP hash table entries: 256 (order: 0, 4096 bytes) 
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes) 
futex hash table entries: 256 (order: -1, 3072 bytes) 
workingset: timestamp_bits=30 max_order=15 bucket_order=0 
jffs2: version 2.2. (NAND) �© 2001-2006 Red Hat, Inc. 
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254) 
io scheduler noop registered 
io scheduler deadline registered 
io scheduler cfq registered (default) 
8001400.serial: ttyAL0 at MMIO 0x8001400 (irq = 3, base_baud = 3125000) is a AlT 
console [ttyAL0] enabled 
console [ttyAL0] enabled 
bootconsole [early0] disabled 
bootconsole [early0] disabled 
8001440.serial: ttyJ0 at MMIO 0x8001440 (irq = 2, base_baud = 0) is a Altera JTT 
random: crng init done 
loop: module loaded 
mousedev: PS/2 mouse device common for all mice 
NET: Registered protocol family 10 
sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver 
Freeing unused kernel memory: 1788K (c02c6000 - c0485000) 
This architecture does not have kernel memory protection. 
Starting logging: OK 
Initializing random number generator... done. 
Starting network: OK 

Welcome to Nios II 
nios2 login: root 
login[733]: root login on 'ttyAL0' 
# ls -al 
total 4 
drwx------ 2 root  root    0 Jan 1 00:00 . 
drwxr-xr-x 17 root  root    0 Apr 11 2017 .. 
-rw------- 1 root  root    7 Jan 1 00:00 .ash_history 
# df -h 
Filesystem    
# 
Size  Used Available Use% Mounted on 
# cat /proc/cpuinfo 
CPU:   Nios II/fast 
MMU:   present 
FPU:   none 
Clocking:  50.00 MHz 
BogoMips:  100.00 
Calibration: 50000000 loops 
HW: 
MUL:   yes 
MULX:   no 
DIV:   no 
Icache:   4kB, line length: 32 
Dcache:   2kB, line length: 32 
TLB:   16 ways, 256 entries, 8 PID bits 
# 

Qsys的設計

enter image description here

enter image description here

有沒有從cat proc/partitions

# cat /proc/partitions               
major minor #blocks name 
輸出3210

輸出dmesg

# dmesg                   
Linux version 4.9.0-00104-g84d4f8a-dirty ([email protected]) (gcc version 6.2.0 (S7 
bootconsole [early0] enabled              
early_console initialized at 0xe8001400           
ERROR: Nios II DIV different for kernel and DTS         
Warning: icache size configuration mismatch (0x8000 vs 0x1000) of CONFIG_NIOS2_e 
Warning: dcache size configuration mismatch (0x8000 vs 0x800) of CONFIG_NIOS2_De 
On node 0 totalpages: 32768              
free_area_init_node: node 0, pgdat c0542150, node_mem_map c055fb80    
    Normal zone: 256 pages used for memmap           
    Normal zone: 0 pages reserved             
    Normal zone: 32768 pages, LIFO batch:7           
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768         
pcpu-alloc: [0] 0                
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512  
Kernel command line: console=ttyAL0,115200          
PID hash table entries: 512 (order: -1, 2048 bytes)        
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)     
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)      
Sorting __ex_table...               
Memory: 124412K/131072K available (2919K kernel code, 85K rwdata, 588K rodata,) 
NR_IRQS:64 nr_irqs:64 0               
clocksource: nios2-clksrc: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_nss 
Calibrating delay loop (skipped), value calculated using timer frequency.. 100.) 
pid_max: default: 32768 minimum: 301            
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)      
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)     
devtmpfs: initialized               
cpu cpu0: Error -2 creating of_node link           
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 191s 
NET: Registered protocol family 16            
random: fast init done               
clocksource: Switched to clocksource nios2-clksrc        
NET: Registered protocol family 2            
TCP established hash table entries: 1024 (order: 0, 4096 bytes)     
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)       
TCP: Hash tables configured (established 1024 bind 1024)       
UDP hash table entries: 256 (order: 0, 4096 bytes)        
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)       
futex hash table entries: 256 (order: -1, 3072 bytes)       
workingset: timestamp_bits=30 max_order=15 bucket_order=0      
jffs2: version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.       
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)    
io scheduler noop registered              
io scheduler deadline registered             
io scheduler cfq registered (default)           
8001400.serial: ttyAL0 at MMIO 0x8001400 (irq = 3, base_baud = 3125000) is a AlT 
console [ttyAL0] enabled               
bootconsole [early0] disabled             
8001440.serial: ttyJ0 at MMIO 0x8001440 (irq = 2, base_baud = 0) is a Altera JTT 
random: crng init done               
loop: module loaded                
mousedev: PS/2 mouse device common for all mice         
NET: Registered protocol family 10            
sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver        
Freeing unused kernel memory: 1788K (c02db000 - c049a000)      
This architecture does not have kernel memory protection.      
# 

我還啓用了FAT文件系統和SPI和menuconfig的。

enter image description here enter image description here

# ls /dev/                  
console    ptyte    ttyee         
cpu_dma_latency  ptytf    ttyef         
full    ptyu0    ttyp0         
input    ptyu1    ttyp1         
kmem    ptyu2    ttyp2         
kmsg    ptyu3    ttyp3         
loop-control  ptyu4    ttyp4         
loop0    ptyu5    ttyp5         
loop1    ptyu6    ttyp6         
loop2    ptyu7    ttyp7         
loop3    ptyu8    ttyp8         
loop4    ptyu9    ttyp9         
loop5    ptyua    ttypa         
loop6    ptyub    ttypb         
loop7    ptyuc    ttypc         
mem     ptyud    ttypd         
memory_bandwidth ptyue    ttype         
network_latency  ptyuf    ttypf         
network_throughput ptyv0    ttyq0         
null    ptyv1    ttyq1         
psaux    ptyv2    ttyq2         
ptmx    ptyv3    ttyq3         
pts     ptyv4    ttyq4         
ptya0    ptyv5    ttyq5         
ptya1    ptyv6    ttyq6         
ptya2    ptyv7    ttyq7         
ptya3    ptyv8    ttyq8         
ptya4    ptyv9    ttyq9         
ptya5    ptyva    ttyqa         
ptya6    ptyvb    ttyqb         
ptya7    ptyvc    ttyqc         
ptya8    ptyvd    ttyqd         
ptya9    ptyve    ttyqe         
ptyaa    ptyvf    ttyqf         
ptyab    ptyw0    ttyr0         
ptyac    ptyw1    ttyr1         
ptyad    ptyw2    ttyr2         
ptyae    ptyw3    ttyr3         
ptyaf    ptyw4    ttyr4         
ptyb0    ptyw5    ttyr5         
ptyb1    ptyw6    ttyr6         
ptyb2    ptyw7    ttyr7         
ptyb3    ptyw8    ttyr8         
ptyb4    ptyw9    ttyr9         
ptyb5    ptywa    ttyra         
ptyb6    ptywb    ttyrb         
ptyb7    ptywc    ttyrc         
ptyb8    ptywd    ttyrd         
ptyb9    ptywe    ttyre         
ptyba    ptywf    ttyrf         
ptybb    ptyx0    ttys0         
ptybc    ptyx1    ttys1         
ptybd    ptyx2    ttys2         
ptybe    ptyx3    ttys3         
ptybf    ptyx4    ttys4         
ptyc0    ptyx5    ttys5         
ptyc1    ptyx6    ttys6         
ptyc2    ptyx7    ttys7         
ptyc3    ptyx8    ttys8         
ptyc4    ptyx9    ttys9         
ptyc5    ptyxa    ttysa         
ptyc6    ptyxb    ttysb         
ptyc7    ptyxc    ttysc         
ptyc8    ptyxd    ttysd         
ptyc9    ptyxe    ttyse         
ptyca    ptyxf    ttysf         
ptycb    ptyy0    ttyt0         
ptycc    ptyy1    ttyt1         
ptycd    ptyy2    ttyt2         
ptyce    ptyy3    ttyt3         
ptycf    ptyy4    ttyt4         
ptyd0    ptyy5    ttyt5         
ptyd1    ptyy6    ttyt6         
ptyd2    ptyy7    ttyt7         
ptyd3    ptyy8    ttyt8         
ptyd4    ptyy9    ttyt9         
ptyd5    ptyya    ttyta         
ptyd6    ptyyb    ttytb         
ptyd7    ptyyc    ttytc         
ptyd8    ptyyd    ttytd         
ptyd9    ptyye    ttyte         
ptyda    ptyyf    ttytf         
ptydb    ptyz0    ttyu0         
ptydc    ptyz1    ttyu1         
ptydd    ptyz2    ttyu2         
ptyde    ptyz3    ttyu3         
ptydf    ptyz4    ttyu4         
ptye0    ptyz5    ttyu5         
ptye1    ptyz6    ttyu6         
ptye2    ptyz7    ttyu7         
ptye3    ptyz8    ttyu8         
ptye4    ptyz9    ttyu9         
ptye5    ptyza    ttyua         
ptye6    ptyzb    ttyub         
ptye7    ptyzc    ttyuc         
ptye8    ptyzd    ttyud         
ptye9    ptyze    ttyue         
ptyea    ptyzf    ttyuf         
ptyeb    random    ttyv0         
ptyec    shm     ttyv1         
ptyed    tty     ttyv2         
ptyee    ttyAL0    ttyv3         
ptyef    ttyJ0    ttyv4         
ptyp0    ttya0    ttyv5         
ptyp1    ttya1    ttyv6         
ptyp2    ttya2    ttyv7         
ptyp3    ttya3    ttyv8         
ptyp4    ttya4    ttyv9         
ptyp5    ttya5    ttyva         
ptyp6    ttya6    ttyvb         
ptyp7    ttya7    ttyvc         
ptyp8    ttya8    ttyvd         
ptyp9    ttya9    ttyve         
ptypa    ttyaa    ttyvf         
ptypb    ttyab    ttyw0         
ptypc    ttyac    ttyw1         
ptypd    ttyad    ttyw2         
ptype    ttyae    ttyw3         
ptypf    ttyaf    ttyw4         
ptyq0    ttyb0    ttyw5         
ptyq1    ttyb1    ttyw6         
ptyq2    ttyb2    ttyw7         
ptyq3    ttyb3    ttyw8         
ptyq4    ttyb4    ttyw9         
ptyq5    ttyb5    ttywa         
ptyq6    ttyb6    ttywb         
ptyq7    ttyb7    ttywc         
ptyq8    ttyb8    ttywd         
ptyq9    ttyb9    ttywe         
ptyqa    ttyba    ttywf         
ptyqb    ttybb    ttyx0         
ptyqc    ttybc    ttyx1         
ptyqd    ttybd    ttyx2         
ptyqe    ttybe    ttyx3         
ptyqf    ttybf    ttyx4         
ptyr0    ttyc0    ttyx5         
ptyr1    ttyc1    ttyx6         
ptyr2    ttyc2    ttyx7         
ptyr3    ttyc3    ttyx8         
ptyr4    ttyc4    ttyx9         
ptyr5    ttyc5    ttyxa         
ptyr6    ttyc6    ttyxb         
ptyr7    ttyc7    ttyxc         
ptyr8    ttyc8    ttyxd         
ptyr9    ttyc9    ttyxe         
ptyra    ttyca    ttyxf         
ptyrb    ttycb    ttyy0         
ptyrc    ttycc    ttyy1         
ptyrd    ttycd    ttyy2         
ptyre    ttyce    ttyy3         
ptyrf    ttycf    ttyy4         
ptys0    ttyd0    ttyy5         
ptys1    ttyd1    ttyy6         
ptys2    ttyd2    ttyy7         
ptys3    ttyd3    ttyy8         
ptys4    ttyd4    ttyy9         
ptys5    ttyd5    ttyya         
ptys6    ttyd6    ttyyb         
ptys7    ttyd7    ttyyc         
ptys8    ttyd8    ttyyd         
ptys9    ttyd9    ttyye         
ptysa    ttyda    ttyyf         
ptysb    ttydb    ttyz0         
ptysc    ttydc    ttyz1         
ptysd    ttydd    ttyz2         
ptyse    ttyde    ttyz3         
ptysf    ttydf    ttyz4         
ptyt0    ttye0    ttyz5         
ptyt1    ttye1    ttyz6         
ptyt2    ttye2    ttyz7         
ptyt3    ttye3    ttyz8         
ptyt4    ttye4    ttyz9         
ptyt5    ttye5    ttyza         
ptyt6    ttye6    ttyzb         
ptyt7    ttye7    ttyzc         
ptyt8    ttye8    ttyzd         
ptyt9    ttye9    ttyze         
ptyta    ttyea    ttyzf         
ptytb    ttyeb    urandom         
ptytc    ttyec    zero          
ptytd    ttyed              
# 
+1

我不知道是否只是讓fpga設備向dmesg打印一些信息。你是否檢查過這個IP的FPGA引腳連接? – user3249791

+0

@ user3249791我不明白。請你詳細說明我應該做什麼? –

+1

你在Qsys中有SD卡接口設備。您是否已將此設備的conduit_end正確連接至DE2-115 Board上的SD卡插槽? – user3249791

回答

2

您可以選擇嵌入文件系統內核映像中。選擇initramfs選項並指向您創建的文件系統。 我使用buildroot來創建我需要的所有圖像以及文件系統。

+0

謝謝你的回答。但是,如何在連接到電路板時指向文件系統? –

+1

如果您執行的initramfs不需要指向,則文件系統將在引導過程中自動掛載。從這一點開始,您可以引導一個基本的Linux,然後使用您的rc腳本從SDCARD掛載文件系統。 – user3249791

2

如果你想看到你的根文件系統本身,請嘗試

cd/

ls -lp 

。如果你想使用你的SD卡,請嘗試安裝它。

mount /dev/mmcblkp** /mnt 

用你的SD卡分區的東西(mmcblkp1p1 or mmcblk1p2),而不是mmcblkp **。

+0

謝謝你的回答,但掛載失敗:'mount:mount/dev/mmcblkp ** on/mnt失敗:沒有這樣的文件或目錄' –

+1

'mmcblkp **'僅供參考。檢查你的SD卡(應該是'/ dev'內的'mmcblk0或mmcblk1')。然後使用SD卡'mmcblk1p1'或mmcblk1p2的一個分區,如果您的SD卡在'mmcblk1p'上。你可以嘗試類似'mount -t /dev/mmcblk1p1/mnt'。 *注意:使用正確的文件類型插入和正確類型的SD卡分區*。 –

+0

@vinodmaverick我在'/ dev'中沒有任何類似的東西。我更新了更多信息。 –

2

我剛剛看到您更新的問題。在Qsys圖像我看不到SD卡接口理想情況下應該是)。我相信,這增加後的界面應該是這樣的:

SD card Interface 一旦你看到這樣的你的情況Qsys我相信,那麼只有你可以掛載SD卡。

我剛剛得到enabling SD card的一種方式,在nios2上使用SD card as filesystem。不過,它有點舊,但我認爲它會幫助你。

+0

但我有這種Qsys與「SD卡Avalon接口」。我在menuconfig中添加了FAT和SPI支持。什麼都沒有 –

+1

@DjDac我希望你已經按照上面提到的鏈接。如果它仍然不工作(*假設你的硬件和SD卡是好的*),並且在SD卡期間沒有獲得任何內核日誌'dmesg',那麼我只能暫停你的驅動程序集成。 –

+0

太複雜了。你必須告訴我,而不是告訴我。如果你告訴我,那麼它可以工作。它不會工作只是評論。 –