Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OS
U-Boot.Mirror
提交
620d3c9a
U
U-Boot.Mirror
项目概览
OS
/
U-Boot.Mirror
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
U-Boot.Mirror
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
620d3c9a
编写于
2月 19, 2007
作者:
S
Stefan Roese
浏览文件
操作
浏览文件
下载
差异文件
Merge with
git+ssh://sr@pollux.denx.org/home/sr/git/u-boot/denx-merge-sr
上级
4be23a12
489c696a
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
46 addition
and
47 deletion
+46
-47
board/mcc200/auto_update.c
board/mcc200/auto_update.c
+46
-47
未找到文件。
board/mcc200/auto_update.c
浏览文件 @
620d3c9a
...
@@ -47,25 +47,6 @@
...
@@ -47,25 +47,6 @@
#error "must define CFG_CMD_FAT"
#error "must define CFG_CMD_FAT"
#endif
#endif
/*
* Check whether a USB memory stick is plugged in.
* If one is found:
* 1) if prepare.img ist found load it into memory. If it is
* valid then run it.
* 2) if preinst.img is found load it into memory. If it is
* valid then run it. Update the EEPROM.
* 3) if firmw_01.img is found load it into memory. If it is valid,
* burn it into FLASH and update the EEPROM.
* 4) if kernl_01.img is found load it into memory. If it is valid,
* burn it into FLASH and update the EEPROM.
* 5) if app.img is found load it into memory. If it is valid,
* burn it into FLASH and update the EEPROM.
* 6) if disk.img is found load it into memory. If it is valid,
* burn it into FLASH and update the EEPROM.
* 7) if postinst.img is found load it into memory. If it is
* valid then run it. Update the EEPROM.
*/
#undef AU_DEBUG
#undef AU_DEBUG
#undef debug
#undef debug
...
@@ -78,6 +59,7 @@
...
@@ -78,6 +59,7 @@
/* possible names of files on the USB stick. */
/* possible names of files on the USB stick. */
#define AU_FIRMWARE "u-boot.img"
#define AU_FIRMWARE "u-boot.img"
#define AU_KERNEL "kernel.img"
#define AU_KERNEL "kernel.img"
#define AU_ROOTFS "rootfs.img"
struct
flash_layout
{
struct
flash_layout
{
long
start
;
long
start
;
...
@@ -89,33 +71,45 @@ struct flash_layout {
...
@@ -89,33 +71,45 @@ struct flash_layout {
#define AU_FL_FIRMWARE_ND 0xfC03FFFF
#define AU_FL_FIRMWARE_ND 0xfC03FFFF
#define AU_FL_KERNEL_ST 0xfC0C0000
#define AU_FL_KERNEL_ST 0xfC0C0000
#define AU_FL_KERNEL_ND 0xfC1BFFFF
#define AU_FL_KERNEL_ND 0xfC1BFFFF
#define AU_FL_ROOTFS_ST 0xFC1C0000
#define AU_FL_ROOTFS_ND 0xFCFBFFFF
static
int
au_usb_stor_curr_dev
;
/* current device */
static
int
au_usb_stor_curr_dev
;
/* current device */
/* index of each file in the following arrays */
/* index of each file in the following arrays */
#define IDX_FIRMWARE 0
#define IDX_FIRMWARE 0
#define IDX_KERNEL 1
#define IDX_KERNEL 1
#define IDX_ROOTFS 2
/* max. number of files which could interest us */
/* max. number of files which could interest us */
#define AU_MAXFILES
2
#define AU_MAXFILES
3
/* pointers to file names */
/* pointers to file names */
char
*
aufile
[
AU_MAXFILES
];
char
*
aufile
[
AU_MAXFILES
]
=
{
AU_FIRMWARE
,
AU_KERNEL
,
AU_ROOTFS
};
/* sizes of flash areas for each file */
/* sizes of flash areas for each file */
long
ausize
[
AU_MAXFILES
];
long
ausize
[
AU_MAXFILES
]
=
{
(
AU_FL_FIRMWARE_ND
+
1
)
-
AU_FL_FIRMWARE_ST
,
(
AU_FL_KERNEL_ND
+
1
)
-
AU_FL_KERNEL_ST
,
(
AU_FL_ROOTFS_ND
+
1
)
-
AU_FL_ROOTFS_ST
};
/* array of flash areas start and end addresses */
/* array of flash areas start and end addresses */
struct
flash_layout
aufl_layout
[
AU_MAXFILES
]
=
{
\
struct
flash_layout
aufl_layout
[
AU_MAXFILES
]
=
{
{
AU_FL_FIRMWARE_ST
,
AU_FL_FIRMWARE_ND
,},
\
{
AU_FL_FIRMWARE_ST
,
AU_FL_FIRMWARE_ND
,},
{
AU_FL_KERNEL_ST
,
AU_FL_KERNEL_ND
,},
\
{
AU_FL_KERNEL_ST
,
AU_FL_KERNEL_ND
,},
{
AU_FL_ROOTFS_ST
,
AU_FL_ROOTFS_ND
,}
};
};
/* where to load files into memory */
/* where to load files into memory */
#define LOAD_ADDR ((unsigned char *)0x00200000)
#define LOAD_ADDR ((unsigned char *)0x00200000)
/* the app is the largest image */
/* the app is the largest image */
#define MAX_LOADSZ ausize[IDX_
KERNEL
]
#define MAX_LOADSZ ausize[IDX_
ROOTFS
]
/*i2c address of the keypad status*/
/*i2c address of the keypad status*/
#define I2C_PSOC_KEYPAD_ADDR 0x53
#define I2C_PSOC_KEYPAD_ADDR 0x53
...
@@ -163,7 +157,6 @@ int au_check_header_valid(int idx, long nbytes)
...
@@ -163,7 +157,6 @@ int au_check_header_valid(int idx, long nbytes)
{
{
image_header_t
*
hdr
;
image_header_t
*
hdr
;
unsigned
long
checksum
;
unsigned
long
checksum
;
unsigned
char
buf
[
4
];
hdr
=
(
image_header_t
*
)
LOAD_ADDR
;
hdr
=
(
image_header_t
*
)
LOAD_ADDR
;
/* check the easy ones first */
/* check the easy ones first */
...
@@ -200,6 +193,10 @@ int au_check_header_valid(int idx, long nbytes)
...
@@ -200,6 +193,10 @@ int au_check_header_valid(int idx, long nbytes)
printf
(
"Image %s wrong type
\n
"
,
aufile
[
idx
]);
printf
(
"Image %s wrong type
\n
"
,
aufile
[
idx
]);
return
-
1
;
return
-
1
;
}
}
if
((
idx
==
IDX_ROOTFS
)
&&
(
hdr
->
ih_type
!=
IH_TYPE_RAMDISK
))
{
printf
(
"Image %s wrong type
\n
"
,
aufile
[
idx
]);
return
-
1
;
}
/* recycle checksum */
/* recycle checksum */
checksum
=
ntohl
(
hdr
->
ih_size
);
checksum
=
ntohl
(
hdr
->
ih_size
);
/* for kernel and app the image header must also fit into flash */
/* for kernel and app the image header must also fit into flash */
...
@@ -257,7 +254,7 @@ int au_do_update(int idx, long sz)
...
@@ -257,7 +254,7 @@ int au_do_update(int idx, long sz)
flash_sect_erase
(
start
,
end
);
flash_sect_erase
(
start
,
end
);
wait_ms
(
100
);
wait_ms
(
100
);
/* strip the header - except for the kernel and ramdisk */
/* strip the header - except for the kernel and ramdisk */
if
(
hdr
->
ih_type
==
IH_TYPE_KERNEL
)
{
if
(
hdr
->
ih_type
==
IH_TYPE_KERNEL
||
hdr
->
ih_type
==
IH_TYPE_RAMDISK
)
{
addr
=
(
char
*
)
hdr
;
addr
=
(
char
*
)
hdr
;
off
=
sizeof
(
*
hdr
);
off
=
sizeof
(
*
hdr
);
nbytes
=
sizeof
(
*
hdr
)
+
ntohl
(
hdr
->
ih_size
);
nbytes
=
sizeof
(
*
hdr
)
+
ntohl
(
hdr
->
ih_size
);
...
@@ -305,7 +302,7 @@ int do_auto_update(void)
...
@@ -305,7 +302,7 @@ int do_auto_update(void)
int
i
,
res
,
bitmap_first
,
cnt
,
old_ctrlc
,
got_ctrlc
;
int
i
,
res
,
bitmap_first
,
cnt
,
old_ctrlc
,
got_ctrlc
;
char
*
env
;
char
*
env
;
long
start
,
end
;
long
start
,
end
;
char
keypad_status1
[
2
]
=
{
0
,
0
},
keypad_status2
[
2
]
=
{
0
,
0
};
u
char
keypad_status1
[
2
]
=
{
0
,
0
},
keypad_status2
[
2
]
=
{
0
,
0
};
/*
/*
* Read keypad status
* Read keypad status
...
@@ -317,10 +314,6 @@ int do_auto_update(void)
...
@@ -317,10 +314,6 @@ int do_auto_update(void)
/*
/*
* Check keypad
* Check keypad
*/
*/
if
(
!
(
keypad_status1
[
0
]
&
KEYPAD_MASK_HI
)
||
(
keypad_status1
[
0
]
!=
keypad_status2
[
0
]))
{
return
0
;
}
if
(
!
(
keypad_status1
[
1
]
&
KEYPAD_MASK_LO
)
||
if
(
!
(
keypad_status1
[
1
]
&
KEYPAD_MASK_LO
)
||
(
keypad_status1
[
1
]
!=
keypad_status2
[
1
]))
{
(
keypad_status1
[
1
]
!=
keypad_status2
[
1
]))
{
return
0
;
return
0
;
...
@@ -359,14 +352,6 @@ int do_auto_update(void)
...
@@ -359,14 +352,6 @@ int do_auto_update(void)
debug
(
"file_fat_detectfs failed
\n
"
);
debug
(
"file_fat_detectfs failed
\n
"
);
}
}
/* initialize the array of file names */
memset
(
aufile
,
0
,
sizeof
(
aufile
));
aufile
[
IDX_FIRMWARE
]
=
AU_FIRMWARE
;
aufile
[
IDX_KERNEL
]
=
AU_KERNEL
;
/* initialize the array of flash sizes */
memset
(
ausize
,
0
,
sizeof
(
ausize
));
ausize
[
IDX_FIRMWARE
]
=
(
AU_FL_FIRMWARE_ND
+
1
)
-
AU_FL_FIRMWARE_ST
;
ausize
[
IDX_KERNEL
]
=
(
AU_FL_KERNEL_ND
+
1
)
-
AU_FL_KERNEL_ST
;
/*
/*
* now check whether start and end are defined using environment
* now check whether start and end are defined using environment
* variables.
* variables.
...
@@ -381,8 +366,8 @@ int do_auto_update(void)
...
@@ -381,8 +366,8 @@ int do_auto_update(void)
end
=
simple_strtoul
(
env
,
NULL
,
16
);
end
=
simple_strtoul
(
env
,
NULL
,
16
);
if
(
start
>=
0
&&
end
&&
end
>
start
)
{
if
(
start
>=
0
&&
end
&&
end
>
start
)
{
ausize
[
IDX_FIRMWARE
]
=
(
end
+
1
)
-
start
;
ausize
[
IDX_FIRMWARE
]
=
(
end
+
1
)
-
start
;
aufl_layout
[
0
].
start
=
start
;
aufl_layout
[
IDX_FIRMWARE
].
start
=
start
;
aufl_layout
[
0
].
end
=
end
;
aufl_layout
[
IDX_FIRMWARE
].
end
=
end
;
}
}
start
=
-
1
;
start
=
-
1
;
end
=
0
;
end
=
0
;
...
@@ -394,9 +379,23 @@ int do_auto_update(void)
...
@@ -394,9 +379,23 @@ int do_auto_update(void)
end
=
simple_strtoul
(
env
,
NULL
,
16
);
end
=
simple_strtoul
(
env
,
NULL
,
16
);
if
(
start
>=
0
&&
end
&&
end
>
start
)
{
if
(
start
>=
0
&&
end
&&
end
>
start
)
{
ausize
[
IDX_KERNEL
]
=
(
end
+
1
)
-
start
;
ausize
[
IDX_KERNEL
]
=
(
end
+
1
)
-
start
;
aufl_layout
[
1
].
start
=
start
;
aufl_layout
[
IDX_KERNEL
].
start
=
start
;
aufl_layout
[
1
].
end
=
end
;
aufl_layout
[
IDX_KERNEL
].
end
=
end
;
}
}
start
=
-
1
;
end
=
0
;
env
=
getenv
(
"rootfs_st"
);
if
(
env
!=
NULL
)
start
=
simple_strtoul
(
env
,
NULL
,
16
);
env
=
getenv
(
"rootfs_nd"
);
if
(
env
!=
NULL
)
end
=
simple_strtoul
(
env
,
NULL
,
16
);
if
(
start
>=
0
&&
end
&&
end
>
start
)
{
ausize
[
IDX_ROOTFS
]
=
(
end
+
1
)
-
start
;
aufl_layout
[
IDX_ROOTFS
].
start
=
start
;
aufl_layout
[
IDX_ROOTFS
].
end
=
end
;
}
/* make certain that HUSH is runnable */
/* make certain that HUSH is runnable */
u_boot_hush_start
();
u_boot_hush_start
();
/* make sure that we see CTRL-C and save the old state */
/* make sure that we see CTRL-C and save the old state */
...
@@ -443,8 +442,8 @@ int do_auto_update(void)
...
@@ -443,8 +442,8 @@ int do_auto_update(void)
}
}
cnt
++
;
cnt
++
;
#ifdef AU_TEST_ONLY
#ifdef AU_TEST_ONLY
}
while
(
res
<
0
&&
cnt
<
3
);
}
while
(
res
<
0
&&
cnt
<
(
AU_MAXFILES
+
1
)
);
if
(
cnt
<
3
)
if
(
cnt
<
(
AU_MAXFILES
+
1
)
)
#else
#else
}
while
(
res
<
0
);
}
while
(
res
<
0
);
#endif
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录