odroid-u2-uboot: include mkbl2.c source and use it.

(This generates the same output as before on x86_64.)
This commit is contained in:
Christian Neukirchen 2015-04-03 22:47:49 +02:00
parent 5b31c1e28b
commit b52a072d79
2 changed files with 98 additions and 1 deletions

View File

@ -0,0 +1,95 @@
/*
* Copyright (c) 2010 Samsung Electronics Co., Ltd.
* http://www.samsung.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main (int argc, char *argv[])
{
FILE *fp;
unsigned char src;
char *Buf, *a;
int BufLen;
int nbytes, fileLen;
unsigned int checksum = 0;
int i;
if (argc != 4)
{
printf("Usage: mkbl1 <source file> <destination file> <size> \n");
return -1;
}
BufLen = atoi(argv[3]);
Buf = (char *)malloc(BufLen);
memset(Buf, 0x00, BufLen);
fp = fopen(argv[1], "rb");
if( fp == NULL)
{
printf("source file open error\n");
free(Buf);
return -1;
}
fseek(fp, 0L, SEEK_END);
fileLen = ftell(fp);
fseek(fp, 0L, SEEK_SET);
if ( BufLen > fileLen )
{
printf("Usage: unsupported size\n");
free(Buf);
fclose(fp);
return -1;
}
nbytes = fread(Buf, 1, BufLen, fp);
if ( nbytes != BufLen )
{
printf("source file read error\n");
free(Buf);
fclose(fp);
return -1;
}
fclose(fp);
for(i = 0;i < (14 * 1024) - 4;i++)
{
checksum += (unsigned char)(Buf[i]);
}
*(unsigned int*)(Buf+i) = checksum;
fp = fopen(argv[2], "wb");
if (fp == NULL)
{
printf("destination file open error\n");
free(Buf);
return -1;
}
a = Buf;
nbytes = fwrite( a, 1, BufLen, fp);
if ( nbytes != BufLen )
{
printf("destination file write error\n");
free(Buf);
fclose(fp);
return -1;
}
free(Buf);
fclose(fp);
return 0;
}

View File

@ -2,7 +2,7 @@
_githash=89f2ab95e7304fe02e5267f1282fbc178550d528
pkgname=odroid-u2-uboot
version=v2010.12
revision=1
revision=2
wrksrc="u-boot-${_githash}"
hostmakedepends="uboot-mkimage"
short_desc="Odroid U2 U-Boot files for SD booting"
@ -23,6 +23,8 @@ do_configure() {
}
do_build() {
${BUILD_CC} ${BUILD_CFLAGS} -o mkbl2 ${FILESDIR}/mkbl2.c
unset CFLAGS CXXFLAGS LDFLAGS
if [ "$CROSS_BUILD" ]; then