Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
73f19035
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
73f19035
编写于
4月 11, 2010
作者:
A
Aurelien Jarno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hw/r2d: add initrd support
Signed-off-by:
N
Aurelien Jarno
<
aurelien@aurel32.net
>
上级
56839a19
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
59 addition
and
21 deletion
+59
-21
hw/r2d.c
hw/r2d.c
+59
-21
未找到文件。
hw/r2d.c
浏览文件 @
73f19035
...
@@ -45,8 +45,10 @@
...
@@ -45,8 +45,10 @@
#define SM501_VRAM_SIZE 0x800000
#define SM501_VRAM_SIZE 0x800000
#define BOOT_PARAMS_OFFSET 0x0010000
/* CONFIG_BOOT_LINK_OFFSET of Linux kernel */
/* CONFIG_BOOT_LINK_OFFSET of Linux kernel */
#define LINUX_LOAD_OFFSET 0x800000
#define LINUX_LOAD_OFFSET 0x0800000
#define INITRD_LOAD_OFFSET 0x1800000
#define PA_IRLMSK 0x00
#define PA_IRLMSK 0x00
#define PA_POWOFF 0x30
#define PA_POWOFF 0x30
...
@@ -204,6 +206,20 @@ static int r2d_pci_map_irq(PCIDevice *d, int irq_num)
...
@@ -204,6 +206,20 @@ static int r2d_pci_map_irq(PCIDevice *d, int irq_num)
return
intx
[
d
->
devfn
>>
3
];
return
intx
[
d
->
devfn
>>
3
];
}
}
static
struct
__attribute__
((
__packed__
))
{
int
mount_root_rdonly
;
int
ramdisk_flags
;
int
orig_root_dev
;
int
loader_type
;
int
initrd_start
;
int
initrd_size
;
char
pad
[
232
];
char
kernel_cmdline
[
256
];
}
boot_params
;
static
void
r2d_init
(
ram_addr_t
ram_size
,
static
void
r2d_init
(
ram_addr_t
ram_size
,
const
char
*
boot_device
,
const
char
*
boot_device
,
const
char
*
kernel_filename
,
const
char
*
kernel_cmdline
,
const
char
*
kernel_filename
,
const
char
*
kernel_cmdline
,
...
@@ -258,28 +274,50 @@ static void r2d_init(ram_addr_t ram_size,
...
@@ -258,28 +274,50 @@ static void r2d_init(ram_addr_t ram_size,
usbdevice_create
(
"keyboard"
);
usbdevice_create
(
"keyboard"
);
/* Todo: register on board registers */
/* Todo: register on board registers */
memset
(
&
boot_params
,
0
,
sizeof
(
boot_params
));
if
(
kernel_filename
)
{
if
(
kernel_filename
)
{
int
kernel_size
;
int
kernel_size
;
/* initialization which should be done by firmware */
stl_phys
(
SH7750_BCR1
,
1
<<
3
);
/* cs3 SDRAM */
kernel_size
=
load_image_targphys
(
kernel_filename
,
stw_phys
(
SH7750_BCR2
,
3
<<
(
3
*
2
));
/* cs3 32bit */
SDRAM_BASE
+
LINUX_LOAD_OFFSET
,
INITRD_LOAD_OFFSET
-
LINUX_LOAD_OFFSET
);
if
(
kernel_cmdline
)
{
if
(
kernel_size
<
0
)
{
kernel_size
=
load_image_targphys
(
kernel_filename
,
fprintf
(
stderr
,
"qemu: could not load kernel '%s'
\n
"
,
kernel_filename
);
SDRAM_BASE
+
LINUX_LOAD_OFFSET
,
exit
(
1
);
SDRAM_SIZE
-
LINUX_LOAD_OFFSET
);
}
env
->
pc
=
(
SDRAM_BASE
+
LINUX_LOAD_OFFSET
)
|
0xa0000000
;
pstrcpy_targphys
(
"cmdline"
,
SDRAM_BASE
+
0x10100
,
256
,
kernel_cmdline
);
/* initialization which should be done by firmware */
}
else
{
stl_phys
(
SH7750_BCR1
,
1
<<
3
);
/* cs3 SDRAM */
kernel_size
=
load_image_targphys
(
kernel_filename
,
SDRAM_BASE
,
SDRAM_SIZE
);
stw_phys
(
SH7750_BCR2
,
3
<<
(
3
*
2
));
/* cs3 32bit */
env
->
pc
=
SDRAM_BASE
|
0xa0000000
;
/* Start from P2 area */
env
->
pc
=
(
SDRAM_BASE
+
LINUX_LOAD_OFFSET
)
|
0xa0000000
;
/* Start from P2 area */
}
if
(
kernel_size
<
0
)
{
fprintf
(
stderr
,
"qemu: could not load kernel '%s'
\n
"
,
kernel_filename
);
exit
(
1
);
}
}
}
if
(
initrd_filename
)
{
int
initrd_size
;
initrd_size
=
load_image_targphys
(
initrd_filename
,
SDRAM_BASE
+
INITRD_LOAD_OFFSET
,
SDRAM_SIZE
-
INITRD_LOAD_OFFSET
);
if
(
initrd_size
<
0
)
{
fprintf
(
stderr
,
"qemu: could not load initrd '%s'
\n
"
,
initrd_filename
);
exit
(
1
);
}
/* initialization which should be done by firmware */
boot_params
.
loader_type
=
1
;
boot_params
.
initrd_start
=
INITRD_LOAD_OFFSET
;
boot_params
.
initrd_size
=
initrd_size
;
}
if
(
kernel_cmdline
)
{
strncpy
(
boot_params
.
kernel_cmdline
,
kernel_cmdline
,
sizeof
(
boot_params
.
kernel_cmdline
));
}
rom_add_blob_fixed
(
"boot_params"
,
&
boot_params
,
sizeof
(
boot_params
),
SDRAM_BASE
+
BOOT_PARAMS_OFFSET
);
}
}
static
QEMUMachine
r2d_machine
=
{
static
QEMUMachine
r2d_machine
=
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录