redboot on QEMU for mini2440

发布时间: 2024-06-27
来源: 电子工程世界

这段时间一直在研究ecos,所以有了把ecos移植到mini2440的qemu平台的想法。经过几天的折腾,终于可以在qemu的上面看到redboot的命令了。

先看看成果,然后进入枯燥的coding历程 

现在开始看代码,:-) 

1. 获得代码 

git clone git://repo.or.cz/qemu/mini2440.git  qemu 

修改启动部分为ram的最小地址直接启动

  1. ricky@ricky-laptop:~/ecos/projects/mini2440-qemu/mini2440$ git diff  

  2. diff --git a/hw/mini2440.c b/hw/mini2440.c  

  3. index 5decf4b..7a70aae 100644  

  4. --- a/hw/mini2440.c  

  5. +++ b/hw/mini2440.c  

  6. @@ -258,46 +258,15 @@ static void mini2440_reset(void *opaque)  

  7.      struct mini2440_board_s *s = (struct mini2440_board_s *) opaque;  

  8.      uint32_t image_size;  

  9.    

  10. -       /* 

  11. -        * Normally we would load 4 KB of nand to SRAM and jump there, but 

  12. -        * it is not working perfectly as expected, so we cheat and load 

  13. -        * it from nand directly relocated to 0x33f80000 and jump there 

  14. -        */  

  15. -       if (mini2440_load_from_nand(s->nand, 0, S3C_RAM_BASE | 0x03f80000, 256*1  

  16. -               mini2440_printf("loaded default u-boot from NAND/n");  

  17. -               s->cpu->env->regs[15] = S3C_RAM_BASE | 0x03f80000; /* start addr 

  18. -       } 

  19. -#if 0 && defined(LATER) 

  20. -       if (mini2440_load_from_nand(s->nand, 0, S3C_SRAM_BASE_NANDBOOT, S3C_SRAM 

  21. -           s->cpu->env->regs[15] = S3C_SRAM_BASE_NANDBOOT;     /* start address 

  22. -           mini2440_printf("4KB SteppingStone loaded from NAND/n"); 

  23. -       } 

  24. -#endif 

  25. diff --git a/hw/mini2440.c b/hw/mini2440.c 

  26. index 5decf4b..7a70aae 100644 

  27. --- a/hw/mini2440.c 

  28. +++ b/hw/mini2440.c 

  29. @@ -258,46 +258,15 @@ static void mini2440_reset(void *opaque) 

  30.      struct mini2440_board_s *s = (struct mini2440_board_s *) opaque; 

  31.      uint32_t image_size; 

  32.   

  33. -       /* 

  34. -        * Normally we would load 4 KB of nand to SRAM and jump there, but 

  35. -        * it is not working perfectly as expected, so we cheat and load 

  36. -        * it from nand directly relocated to 0x33f80000 and jump there 

  37. -        */  

  38. -       if (mini2440_load_from_nand(s->nand, 0, S3C_RAM_BASE | 0x03f80000, 256*10  

  39. -               mini2440_printf("loaded default u-boot from NAND/n");  

  40. -               s->cpu->env->regs[15] = S3C_RAM_BASE | 0x03f80000; /* start addre 

  41. -       } 

  42. -#if 0 && defined(LATER) 

  43. -       if (mini2440_load_from_nand(s->nand, 0, S3C_SRAM_BASE_NANDBOOT, S3C_SRAM_ 

  44. -           s->cpu->env->regs[15] = S3C_SRAM_BASE_NANDBOOT;     /* start address, 

  45. -           mini2440_printf("4KB SteppingStone loaded from NAND/n"); 

  46. -       } 

  47. -#endif 

  48. -       /* 

  49. diff --git a/hw/mini2440.c b/hw/mini2440.c 

  50. index 5decf4b..7a70aae 100644 

  51. --- a/hw/mini2440.c 

  52. +++ b/hw/mini2440.c 

  53. @@ -258,46 +258,15 @@ static void mini2440_reset(void *opaque) 

  54.      struct mini2440_board_s *s = (struct mini2440_board_s *) opaque; 

  55.      uint32_t image_size; 

  56.   

  57. -       /* 

  58. -        * Normally we would load 4 KB of nand to SRAM and jump there, but 

  59. -        * it is not working perfectly as expected, so we cheat and load 

  60. -        * it from nand directly relocated to 0x33f80000 and jump there 

  61. -        */  

  62. -       if (mini2440_load_from_nand(s->nand, 0, S3C_RAM_BASE | 0x03f80000, 256*102  

  63. -               mini2440_printf("loaded default u-boot from NAND/n");  

  64. -               s->cpu->env->regs[15] = S3C_RAM_BASE | 0x03f80000; /* start addres 

  65. -       } 

  66. -#if 0 && defined(LATER) 

  67. -       if (mini2440_load_from_nand(s->nand, 0, S3C_SRAM_BASE_NANDBOOT, S3C_SRAM_S 

  68. -           s->cpu->env->regs[15] = S3C_SRAM_BASE_NANDBOOT;     /* start address,  

  69. -           mini2440_printf("4KB SteppingStone loaded from NAND/n"); 

  70. -       } 

  71. -#endif 

  72. -       /* 

  73. -        * if a u--boot is available as a file, we always use it 

  74. diff --git a/hw/mini2440.c b/hw/mini2440.c 

  75. index 5decf4b..7a70aae 100644 

  76. --- a/hw/mini2440.c 

  77. +++ b/hw/mini2440.c 

  78. @@ -258,46 +258,15 @@ static void mini2440_reset(void *opaque) 

  79.      struct mini2440_board_s *s = (struct mini2440_board_s *) opaque; 

  80.      uint32_t image_size; 

  81.   

  82. -       /* 

  83. -        * Normally we would load 4 KB of nand to SRAM and jump there, but 

  84. -        * it is not working perfectly as expected, so we cheat and load 

  85. -        * it from nand directly relocated to 0x33f80000 and jump there 

  86. -        */  

  87. -       if (mini2440_load_from_nand(s->nand, 0, S3C_RAM_BASE | 0x03f80000, 256*1024)>  

  88. -               mini2440_printf("loaded default u-boot from NAND/n");  

  89. -               s->cpu->env->regs[15] = S3C_RAM_BASE | 0x03f80000; /* start address,  

  90. -       } 

  91. -#if 0 && defined(LATER) 

  92. -       if (mini2440_load_from_nand(s->nand, 0, S3C_SRAM_BASE_NANDBOOT, S3C_SRAM_SIZE 

  93. -           s->cpu->env->regs[15] = S3C_SRAM_BASE_NANDBOOT;     /* start address, u-b 

  94. -           mini2440_printf("4KB SteppingStone loaded from NAND/n"); 

文章来源于: 电子工程世界 原文链接

本站所有转载文章系出于传递更多信息之目的,且明确注明来源,不希望被转载的媒体或个人可与我们联系,我们将立即进行删除处理。