Skip to content

天楚锐齿

人工智能 云计算 大数据 物联网 IT 通信 嵌入式

天楚锐齿

  • 下载
  • 物联网
  • 云计算
  • 大数据
  • 人工智能
  • Linux&Android
  • 网络
  • 通信
  • 嵌入式
  • 杂七杂八

mini6410板uboot的Armlinux.c

2018-03-13

void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
ulong addr, ulong *len_ptr, int verify)
{
ulong len = 0, checksum;
ulong initrd_start, initrd_end;
ulong data;
void (*theKernel)(int zero, int arch, uint params);
image_header_t *hdr = &header;
bd_t *bd = gd->bd;

#ifdef CONFIG_CMDLINE_TAG
char *commandline = getenv (“bootargs”);
#endif

theKernel = (void (*)(int, int, uint))ntohl(hdr->ih_ep);

/*
* Check if there is an initrd image
*/
if (argc >= 3) {
SHOW_BOOT_PROGRESS (9);

addr = simple_strtoul (argv[2], NULL, 16);

printf (“## Loading Ramdisk Image at %08lx …\n”, addr);

/* Copy header so we can blank CRC field for re-calculation */
#ifdef CONFIG_HAS_DATAFLASH
if (addr_dataflash (addr)) {
read_dataflash (addr, sizeof (image_header_t),
(char *) &header);
} else
#endif
memcpy (&header, (char *) addr,
sizeof (image_header_t));

if (ntohl (hdr->ih_magic) != IH_MAGIC) {
printf (“Bad Magic Number\n”);
SHOW_BOOT_PROGRESS (-10);
do_reset (cmdtp, flag, argc, argv);
}

data = (ulong) & header;
len = sizeof (image_header_t);

checksum = ntohl (hdr->ih_hcrc);
hdr->ih_hcrc = 0;

if (crc32 (0, (unsigned char *) data, len) != checksum) {
printf (“Bad Header Checksum\n”);
SHOW_BOOT_PROGRESS (-11);
do_reset (cmdtp, flag, argc, argv);
}

SHOW_BOOT_PROGRESS (10);

print_image_hdr (hdr);

data = addr + sizeof (image_header_t);
len = ntohl (hdr->ih_size);

#ifdef CONFIG_HAS_DATAFLASH
if (addr_dataflash (addr)) {
read_dataflash (data, len, (char *) CFG_LOAD_ADDR);
data = CFG_LOAD_ADDR;
}
#endif

if (verify) {
ulong csum = 0;

printf (”   Verifying Checksum … “);
csum = crc32 (0, (unsigned char *) data, len);
if (csum != ntohl (hdr->ih_dcrc)) {
printf (“Bad Data CRC\n”);
SHOW_BOOT_PROGRESS (-12);
do_reset (cmdtp, flag, argc, argv);
}
printf (“OK\n”);
}

SHOW_BOOT_PROGRESS (11);

if ((hdr->ih_os != IH_OS_LINUX) ||
(hdr->ih_arch != IH_CPU_ARM) ||
(hdr->ih_type != IH_TYPE_RAMDISK)) {
printf (“No Linux ARM Ramdisk Image\n”);
SHOW_BOOT_PROGRESS (-13);
do_reset (cmdtp, flag, argc, argv);
}

#if defined(CONFIG_B2) || defined(CONFIG_EVB4510) || defined(CONFIG_ARMADILLO)
/*
*we need to copy the ramdisk to SRAM to let Linux boot
*/
memmove ((void *) ntohl(hdr->ih_load), (uchar *)data, len);
data = ntohl(hdr->ih_load);
#endif /* CONFIG_B2 || CONFIG_EVB4510 */

/*
* Now check if we have a multifile image
*/
} else if ((hdr->ih_type == IH_TYPE_MULTI) && (len_ptr[1])) {
ulong tail = ntohl (len_ptr[0]) % 4;
int i;

SHOW_BOOT_PROGRESS (13);

/* skip kernel length and terminator */
data = (ulong) (&len_ptr[2]);
/* skip any additional image length fields */
for (i = 1; len_ptr[i]; ++i)
data += 4;
/* add kernel length, and align */
data += ntohl (len_ptr[0]);
if (tail) {
data += 4 – tail;
}

len = ntohl (len_ptr[1]);

} else {
/*
* no initrd image
*/
SHOW_BOOT_PROGRESS (14);

len = data = 0;
}

#ifdef     DEBUG
if (!data) {
printf (“No initrd\n”);
}
#endif

if (data) {
initrd_start = data;
initrd_end = initrd_start + len;
} else {
initrd_start = 0;
initrd_end = 0;
}

SHOW_BOOT_PROGRESS (15);

debug (“## Transferring control to Linux (at address %08lx) …\n”,
(ulong) theKernel);

#if defined (CONFIG_SETUP_MEMORY_TAGS) || \
defined (CONFIG_CMDLINE_TAG) || \
defined (CONFIG_INITRD_TAG) || \
defined (CONFIG_SERIAL_TAG) || \
defined (CONFIG_REVISION_TAG) || \
defined (CONFIG_LCD) || \
defined (CONFIG_VFD)
setup_start_tag (bd);
#ifdef CONFIG_SERIAL_TAG
setup_serial_tag (&params);
#endif
#ifdef CONFIG_REVISION_TAG
setup_revision_tag (&params);
#endif
#ifdef CONFIG_SETUP_MEMORY_TAGS
setup_memory_tags (bd);
#endif
#ifdef CONFIG_CMDLINE_TAG
setup_commandline_tag (bd, commandline);
#endif
#ifdef CONFIG_INITRD_TAG
if (initrd_start && initrd_end)
setup_initrd_tag (bd, initrd_start, initrd_end);
#endif
#if defined (CONFIG_VFD) || defined (CONFIG_LCD)
setup_videolfb_tag ((gd_t *) gd);
#endif
setup_end_tag (bd);
#endif

/* we assume that the kernel is in place */
printf (“\nStarting kernel …\n\n”);

#ifdef CONFIG_USB_DEVICE
{
extern void udc_disconnect (void);
udc_disconnect ();
}
#endif

cleanup_before_linux ();

theKernel (0, bd->bi_arch_number, bd->bi_boot_params);              /*此处开始运行内核的第一个函数,就是哪个linux内核的head.S里面定义的start段的第一条指令。其参数为r0:固定0,r1:唯一标记的板架构号,r2:板启动参数,这两个参数定义在Mini6410.c的board_init函数中。*/
}

1,159次阅读

Post navigation

前一篇:

mini6410板uboot的Cmd_bootm.c

后一篇:

linux的arch/arm/kernel/head.S

发表回复 取消回复

要发表评论,您必须先登录。

个人介绍

需要么,有事情这里找联系方式:关于天楚锐齿

=== 美女同欣赏,好酒共品尝 ===

微信扫描二维码赞赏该文章:

扫描二维码分享该文章:

分类

  • Linux&Android (81)
  • Uncategorized (1)
  • 下载 (28)
  • 云计算 (38)
  • 人工智能 (9)
  • 大数据 (35)
  • 嵌入式 (34)
  • 杂七杂八 (35)
  • 物联网 (65)
  • 网络 (25)
  • 通信 (22)

归档

近期文章

  • 飞书机器人发送卡片interactive消息
  • Springboot JPA实现对数据库表统一的增删改查
  • WEB的内容安全策略CSP(Content-Security-Policy)
  • CSS利用@media和viewport实现响应式布局自动适配手机电脑等
  • VUE前端增加国际化支持

近期评论

  • linux爱好者 发表在《Linux策略路由及iptables mangle、ip rule、ip route关系及一种Network is unreachable错误》
  • maxshu 发表在《使用Android的HIDL+AIDL方式编写从HAL层到APP层的程序》
  • Ambition 发表在《使用Android的HIDL+AIDL方式编写从HAL层到APP层的程序》
  • Ambition 发表在《使用Android的HIDL+AIDL方式编写从HAL层到APP层的程序》
  • maxshu 发表在《Android9下用ethernet 的Tether模式来做路由器功能》

阅读量

  • 使用Android的HIDL+AIDL方式编写从HAL层到APP层的程序 - 23,805次阅读
  • 卸载深信服Ingress、SecurityDesktop客户端 - 18,510次阅读
  • 车机技术之车规级Linux-Automotive Grade Linux(AGL) - 10,564次阅读
  • linux下的unbound DNS服务器设置详解 - 9,321次阅读
  • 在Android9下用ndk编译vSomeIP和CommonAPI以及使用例子 - 9,133次阅读
  • linux的tee命令导致ssh客户端下的shell卡住不动 - 8,637次阅读
  • Linux策略路由及iptables mangle、ip rule、ip route关系及一种Network is unreachable错误 - 8,124次阅读
  • 车机技术之360°全景影像(环视)系统 - 8,085次阅读
  • 车机技术之Android Automotive - 7,938次阅读
  • Windows下安装QEMU并在qemu上安装ubuntu和debian - 7,839次阅读

其他操作

  • 注册
  • 登录
  • 条目 feed
  • 评论 feed
  • WordPress.org

联系方式

地址
深圳市科技园

时间
周一至周五:  9:00~12:00,14:00~18:00
周六和周日:10:00~12:00

标签

android AT命令 CAN centos docker Hadoop hdfs ip java kickstart linux mapreduce mini6410 modem nova OAuth openstack os python socket ssh uboot 内核 协议 安装 嵌入式 性能 报表 授权 操作系统 数据 数据库 月报 模型 汽车 深信服 源代码 统计 编译 脚本 虚拟机 调制解调器 车机 金融 鉴权
© 2025 天楚锐齿