色哟哟视频在线观看-色哟哟视频在线-色哟哟欧美15最新在线-色哟哟免费在线观看-国产l精品国产亚洲区在线观看-国产l精品国产亚洲区久久

0
  • 聊天消息
  • 系統消息
  • 評論與回復
登錄后你可以
  • 下載海量資料
  • 學習在線課程
  • 觀看技術視頻
  • 寫文章/發帖/加入社區
會員中心
創作中心

完善資料讓更多小伙伴認識你,還能領取20積分哦,立即完善>

3天內不再提示

RZ MPU工業控制教程連載(62)Yocto系統添加程序

瑞薩MCU小百科 ? 來源: 瑞薩MCU小百科 ? 2025-03-07 14:40 ? 次閱讀

14.7

Yocto系統添加程序

14.7.1 快速增加軟件包

在Yocto中如果我們期望在rootfs中添加一些軟件,例如可能是bash,可能是lsusb等,那么,我們可以有兩種方法:

手動添加,一個個文件的拷貝。

或者在bb文件中添加安裝項目,讓Yocto自動幫助我們添加。

第一種方法需要手動將軟件包的所有文件以及依賴都一個個添加進去,耗時耗力且易錯,因此使用第二中方法比較合適。

Yocto中Rootfs中添加軟件包的步驟

找到打包rootfs的最終bb

如果我們使用的是bitbake myir-image-full編譯命令。

那么,我們可以按照如下來搜索myir-image-full這個軟件包(任務),使用的是哪個bb文件:

11ba669c-fa40-11ef-9310-92fbcf53809c.png

在meta-myir-remi/recipes-images/images/myir-image-full.bb里面添加我們需要的軟件包。

我們只需要在IMAGE_INSTALL后面參考添加需要的軟件包。

11c8cf3e-fa40-11ef-9310-92fbcf53809c.png

參考下圖所示,在最底部增加一個lsusb軟件包,增加完成后,保存退出即可。

11d5a4ca-fa40-11ef-9310-92fbcf53809c.png

再次回到編譯空間~/renesas/yocto/myir-renesas-yocto/build-remi-1g目錄內,執行bitbake myir-image-full-k命令就可以自動將我們增加的lsusb編譯至最終系統內。

14.7.2 自定義本地bb軟件包

Yocto中一個軟件包是放在bb文件中的,然后很多的bb 文件集成一個recipe(配方),然后許多的recipe又組成一個meta layer,因此,要添加一個包其實就是在recipe下面添加一個bb(bitbake配置文件)。下面使用helloworld作為一個例子。

1

創建hello bb文件

例如下面就是到了meta-myir-remi layer里面找到一個名為recipes-demo配方增加我們的hello bb文件。

一個軟件包的結構使用tree可以看到,其有一個bb文件,然后其中還有一個目錄放著Makefile與source code:

11ebae5a-fa40-11ef-9310-92fbcf53809c.png

2

bb文件內容

其中的bb文件內容如下:

左右滑動查看完整內容

DESCRIPTION = "Hello World and Zlib test"
DEPENDS = "zlib"
SECTION = "libs"
LICENSE = "MIT"
PV = "3"
PR = "r0"


SRC_URI = " 
 file://helloYocto.c 
 file://zlibtest.c 
 file://makefile 
 "
 
LIC_FILES_CHKSUM = "file://helloYocto.c;md5=4c53a1f5243efa8c4d5ec1c3909d2c1f"
S = "${WORKDIR}"
do_compile () {
 make
}


do_install () {
install -d ${D}/usr/bin 


install -m 0755 ${S}/helloYocto ${D}/usr/bin
install -m 0755 ${S}/zlibtest ${D}/usr/bin
}


FILES_${PN} = " 
/usr/bin 
"

可以看到,bb文件中指定了下面幾個變量的值:

SRC_URI

LIC_FILES_CHKSUM:這個是checksum,如果是基于版本管理的source,那么不需要,例如git 與svn

FILES_$(PN):PN是Package number,指代軟件版本使用的PV與PR結合表示,即前面bitbake -s中看到的3-r0

還有兩個方法,這2個方法重載了bitbake中默認方法:

do_compile

do_install

這兩個方法,對應了Package中的compile與install task。

3

應用程序編寫

左右滑動查看完整內容

ubuntu@ubuntu2004:~/renesas/yocto/myir-renesas-yocto/layers/meta-myir-remi/recipes-d
emos/hello$ cd hello/
ubuntu@ubuntu2004:~/renesas/yocto/myir-renesas-yocto/layers/meta-myir-remi/recipes-d
emos/hello/hello$ ls
helloYocto.c makefile zlibtest.c

左右滑動查看完整內容

ubuntu@ubuntu2004:~/renesas/yocto/myir-renesas-yocto/layers/meta-myir-remi/recipes-d
emos/hello/hello$ cat helloYocto.c 
#include
#include
#include 


int main(int argc,char *argv[])
{


 printf("Hello World Yocto-SDK !!!");
 return 0;
}

左右滑動查看完整內容

ubuntu@ubuntu2004:~/renesas/yocto/myir-renesas-yocto/layers/meta-myir-remi/recipes-d
emos/hello/hello$ cat makefile 
TARGET=helloYocto zlibtest
LDFLAGS= -lz


all: $(TARGET)
helloYocto: helloYocto.o
$(CC) $(CFLAGS) -o $@ $^ 


zlibtest: zlibtest.o
$(CC) $(CFLAGS1) -o $@ $^ $(LDFLAGS)


clean:
rm -f $(OBJS) $(TARGET)

左右滑動查看完整內容

ubuntu@ubuntu2004:~/renesas/yocto/myir-renesas-yocto/layers/meta-myir-remi/recipes-d
emos/hello/hello$ cat zlibtest.c 
/* gun.c -- simple gunzip to give an example of the use of inflateBack()
* Copyright (C) 2003, 2005, 2008, 2010, 2012 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
 Version 1.7 12 August 2012 Mark Adler */
 
/* Version history:
 1.0 16 Feb 2003 First version for testing of inflateBack()
 1.1 21 Feb 2005 Decompress concatenated gzip streams
 Remove use of "this" variable (C++ keyword)
 Fix return value for in()
 Improve allocation failure checking

左右滑動查看完整內容

Add typecasting for void * structures
 Add -h option for command version and usage
 Add a bunch of comments
 1.2 20 Mar 2005 Add Unix compress (LZW) decompression
 Copy file attributes from input file to output file
 1.3 12 Jun 2005 Add casts for error messages [Oberhumer]
 1.4 8 Dec 2006 LZW decompression speed improvements
 1.5 9 Feb 2008 Avoid warning in latest version of gcc
 1.6 17 Jan 2010 Avoid signed/unsigned comparison warnings
 1.7 12 Aug 2012 Update for z_const usage in zlib 1.2.8
*/


/*
 gun [ -t ] [ name ... ]
 
 decompresses the data in the named gzip files. If no arguments are given,
 gun will decompress from stdin to stdout. The names must end in .gz, -gz,
 .z, -z, _z, or .Z. The uncompressed data will be written to a file name
 with the suffix stripped. On success, the original file is deleted. On
 failure, the output file is deleted. For most failures, the command will
 continue to process the remaining names on the command line. A memory
 allocation failure will abort the command. If -t is specified, then the
 listed files or stdin will be tested as gzip files for integrity (without
 checking for a proper suffix), no output will be written, and no files
 will be deleted.
 
 Like gzip, gun allows concatenated gzip streams and will decompress them,
 writing all of the uncompressed data to the output. Unlike gzip, gun allows
 an empty file on input, and will produce no error writing an empty output
 file.
 
 gun will also decompress files made by Unix compress, which uses LZW
 compression. These files are automatically detected by virtue of their
 magic header bytes. Since the end of Unix compress stream is marked by the
 end-of-file, they cannot be concantenated. If a Unix compress stream is
 encountered in an input file, it is the last stream in that file.
 
 Like gunzip and uncompress, the file attributes of the orignal compressed
 file are maintained in the final uncompressed file, to the extent that the
 user permissions allow it.
 
 On my Mac OS X PowerPC G4, gun is almost twice as fast as gunzip (version
 1.2.4) is on the same file, when gun is linked with zlib 1.2.2. Also the
 LZW decompression provided by gun is about twice as fast as the standard
 Unix uncompress command.
 */
 
/* external functions and related types and constants */
#include  /* fprintf() */
#include  /* malloc(), free() */
#include  /* strerror(), strcmp(), strlen(), memcpy() */
#include  /* errno */
#include  /* open() */
#include  /* read(), write(), close(), chown(), unlink() */
#include 
#include  /* stat(), chmod() */

左右滑動查看完整內容

#include  /* utime() */
#include "zlib.h" /* inflateBackInit(), inflateBack(), */
 /* inflateBackEnd(), crc32() */
 
/* function declaration */
#define local static


/* buffer constants */
#define SIZE 32768U /* input and output buffer sizes */
#define PIECE 16384 /* limits i/o chunks for 16-bit int case */


/* structure for infback() to pass to input function in() -- it maintains the
 input file and a buffer of size SIZE */
struct ind {
 int infile;
 unsigned char *inbuf;
};


/* Load input buffer, assumed to be empty, and return bytes loaded and a
 pointer to them. read() is called until the buffer is full, or until it
 returns end-of-file or error. Return 0 on error. */
local unsigned in(void *in_desc, z_const unsigned char **buf)
{
 int ret;
 unsigned len;
 unsigned char *next;
 struct ind *me = (struct ind *)in_desc;
 
 next = me->inbuf;
 *buf = next;
 len = 0;
 do {
 ret = PIECE;
 if ((unsigned)ret > SIZE - len)
 ret = (int)(SIZE - len);
 ret = (int)read(me->infile, next, ret);
 if (ret == -1) {
 len = 0;
 break;
 }
 next += ret;
 len += ret;
 } while (ret != 0 && len < SIZE);
 return len;
}


/* structure for infback() to pass to output function out() -- it maintains the
 output file, a running CRC-32 check on the output and the total number of
 bytes output, both for checking against the gzip trailer. (The length in
 the gzip trailer is stored modulo 2^32, so it's ok if a long is 32 bits and
 the output is greater than 4 GB.) */
struct outd {
 int outfile;
 int check; /* true if checking crc and total */
 unsigned long crc;
 unsigned long total;

左右滑動查看完整內容

};


/* Write output buffer and update the CRC-32 and total bytes written. write()
 is called until all of the output is written or an error is encountered.
 On success out() returns 0. For a write failure, out() returns 1. If the
 output file descriptor is -1, then nothing is written.
*/
local int out(void *out_desc, unsigned char *buf, unsigned len)
{
 int ret;
 struct outd *me = (struct outd *)out_desc;
 
 if (me->check) {
 me->crc = crc32(me->crc, buf, len);
 me->total += len;
 }
 if (me->outfile != -1)
 do {
 ret = PIECE;
 if ((unsigned)ret > len)
 ret = (int)len;
 ret = (int)write(me->outfile, buf, ret);
 if (ret == -1)
 return 1;
 buf += ret;
 len -= ret;
 } while (len != 0);
 return 0;
}


/* next input byte macro for use inside lunpipe() and gunpipe() */
#define NEXT() (have ? 0 : (have = in(indp, &next)), 
 last = have ? (have--, (int)(*next++)) : -1)


/* memory for gunpipe() and lunpipe() --
 the first 256 entries of prefix[] and suffix[] are never used, could
 have offset the index, but it's faster to waste the memory */
unsigned char inbuf[SIZE]; /* input buffer */
unsigned char outbuf[SIZE]; /* output buffer */
unsigned short prefix[65536]; /* index to LZW prefix string */
unsigned char suffix[65536]; /* one-character LZW suffix */
unsigned char match[65280 + 2]; /* buffer for reversed match or gzip
 32K sliding window */


/* throw out what's left in the current bits byte buffer (this is a vestigial
 aspect of the compressed data format derived from an implementation that
 made use of a special VAX machine instruction!) */
#define FLUSHCODE() 
 do { 
 left = 0; 
 rem = 0; 
 if (chunk > have) { 
 chunk -= have; 
 have = 0; 
 if (NEXT() == -1) 
 break; 

左右滑動查看完整內容

chunk--; 
 if (chunk > have) { 
 chunk = have = 0; 
 break; 
 } 
 } 
 have -= chunk; 
 next += chunk; 
 chunk = 0; 
 } while (0)
 
/* Decompress a compress (LZW) file from indp to outfile. The compress magic
 header (two bytes) has already been read and verified. There are have bytes
 of buffered input at next. strm is used for passing error information back
 to gunpipe().
 
 lunpipe() will return Z_OK on success, Z_BUF_ERROR for an unexpected end of
 file, read error, or write error (a write error indicated by strm->next_in
 not equal to Z_NULL), or Z_DATA_ERROR for invalid input.
*/
local int lunpipe(unsigned have, z_const unsigned char *next, struct ind *indp,
 int outfile, z_stream *strm)
{
 int last; /* last byte read by NEXT(), or -1 if EOF */
 unsigned chunk; /* bytes left in current chunk */
 int left; /* bits left in rem */
 unsigned rem; /* unused bits from input */
 int bits; /* current bits per code */
 unsigned code; /* code, table traversal index */
 unsigned mask; /* mask for current bits codes */
 int max; /* maximum bits per code for this stream */
 unsigned flags; /* compress flags, then block compress flag */
 unsigned end; /* last valid entry in prefix/suffix tables */
 unsigned temp; /* current code */
 unsigned prev; /* previous code */
 unsigned final; /* last character written for previous code */
 unsigned stack; /* next position for reversed string */
 unsigned outcnt; /* bytes in output buffer */
 struct outd outd; /* output structure */
 unsigned char *p;
 
 /* set up output */
 outd.outfile = outfile;
 outd.check = 0;
 
 /* process remainder of compress header -- a flags byte */
 flags = NEXT();
 if (last == -1)
 return Z_BUF_ERROR;
 if (flags & 0x60) {
 strm->msg = (char *)"unknown lzw flags set";
 return Z_DATA_ERROR;
 }
 max = flags & 0x1f;
 if (max < 9 || max > 16) {
 strm->msg = (char *)"lzw bits out of range";

左右滑動查看完整內容

return Z_DATA_ERROR;
 }
 if (max == 9) /* 9 doesn't really mean 9 */
 max = 10;
 flags &= 0x80; /* true if block compress */
 
 /* clear table */
 bits = 9;
 mask = 0x1ff;
 end = flags ? 256 : 255;
 
 /* set up: get first 9-bit code, which is the first decompressed byte, but
 don't create a table entry until the next code */
 if (NEXT() == -1) /* no compressed data is ok */
 return Z_OK;
 final = prev = (unsigned)last; /* low 8 bits of code */
 if (NEXT() == -1) /* missing a bit */
 return Z_BUF_ERROR;
 if (last & 1) { /* code must be < 256 */
 strm->msg = (char *)"invalid lzw code";
 return Z_DATA_ERROR;
 }
 rem = (unsigned)last >> 1; /* remaining 7 bits */
 left = 7;
 chunk = bits - 2; /* 7 bytes left in this chunk */
 outbuf[0] = (unsigned char)final; /* write first decompressed byte */
 outcnt = 1;
 
 /* decode codes */
 stack = 0;
 for (;;) {
 /* if the table will be full after this, increment the code size */
 if (end >= mask && bits < max) {
 FLUSHCODE();
 bits++;
 mask <<= 1;
 mask++;
 }
 /* get a code of length bits */
 if (chunk == 0) /* decrement chunk modulo bits */
 chunk = bits;
 code = rem; /* low bits of code */
 if (NEXT() == -1) { /* EOF is end of compressed data */
 /* write remaining buffered output */
 if (outcnt && out(&outd, outbuf, outcnt)) {
 strm->next_in = outbuf; /* signal write error */
 return Z_BUF_ERROR;
 }
 return Z_OK;
 }
 code += (unsigned)last << left; /* middle (or high) bits of code */
 left += 8;
 chunk--;
 if (bits > left) { /* need more bits */
 if (NEXT() == -1) /* can't end in middle of code */

左右滑動查看完整內容

return Z_BUF_ERROR;
 code += (unsigned)last << left; /* high bits of code */
 left += 8;
 chunk--;
 }
 code &= mask; /* mask to current code length */
 left -= bits; /* number of unused bits */
 rem = (unsigned)last >> (8 - left); /* unused bits from last byte */


 /* process clear code (256) */
 if (code == 256 && flags) {
 FLUSHCODE();
 bits = 9; /* initialize bits and mask */
 mask = 0x1ff;
 end = 255; /* empty table */
 continue; /* get next code */
 }
 
 /* special code to reuse last match */
 temp = code; /* save the current code */
 if (code > end) {
 /* Be picky on the allowed code here, and make sure that the code
 we drop through (prev) will be a valid index so that random
 input does not cause an exception. The code != end + 1 check is
 empirically derived, and not checked in the original uncompress
 code. If this ever causes a problem, that check could be safely
 removed. Leaving this check in greatly improves gun's ability
 to detect random or corrupted input after a compress header.
 In any case, the prev > end check must be retained. */
 if (code != end + 1 || prev > end) {
 strm->msg = (char *)"invalid lzw code";
 return Z_DATA_ERROR;
 }
 match[stack++] = (unsigned char)final;
 code = prev;
 }
 
 /* walk through linked list to generate output in reverse order */
 p = match + stack;
 while (code >= 256) {
 *p++ = suffix[code];
 code = prefix[code];
 }
 stack = p - match;
 match[stack++] = (unsigned char)code;
 final = code;


 /* link new table entry */
 if (end < mask) {
 end++;
 prefix[end] = (unsigned short)prev;
 suffix[end] = (unsigned char)final;
 }
 
 /* set previous code for next iteration */
 prev = temp;

左右滑動查看完整內容

/* write output in forward order */
 while (stack > SIZE - outcnt) {
 while (outcnt < SIZE)
 outbuf[outcnt++] = match[--stack];
 if (out(&outd, outbuf, outcnt)) {
 strm->next_in = outbuf; /* signal write error */
 return Z_BUF_ERROR;
 }
 outcnt = 0;
 }
 p = match + stack;
 do {
 outbuf[outcnt++] = *--p;
 } while (p > match);
 stack = 0;
 
 /* loop for next code with final and prev as the last match, rem and
 left provide the first 0..7 bits of the next code, end is the last
 valid table entry */
 }
}


/* Decompress a gzip file from infile to outfile. strm is assumed to have been
 successfully initialized with inflateBackInit(). The input file may consist
 of a series of gzip streams, in which case all of them will be decompressed
 to the output file. If outfile is -1, then the gzip stream(s) integrity is
 checked and nothing is written.
 
 The return value is a zlib error code: Z_MEM_ERROR if out of memory,
 Z_DATA_ERROR if the header or the compressed data is invalid, or if the
 trailer CRC-32 check or length doesn't match, Z_BUF_ERROR if the input ends
 prematurely or a write error occurs, or Z_ERRNO if junk (not a another gzip
 stream) follows a valid gzip stream.
*/
local int gunpipe(z_stream *strm, int infile, int outfile)
{
 int ret, first, last;
 unsigned have, flags, len;
 z_const unsigned char *next = NULL;
 struct ind ind, *indp;
 struct outd outd;
 
 /* setup input buffer */
 ind.infile = infile;
 ind.inbuf = inbuf;
 indp = &ind;
 
 /* decompress concatenated gzip streams */
 have = 0; /* no input data read in yet */
 first = 1; /* looking for first gzip header */
 strm->next_in = Z_NULL; /* so Z_BUF_ERROR means EOF */
 for (;;) {
 /* look for the two magic header bytes for a gzip stream */
 if (NEXT() == -1) {
 ret = Z_OK;

左右滑動查看完整內容

break; /* empty gzip stream is ok */
 }
 if (last != 31 || (NEXT() != 139 && last != 157)) {
 strm->msg = (char *)"incorrect header check";
 ret = first ? Z_DATA_ERROR : Z_ERRNO;
 break; /* not a gzip or compress header */
 }
 first = 0; /* next non-header is junk */
 /* process a compress (LZW) file -- can't be concatenated after this */
 if (last == 157) {
 ret = lunpipe(have, next, indp, outfile, strm);
 break;
 }
 
 /* process remainder of gzip header */
 ret = Z_BUF_ERROR;
 if (NEXT() != 8) { /* only deflate method allowed */
 if (last == -1) break;
 strm->msg = (char *)"unknown compression method";
 ret = Z_DATA_ERROR;
 break;
 }
 flags = NEXT(); /* header flags */
 NEXT(); /* discard mod time, xflgs, os */
 NEXT();
 NEXT();
 NEXT();
 NEXT();
 NEXT();
 if (last == -1) break;
 if (flags & 0xe0) {
 strm->msg = (char *)"unknown header flags set";
 ret = Z_DATA_ERROR;
 break;
 }
 if (flags & 4) { /* extra field */
 len = NEXT();
 len += (unsigned)(NEXT()) << 8;
 if (last == -1) break;
 while (len > have) {
 len -= have;
 have = 0;
 if (NEXT() == -1) break;
 len--;
 }
 if (last == -1) break;
 have -= len;
 next += len;
 }
 if (flags & 8) /* file name */
 while (NEXT() != 0 && last != -1)
 ;
 if (flags & 16) /* comment */
 while (NEXT() != 0 && last != -1)
 ;

左右滑動查看完整內容

if (flags & 2) { /* header crc */
 NEXT();
 NEXT();
 }
 if (last == -1) break;
 /* set up output */
 outd.outfile = outfile;
 outd.check = 1;
 outd.crc = crc32(0L, Z_NULL, 0);
 outd.total = 0;
 
 /* decompress data to output */
 strm->next_in = next;
 strm->avail_in = have;
 ret = inflateBack(strm, in, indp, out, &outd);
 if (ret != Z_STREAM_END) break;
 next = strm->next_in;
 have = strm->avail_in;
 strm->next_in = Z_NULL; /* so Z_BUF_ERROR means EOF */
 
 /* check trailer */
 ret = Z_BUF_ERROR;
 if (NEXT() != (int)(outd.crc & 0xff) ||
 NEXT() != (int)((outd.crc >> 8) & 0xff) ||
 NEXT() != (int)((outd.crc >> 16) & 0xff) ||
 NEXT() != (int)((outd.crc >> 24) & 0xff)) {
 /* crc error */
 if (last != -1) {
 strm->msg = (char *)"incorrect data check";
 ret = Z_DATA_ERROR;
 }
 break;
 }
 if (NEXT() != (int)(outd.total & 0xff) ||
 NEXT() != (int)((outd.total >> 8) & 0xff) ||
 NEXT() != (int)((outd.total >> 16) & 0xff) ||
 NEXT() != (int)((outd.total >> 24) & 0xff)) {
 /* length error */
 if (last != -1) {
 strm->msg = (char *)"incorrect length check";
 ret = Z_DATA_ERROR;
 }
 break;
 }
 /* go back and look for another gzip stream */
 }
 /* clean up and return */
 return ret;
}


/* Copy file attributes, from -> to, as best we can. This is best effort, so
 no errors are reported. The mode bits, including suid, sgid, and the sticky
 bit are copied (if allowed), the owner's user id and group id are copied

左右滑動查看完整內容

(again if allowed), and the access and modify times are copied. */
local void copymeta(char *from, char *to)
{
 struct stat was;
 struct utimbuf when;
 
 /* get all of from's Unix meta data, return if not a regular file */
 if (stat(from, &was) != 0 || (was.st_mode & S_IFMT) != S_IFREG)
 return;
 
 /* set to's mode bits, ignore errors */
 (void)chmod(to, was.st_mode & 07777);
 
 /* copy owner's user and group, ignore errors */
 (void)chown(to, was.st_uid, was.st_gid);
 
 /* copy access and modify times, ignore errors */
 when.actime = was.st_atime;
 when.modtime = was.st_mtime;
 (void)utime(to, &when);
}


/* Decompress the file inname to the file outnname, of if test is true, just
 decompress without writing and check the gzip trailer for integrity. If
 inname is NULL or an empty string, read from stdin. If outname is NULL or
 an empty string, write to stdout. strm is a pre-initialized inflateBack
 structure. When appropriate, copy the file attributes from inname to
 outname.
 
 gunzip() returns 1 if there is an out-of-memory error or an unexpected
 return code from gunpipe(). Otherwise it returns 0.
*/
local int gunzip(z_stream *strm, char *inname, char *outname, int test)
{
 int ret;
 int infile, outfile;
 
 /* open files */
 if (inname == NULL || *inname == 0) {
 inname = "-";
 infile = 0; /* stdin */
 }
 else {
 infile = open(inname, O_RDONLY, 0);
 if (infile == -1) {
 fprintf(stderr, "gun cannot open %s
", inname);
 return 0;
 }
 }
 if (test)
 outfile = -1;
 else if (outname == NULL || *outname == 0) {
 outname = "-";
 outfile = 1; /* stdout */
 }
 else {

左右滑動查看完整內容

outfile = open(outname, O_CREAT | O_TRUNC | O_WRONLY, 0666);
 if (outfile == -1) {
 close(infile);
 fprintf(stderr, "gun cannot create %s
", outname);
 return 0;
 }
 }
 errno = 0;
 
 /* decompress */
 ret = gunpipe(strm, infile, outfile);
 if (outfile > 2) close(outfile);
 if (infile > 2) close(infile);
 
 /* interpret result */
 switch (ret) {
 case Z_OK:
 case Z_ERRNO:
 if (infile > 2 && outfile > 2) {
 copymeta(inname, outname); /* copy attributes */
 unlink(inname);
 
 }
 if (ret == Z_ERRNO)
 fprintf(stderr, "gun warning: trailing garbage ignored in %s
",
 inname);
 break;
 case Z_DATA_ERROR:
 if (outfile > 2) unlink(outname);
 fprintf(stderr, "gun data error on %s: %s
", inname, strm->msg);
 break;
 case Z_MEM_ERROR:
 if (outfile > 2) unlink(outname);
 fprintf(stderr, "gun out of memory error--aborting
");
 return 1;
 case Z_BUF_ERROR:
 if (outfile > 2) unlink(outname);
 if (strm->next_in != Z_NULL) {
 fprintf(stderr, "gun write error on %s: %s
",
 outname, strerror(errno));
 }
 else if (errno) {
 fprintf(stderr, "gun read error on %s: %s
",
 inname, strerror(errno));
 }
 else {
 fprintf(stderr, "gun unexpected end of file on %s
",
 inname);
 }
 break;
 default:
 if (outfile > 2) unlink(outname);
 fprintf(stderr, "gun internal error--aborting
");
 return 1;
 }
 return 0;
}

左右滑動查看完整內容

/* Process the gun command line arguments. See the command syntax near the
 beginning of this source file. */
int main(int argc, char **argv)
{
 int ret, len, test;
 char *outname;
 unsigned char *window;
 z_stream strm;
 
 /* initialize inflateBack state for repeated use */
 window = match; /* reuse LZW match buffer */
 strm.zalloc = Z_NULL;
 strm.zfree = Z_NULL;
 strm.opaque = Z_NULL;
 ret = inflateBackInit(&strm, 15, window);
 if (ret != Z_OK) {
 fprintf(stderr, "gun out of memory error--aborting
");
 return 1;
 }
 
 /* decompress each file to the same name with the suffix removed */
 argc--;
 argv++;
 test = 0;
 if (argc && strcmp(*argv, "-h") == 0) {
 fprintf(stderr, "gun 1.6 (17 Jan 2010)
");
 fprintf(stderr, "Copyright (C) 2003-2010 Mark Adler
");
 fprintf(stderr, "usage: gun [-t] [file1.gz [file2.Z ...]]
");
 return 0;
 }
 if (argc && strcmp(*argv, "-t") == 0) {
 test = 1;
 argc--;
 argv++;
 }
 if (argc)
 do {
 if (test)
 outname = NULL;
 else {
 len = (int)strlen(*argv);
 if (strcmp(*argv + len - 3, ".gz") == 0 ||
 strcmp(*argv + len - 3, "-gz") == 0)
 len -= 3;
 else if (strcmp(*argv + len - 2, ".z") == 0 ||
 strcmp(*argv + len - 2, "-z") == 0 ||
 strcmp(*argv + len - 2, "_z") == 0 ||
 strcmp(*argv + len - 2, ".Z") == 0)
 len -= 2;
 else {
 fprintf(stderr, "gun error: no gz type on %s--skipping
",
 *argv);
 continue;
 }
 outname = malloc(len + 1);

左右滑動查看完整內容

if (outname == NULL) {
 fprintf(stderr, "gun out of memory error--aborting
");
 ret = 1;
 break;
 }
 memcpy(outname, *argv, len);
 outname[len] = 0;
 }
 ret = gunzip(&strm, *argv, outname, test);
 if (outname != NULL) free(outname);
 if (ret) break;
 } while (argv++, --argc);
 else
 ret = gunzip(&strm, NULL, NULL, test);
 
 /* clean up */
 inflateBackEnd(&strm);
 return ret;
}
ubuntu@ubuntu2004:~/renesas/yocto/myir-renesas-yocto/layers/meta-myir-remi/recipes-d
emos/hello/hello$

4

單獨編譯

ubuntu@ubuntu2004:~/renesas/yocto/myir-renesas-yocto/build-remi-1g$ bitbake-v hello

11f8ba0a-fa40-11ef-9310-92fbcf53809c.png

5

解決錯誤

~/renesas/yocto/myir-renesas-yocto/layers/meta-myir-

remi/recipes-demos/hello/

ubuntu@ubuntu2004:~/renesas/yocto/myir-renesas-

yocto/layers/meta-myir-remi/recipes-demos/hello$ vi hello.bb

120c3062-fa40-11ef-9310-92fbcf53809c.png

聲明:本文內容及配圖由入駐作者撰寫或者入駐合作網站授權轉載。文章觀點僅代表作者本人,不代表電子發燒友網立場。文章及其配圖僅供工程師學習之用,如有內容侵權或者其他違規問題,請聯系本站處理。 舉報投訴
  • mcu
    mcu
    +關注

    關注

    146

    文章

    17488

    瀏覽量

    354724
  • MPU
    MPU
    +關注

    關注

    0

    文章

    390

    瀏覽量

    49185
  • 瑞薩電子
    +關注

    關注

    37

    文章

    2891

    瀏覽量

    72739
  • 工業控制
    +關注

    關注

    38

    文章

    1481

    瀏覽量

    86247
  • yocto
    +關注

    關注

    0

    文章

    10

    瀏覽量

    5351

原文標題:Yocto系統添加程序——RZ MPU工業控制教程連載(62)

文章出處:【微信號:瑞薩MCU小百科,微信公眾號:瑞薩MCU小百科】歡迎添加關注!文章轉載請注明出處。

收藏 人收藏

    評論

    相關推薦

    RZ/G2L Linux系統如何添加新的內核模塊

    RZ/G2L Linux系統的鏡像基于yocto構建,本篇介紹如何添加新的內核模塊。
    的頭像 發表于 01-04 12:19 ?1957次閱讀
    <b class='flag-5'>RZ</b>/G2L Linux<b class='flag-5'>系統</b>如何<b class='flag-5'>添加</b>新的內核模塊

    請問在Multisim14中如何為MSP430添加程序啊?

    就可以添加程序,后面還可以調試程序等等,但是8051越來越滿足不了電路控制的需求了,想要用性能更好一點的單片機進行電路模擬。。
    發表于 06-25 20:24

    數據庫添加程序哪里

    各位大神,各位高手幫忙看看,這個數據庫添加程序問題出在哪里,我硬是沒搞明白。。。。。多指教現象是:無法正常添加至數據庫,數據庫已經創建好,連接測試成功,而這里卻是始終無法添加,
    發表于 08-10 16:50

    yocto項目添加程序和腳本的步驟簡析

    1 配方(recipe)文件創建在哪里?為了最快讓未接觸過yocto的同學完成helloworld程序添加,這里選擇把配方文件加在已有的layers中,并確保該layers會加入編譯。1.1 確認
    發表于 11-04 15:20

    RZ/T2M電機控制MPU怎么樣?有哪些特征應用?

    新推出的的RZ/T2M電機控制微處理器單元,該單元在單芯片上結合了快速、高精度的實時電機控制功能和工業以太網,同時還支持功能安全操作。通過提供電機
    發表于 03-01 14:42

    VLP v3.0.0 的 RZ/G2 組 Yocto 配方啟動指南

    VLP v3.0.0 的 RZ/G2 組 Yocto 配方啟動指南
    發表于 01-11 19:00 ?0次下載
    VLP v3.0.0 的 <b class='flag-5'>RZ</b>/G2 組 <b class='flag-5'>Yocto</b> 配方啟動指南

    RZ/V2L Yocto 配方啟動指南

    RZ/V2L Yocto 配方啟動指南
    發表于 01-13 19:04 ?1次下載
    <b class='flag-5'>RZ</b>/V2L <b class='flag-5'>Yocto</b> 配方啟動指南

    新品發布 | 瑞薩電子發布全新RZ/T2L工業MPU,可通過EtherCAT通信實現快速、準確的實時控制

    新品速遞 全球半導體解決方案供應商瑞薩電子(TSE:6723)今日宣布,推出一款支持EtherCAT通信協議的全新工業用微處理器(MPU)——RZ/T2L,為工業
    的頭像 發表于 03-25 06:45 ?817次閱讀

    VLP v3.0.0 的 RZ/G2組 Yocto 配方啟動指南

    VLP v3.0.0 的 RZ/G2 組 Yocto 配方啟動指南
    發表于 06-30 20:55 ?0次下載
    VLP v3.0.0 的 <b class='flag-5'>RZ</b>/G2組 <b class='flag-5'>Yocto</b> 配方啟動指南

    RZ/V2L Yocto 配方啟動指南

    RZ/V2L Yocto 配方啟動指南
    發表于 07-03 19:45 ?0次下載
    <b class='flag-5'>RZ</b>/V2L <b class='flag-5'>Yocto</b> 配方啟動指南

    高性能、多功能MPU RZ/T2M簡介

    RZ/T2M是一款行業領先的高性能、多功能MPU,可實現AC伺服系統工業電機等工業設備的高速處理、高精度
    的頭像 發表于 09-04 14:07 ?2094次閱讀
    高性能、多功能<b class='flag-5'>MPU</b> <b class='flag-5'>RZ</b>/T2M簡介

    RZ/T2M和RZ/N2L中Printf添加方法(使用查詢模式實現UART)

    RZ/N2L是一種工業以太網通信用MPU,可輕松將網絡功能添加工業設備中。
    的頭像 發表于 05-21 14:08 ?810次閱讀
    在<b class='flag-5'>RZ</b>/T2M和<b class='flag-5'>RZ</b>/N2L中Printf<b class='flag-5'>添加</b>方法(使用查詢模式實現UART)

    產品簡介 | RZ/A系列MPU

    產品簡介 | RZ/A系列MPU
    的頭像 發表于 05-24 08:06 ?534次閱讀
    產品簡介 | <b class='flag-5'>RZ</b>/A系列<b class='flag-5'>MPU</b>

    瑞薩RZ/T系列MPU的中斷重入實現

    基于Arm的RZ/T系列MPU通過工業以太網通信提供高性能和高速實時控制,為自動化市場構建高性能系統R
    的頭像 發表于 07-23 14:47 ?766次閱讀
    瑞薩<b class='flag-5'>RZ</b>/T系列<b class='flag-5'>MPU</b>的中斷重入實現

    工業MPU新標桿,多協議工業以太網+運動控制 - 瑞薩RZ/T2H 新產品

    先進高端工業專用MPU RZ/T2H于2024年11月上市,集成了強大的應用處理功能和高精度實時控制性能,高達9軸電機控制。這款產品是在現有
    的頭像 發表于 12-06 16:57 ?634次閱讀
    <b class='flag-5'>工業</b><b class='flag-5'>MPU</b>新標桿,多協議<b class='flag-5'>工業</b>以太網+運動<b class='flag-5'>控制</b> - 瑞薩<b class='flag-5'>RZ</b>/T2H 新產品
    主站蜘蛛池模板: 国产精品女上位好爽在线短片 | 365电影成人亚洲网在线观看 | 欧美 国产 日产 韩国 在线 | 久久精品美女 | 怡春院欧美一区二区三区免费 | 护士一级片| 青草影院内射中出高潮-百度 | 性绞姿始动作动态图 | 99免费视频观看 | 狠狠色狠狠色狠狠五月ady | 伊人影院香蕉久在线26 | 98色精品视频在线 | 与子敌伦刺激对白亂輪亂性 | 中文在线观看永久免费 | 99久酒店在线精品2019 | 97精品国产自产在线观看永久 | 亚洲a视频在线观看 | 日韩免费一区二区三区在线 | 亚洲国产成人精品无码区5566 | 九九热久久只有精品2 | 日本高清不卡码无码v亚洲 日本福利片午夜免费观着 日本粉嫩学生毛绒绒 | 和老外3p爽粗大免费视频 | 日本一二三区在线视频 | 东京热无码中文字幕av专区 | 亚洲午夜精品久久久久久抢 | 草莓西瓜樱桃香蕉直播视频 | 成年人视频在线免费播放 | 9亚洲欧洲免费无码在线 | 国产野外无码理论片在线观看 | 国产亚洲精品久久久久久线投注 | 午夜伦伦电影理论片费看 | 十分钟免费看完整视频 | 亚州天堂在线视频av | 国产精品视频yy9099 | 中文在线日韩亚洲制服 | 国产成人在线播放视频 | 国产精品…在线观看 | 日本阿v片在线播放免费 | 三级网址在线 | 欧美日韩在线亚洲一 | 日日日夜夜在线视频 |