<div dir="ltr">Hi Gedare,<div><br></div><div style>I think the newest tar version 1.26 on linux may mismatch with rtems.</div><div style>I am not sure whether some tar command options may generate matching tarballs,</div><div style>
but I failed with trying "--posix" </div><div style>I "hexdump -C *.tar" and find it does include extened header, while RTEMS does not handle this. </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
2013/4/19 Gedare Bloom <span dir="ltr"><<a href="mailto:gedare@gwmail.gwu.edu" target="_blank">gedare@gwmail.gwu.edu</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<p>The tar version issue sounds like a bug. We should try to isolate just the version problem to see if it is easy to reproduce, then file a bug report.</p>
<div class="gmail_quote"><div><div class="h5">On Apr 19, 2013 3:23 AM, "Peng Fan" <<a href="mailto:van.freenix@gmail.com" target="_blank">van.freenix@gmail.com</a>> wrote:<br type="attribution"></div></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<div dir="ltr">Hi,<br><div class="gmail_extra"><br><div class="gmail_quote">2013/4/19 Chris Johns <span dir="ltr"><<a href="mailto:chrisj@rtems.org" target="_blank">chrisj@rtems.org</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div>Peng Fan wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
There are symbols in main.c that understand the tar file. Is<br>
something wrong with them ?<br>
<br>
I looked insight into the code and found that<br>
the fs-root.tar is untared by setup_rootfs->Untar_<u></u>FromMemory.<br>
Is it becasue the tar version on my host pc does not match Untar_* in<br>
RTEMS?<br>
I follow the compilation log to clarify how waf works and how<br>
fs-root.tar is compiled into rtld.look at the following:<br>
1. shell-init libx.a -> fs-root.tar -> fs-root-tarfile.o<br>
</blockquote>
<br></div>
Yes using objcopy.<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
2. init.c.5.o main.c.5.o fs-root-tarfile.o -lrtl -> rtld.prelink<br>
</blockquote>
<br></div>
Link it together.<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
3. nm rtld.prelink -> rtld-gsyms.c<br>
</blockquote>
<br></div>
Get the symbols present in the base image.<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
4. init.c main.c rtld-gsyms.c xa.c x-long-name...-in-archive.c<br>
-> x.rap<br>
</blockquote>
<br></div>
Create the RAP app.<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
5. shell-init libx.a x.rap -> fs-root.tar -> fs-root-tarfile.o<br>
</blockquote>
<br></div>
Build the tar file.<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
6. init.c.10.o main.c.10.o fs-root-tarfile.o rtld-gsyms.10.o -lrtl -> rtld<br>
</blockquote>
<br></div>
Relink with the symbol table generated so the base image has its own symbol table.<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
I also objdump the code to see if any address is wrong, but all is ok.<br>
Now what I doubt is only verison mismatch.<br>
</blockquote>
<br></div>
Great.<div><br></div></blockquote><div>Thanks for your encouragement. All is challenging and interesting.</div><div><br></div><div>I have resovled the "<span style="font-family:arial,sans-serif;font-size:14px">shell: open input /shell-init failed: No such file or directory</span>" problem. The version mismatch between my host(Opensuse with tar 1.26) and rtems Untar_*. </div>
<div><br></div><div>The code in Untar_FromMemory use the first 512 block as the header.It is right indeed. But it does not judge the linkflag whether it is extened or others, and this incurs error. The GNU tar 1.26:<a href="http://www.gnu.org/software/tar/manual/html_node/Standard.html" target="_blank">http://www.gnu.org/software/tar/manual/html_node/Standard.html</a> gives the details </div>
<div> </div><div><span style="font-size:smaller">#define XHDTYPE 'x' /*</span><span style="font-family:serif"> Extended header referring to the </span><span style="font-family:serif">next file in the archive </span><span style="font-size:smaller">*/</span></div>
<div><pre style="font-size:smaller">#define XGLTYPE 'g' /*<span style="font-family:serif"> Global extended header </span>*/</pre><pre><font face="arial"><span style="white-space:normal">If linkflag is XHDTYPE, we should reconsider how to process the header,because</span></font></pre>
<pre><font face="arial"><span style="white-space:normal">'x' means an extened header after the first begin header in which file_size is not the size of the size but the extened header.</span></font></pre>
<pre><font face="arial"><span style="white-space:normal">I use a simple way, under the original header processing code, adding the following code :</span></font></pre><pre><font face="arial"><span style="white-space:normal"><br>
</span></font></pre><pre><font face="arial"><span style="white-space:normal"> ptr += 512; //jump to the real header containing the size info of the file in tarball.</span></font></pre><pre><font face="arial"><span style="white-space:normal"> if (linkflag == 'x') { //here is really a simple way, because there are many other flags.</span></font></pre>
<pre><font face="arial"><span style="white-space:normal"> bufr = &tar_ptr[ptr];</span></font></pre><pre><font face="arial"><span style="white-space:normal"> strncpy(fname, bufr, MAX_NAME_FIELD_SIZE);</span></font></pre>
<pre><font face="arial"><span style="white-space:normal"> fname[MAX_NAME_FIELD_SIZE] = '\0';</span></font></pre><pre><font face="arial"><span style="white-space:normal"> linkflag = bufr[156];</span></font></pre>
<pre><font face="arial"><span style="white-space:normal"> file_size = _rtems_octal2ulong(&bufr[124], 12); </span></font></pre><pre><font face="arial"><span style="white-space:normal"> ptr += 512;</span></font></pre>
<pre><font face="arial"><span style="white-space:normal"> hdr_chksum = _rtems_octal2ulong(&bufr[148], 8);</span></font></pre><pre><font face="arial"><span style="white-space:normal"> sum = _rtems_tar_header_checksum(bufr);</span></font></pre>
<pre><font face="arial"><span style="white-space:normal"> if (sum != hdr_chksum)
{ </span></font></pre><pre><font face="arial"><span style="white-space:normal"> retval = UNTAR_INVALID_CHECKSUM;</span></font></pre><pre><font face="arial"><span style="white-space:normal"> break; </span></font></pre>
<pre><font face="arial"><span style="white-space:normal"> } </span></font></pre><pre><font face="arial"><span style="white-space:normal"> }
<br></span></font></pre><pre><span style="font-family:arial;white-space:normal">I do not know whether this is a bug for RTEMS or not. </span><font face="arial"><span style="white-space:normal"><br></span></font></pre>
<pre><font face="arial"><span style="white-space:normal">Added the code, I can see the three files: libx.a shell-init x.rap</span></font></pre><pre><font face="arial"><span style="white-space:normal">Here appears another problem:</span></font></pre>
<pre><font face="arial"><span style="white-space:normal">When "rap ld ./x.rap", it tells "error: loading: (0)</span></font><span style="white-space:normal;font-family:arial">"</span></pre>
<pre><font face="arial"><span style="white-space:normal">When "dlo x.rap", "error: duplicate global symbol: hello</span></font><span style="white-space:normal;font-family:arial">". However,</span><span style="font-family:arial;white-space:normal"> </span><font face="arial"><span style="white-space:normal">dlo libx.a:xa.c.1.o and dlo libx.a:x-long-name-to-create-gnu-extension-in-archive.c.1.o is ok.</span></font></pre>
<pre><font face="arial"><span style="white-space:normal"><br></span></font></pre></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
A question that I want your answer, is the rtld.prelink only used for<br>
generating rtld-gsymcs.c? I think it is, but not sure.<br>
<br>
</blockquote>
<br></div>
Yes. You need to perform a link so the needed symbols are pulled into the kernel. Once you have these symbols you can generate a symbol table and then relink. The original base image has a weak symbol which is overridden with the real symbol table.<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
When modified the rtems.py with "d.endswith('-rtems*eabi*' + version)",<br>
</blockquote>
<br>
The RTEMS tools are arm-rtems4.11. As far as I know there is no need for 'eabi' to be present in the tools any more.<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
It tells "error: libelf:elf_getdata: .ARM.attributes(xa.c.8.o): Invalid<br>
section descriptor"<br>
</blockquote>
<br></div>
This is the bug.<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
I may dig into rtl-host code to figure out why and this may be part of<br>
the work that I should focus on<br>
</blockquote>
<br></div>
Thanks. It will be in the ELF section parsing somewhere.<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
The project need work to implement more architectures. I am<br>
traveling at the moment and will be back later in the week. A<br>
proposal to work on these other archs would be welcome.<br>
<br>
I want to implement arm support first. If time permits, I will implement<br>
mips too.<br>
Now I can not evaluate the workload whether I can finish one, two or<br>
more. I am preparing the proposal and it'll be finished soon.<br>
</blockquote>
<br></div>
Great.</blockquote><div>Thanks </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span><font color="#888888"><br>
<br>
Chris<br>
</font></span></blockquote></div><br></div><div class="gmail_extra">Regards,</div><div class="gmail_extra">Peng.</div></div>
<br></div></div>_______________________________________________<br>
rtems-devel mailing list<br>
<a href="mailto:rtems-devel@rtems.org" target="_blank">rtems-devel@rtems.org</a><br>
<a href="http://www.rtems.org/mailman/listinfo/rtems-devel" target="_blank">http://www.rtems.org/mailman/listinfo/rtems-devel</a><br>
<br></blockquote></div>
</blockquote></div><br></div>