资源简介
orangepi one编写 gboot 点亮LED
代码片段和文件信息
/*
* (C) Copyright 2007-2011
* Allwinner Technology Co. Ltd.
* Tom Cubie
*
* a simple tool to generate bootable image for sunxi platform.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not write to the Free Software
* Foundation Inc. 59 Temple Place Suite 330 Boston
* MA 02111-1307 USA
*/
#include
#include
#include
#include
#include
#include
#include
#include
typedef unsigned char u8;
typedef unsigned int u32;
/* boot head definition from sun4i boot code */
typedef struct boot_file_head
{
u32 jump_instruction; // one intruction jumping to real code
u8 magic[8]; // =“eGON.BT0“ or “eGON.BT1“ not C-style string.
u32 check_sum; // generated by PC
u32 length; // generated by PC
u32 pub_head_size; // the size of boot_file_head_t
u8 pub_head_vsn[4]; // the version of boot_file_head_t
u8 file_head_vsn[4]; // the version of boot0_file_head_t or boot1_file_head_t
u8 Boot_vsn[4]; // Boot version
u8 eGON_vsn[4]; // eGON version
u8 platform[8]; // platform information
}boot_file_head_t;
#define BOOT0_MAGIC “eGON.BT0“
#define STAMP_VALUE 0x5F0A6C39
/* check sum functon from sun4i boot code */
int gen_check_sum( void *boot_buf )
{
boot_file_head_t *head_p;
u32 length;
u32 *buf;
u32 loop;
u32 i;
u32 sum;
head_p = (boot_file_head_t *)boot_buf;
length = head_p->length;
if( ( length & 0x3 ) != 0 ) // must 4-byte-aligned
return -1;
buf = (u32 *)boot_buf;
head_p->check_sum = STAMP_VALUE; // fill stamp
loop = length >> 2;
/* calculate the sum */
for( i = 0 sum = 0; i < loop; i++ )
sum += buf[i];
/* write back check sum */
head_p->check_sum = sum;
return 0;
}
#define ALIGN(xa) __ALIGN_MASK((x)(typeof(x))(a)-1)
#define __ALIGN_MASK(xmask) (((x)+(mask))&~(mask))
#define SUN4I_SRAM_SIZE (24 * 1024)
#define SRAM_LOAD_MAX_SIZE (SUN4I_SRAM_SIZE - sizeof(boot_file_head_t))
#define BLOCK_SIZE 512
struct boot_img {
boot_file_head_t header;
char code[SRAM_LOAD_MAX_SIZE];
char pad[BLOCK_SIZE];
};
int main(int argc char * argv[])
{
int fd_in fd_out;
struct boot_img img;
unsigned file_size load_size;
int count;
if(argc < 2) {
printf(“\tThis program makes an
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-03-07 13:27 gboot-master\
文件 282 2019-03-07 13:27 gboot-master\Makefile
文件 328 2019-03-07 13:27 gboot-master\README.md
文件 112 2019-03-07 13:27 gboot-master\gboot.bin
文件 66780 2019-03-07 13:27 gboot-master\gboot.elf
文件 338 2019-03-07 13:27 gboot-master\gboot.lds
文件 1266 2019-03-07 13:27 gboot-master\start.S
文件 1544 2019-03-07 13:27 gboot-master\start.o
目录 0 2019-03-07 13:27 gboot-master\tools\
文件 58 2019-03-07 13:27 gboot-master\tools\Makefile
文件 512 2019-03-07 13:27 gboot-master\tools\gboot-sdcard.bin
文件 9064 2019-03-07 13:27 gboot-master\tools\mksunxiboot
文件 4407 2019-03-07 13:27 gboot-master\tools\mksunxiboot.c
- 上一篇:上海交通大学通信原理期末考试试题
- 下一篇:无参考图像质量评价资料
相关资源
- 华清远见uboot和linux内核移植实验手册
- UBOOTloadb命令加载应用程序到SDRAM中运
- Uboot启动流程国嵌视频里的文档
- imx6q直接从USB OTG运行uboot方法
- mini2440之U-boot移植详细手册-20110908.p
- MT7620_EEPROM编辑器可改MAC.rar
- 不死uboot-flash脚本
- iMX6从uboot到linux启动完成一直保持LO
- breed-mt7620-编程器
- tiny210-uboot.bin
- 香橙派orangepi的GPIO接口wiringOP_zero
- u-boot.bin_tekkaman_2009.11.bz2
- uboot中usb驱动代码
- Adsorption of Pb2+ and Zn2+ from aqueous solut
- Isotherm kinetics and thermodynamic studies of
- Application of orange peel xanthate for the ad
- Adsorption of copper and cadmium ions from aqu
- Isolation and Characterization of Homolog PtLE
-
Genome-wide identification and ex
pression a - Molecular cloning characterization and distrib
- Uboot命令详细解析
- OMAPL138_UBL移植
- 支持Yaffs2文件系统的U-Boot的实现
- FS4412系统移植实验手册-uboot移植
- uboot完全分析.pdf
- AR9344+AR9382+AR8035 内置不死UBOOT
- uboot_116-linux2.6.32.7z
- uboot代码详细分析.pdf
- Tiny6410_Uboot移植步骤详解
- 海思视频监控芯片linux内核与uboot配置
评论
共有 条评论