歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> uclinux-2008R1-RC8(bf561)到VDSP5的移植(54):initramfs的問題

uclinux-2008R1-RC8(bf561)到VDSP5的移植(54):initramfs的問題

日期:2017/3/3 16:43:26   编辑:關於Linux

默認情況下,2008r1版本的內核使用了initramfs做為rootfs,而為了將rootfs與內核放在一起,在鏈接文件ldf中做了一下處理:

INPUT_SECTION_ALIGN(4)
___initramfs_start = (. + 3) / 4 * 4;
INPUT_SECTIONS($LIBRARIES_UCLINUX(.init.ramfs))
___initramfs_end = .;

再看一下.init.ramfs這個段的數據來源:

在usr目錄下有一個叫initramfs_data.S的文件,就兩句話:

.section .init.ramfs,"a"

.incbin "/usr/initramfs_data.cpio.gz"

其意思無非就是說將initramfs_data.cpio.gz這個文件的內容讀出來放在.init.ramfs這個段中。

但是在VDSP下使用時出現一個可惡的問題,老是提示無法找到規則編譯initramfs_data.cpio.gz。況且在VDSP下也不支持.incbin,而是支持.inc/binary,因此直接將這兩行代碼復制到arch/blackfin/fixed_code.s中,並修改為:

.section .init.ramfs,"a"
.inc/binary "../../usr/initramfs_data.cpio.gz"

這樣,就可以將initramfs_data.cpio.gz文件中的內容放到.init.ramfs段中了。

參考VDSP文檔:

INC/BINARY, Include Contents of a File
The .INC/BINARY directive includes the content of file at the current location. You can control the search paths used via the -i command-line switch (click here).
Syntax:
.INC/BINARY [ symbol = ] "filename" [,skip [,count]] ;
.INC/BINARY [ symbol[] = ] "filename" [,skip [,count]] ;
where
symbol – the name of a symbol to associate with the data being included from the filefilename – the name of the file to include. The argument is enclosed in double quotes.
The skip argument skips a number of bytes from the start of the file.
The count argument indicates the maximum number of bytes to read.
Example:
.SECTION data1;
.VAR jim;
.INC/BINARY sym[] = "bert",10,6;
.VAR fred;
.INC/BINARY Image1[] = "photos/Picture1.jpg";

Copyright © Linux教程網 All Rights Reserved