About riscv64-unknown-elf - riscv

I am new to rocket chip,
and I want to ask question.
where can I know what these command can do?
I already knew gcc(c compiler) and objdump(generate assembly code).
what others can do?

Use the standard Linux documentation. So take the name after the common riscv64-unknown-elf prefix and look it up in the manual. Eg...
man as
man ld
man objdump
man run
...etc...

Related

how to create a general manual for linux?

I am working in a company where they use lots of tools and commands for linux (internal and external)
I would like to create a custom manual, with examples per tool.
Thought of using info tool for this:
info CompanyName tool1
info CompanyName tool2
info CompanyName tool3
..
and the output of each should be a simple text of examples and comments added by me.
But as far as I know, the info in Linux is created for a specific tool and not for a your customized needs.
Any idea what would be the best way to achieve the above?
Currently I am using sublime with tab per tool and every once and then I update the sublime tab with the new examples.
Any advice will be most appreciated.
For what it's worth, I am not a fan of info pages. I prefer the good old Unix man pages and it is very simple to write them. You can simply open any man page in an editor, look at it's source and just copy it to suit your needs.
On most systems the man pages are found in a directory like /usr/share/man/{man1,man2,man3,man4,man5,man6,man7,man8}/, or you can use the -w option of the man command to see the location of any man page and then open it. For example
$ man -w ls
/usr/share/man/man1/ls.1.gz
$ vim /usr/share/man/man1/ls.1.gz
You can see how it is written, and mimic it to write your own man page. In order for anyone to be able to read the man page written by you, the man page has to be installed in one of the directories where the man utility searches for man pages. On Linux, you can usually see this list of directories by running the manpath command (on other systems it might be different and you will have to see the man page of the man command itself). If you store your man pages in one of these directories then any one can read it by using the man utility.
As per POSIX the man utility also respects the environment variable MANPATH, so if you store your man page in a non-standard location, you can set the MANPATH variable, so that man can look it up. Or you can also modify the /etc/man.conf file to add your man page directory to the search path of man.
Now, man pages use a macro language to do the mark up. Linux systems tend to use man(7) macro syntax, for which you can see the manual here
There is another modern macro set for writing man pages, called mdoc(7), which is used extensively in the BSD family of operating systems. You can see its manual here

What is LD_RUNPATH?

A couple of answers mention the LD_RUNPATH environment variable:
use RPATH but not RUNPATH?
How to blacklist a shared library to avoid it being fetched by the loader?
but I couldn't find any description or official reference, including in the ld(1) and ld.so(8) Linux man pages. It seems that the goal is to have a lower precedence than LD_LIBRARY_PATH, particularly useful under Solaris, where LD_LIBRARY_PATH overrides everything.
A search on Google shows some discussions involving LD_RUNPATH, but nothing concrete. A search on Wikipedia is also unsuccessful. I also did some compilation/run tests with shared libraries under GNU/Linux and Solaris, but couldn't notice any effect.
So, what is this environment variable? Is there any official documentation?
There is no LD_RUNPATH. Most likely this is a typo of LD_RUN_PATH or DT_RUNPATH.
Regarding DT_RUNPATH, TechBlog says:
The DT_RUNPATH value is set with the linker options -rpath (or
LD_RUN_PATH) and the –enable-new-dtags.
Sorry, did not fully understand (or read enough :) ), in the ld(1) manual you have the answer:
LD_RUN_PATH is used to initialise the run path if the -rpath option is not used.
You may find interresting informations on GNU GCC pages or on Linux documentation project.
See:
http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

Description to my file using man command

I created a small project using C to make some commands in Linux terminal.
I want to add a description to my project to call it when I use man command. Such as if my project name is hello.c, I want when I write command man hello.c to print the description I wrote for my project. Where do I write this description?
I saw this but don't know where or how I write the description.
There are several great tutorials for doing so:
How to write a man
page
Creating your own manpage
How to write a UNIX man page.
Pick one, and hack away.
If you feel that you are stuck somewhere, take a look at man pages from FreeBSD utilities like cat, echo, etc

No manual entry for fcntl problem

When I use `man fcntl' got the message:
No manual entry for fcntl
which the pkg is needed to install?
ps. I use debian.
In Debian these man pages are available in manpages-dev package.
This doesn't answer your question directly, but: I myself just use the internet: here is the first search result for "man fcntl" in google.
fcntl is a standard C library function so it should be one of your development packages. However, I long ago gave up on using man on the UNIX boxes themselves, try typing "man fcntl" into Google (with the quotes) to get online versions.
Just don't do this to try and figure out how man itself works. Typing "man man" into Google returns some interesting results (not safe for work).

Finding where Linux functions are defined

Is there a good database for Linux where I can search for a function name and it tells me which header it is defined in? Googling doesn't always work for me and there aren't always man pages.
Using manpages
For basic C functions, the manpages should work.
man 2 read
man 3 printf
Section 2 is for system calls (direct to the kernel), and section 3 is for standard C library calls. You can generally omit the section, and man will figure out what you need on its own.
Note that you may need to take extra steps to get development-related manpages on your system. For example, on my Debian system, I had to do apt-get install manpages-dev glibc-doc.
Using library-specific references
For non-basic C functions, you should check the documentation of the library you're using (e.g., GNU's docs for libstdc++, doc.qt.io for Qt, library.gnome.org for GNOME projects like GTK, and so on).
Using the web
linux.die.net is a good online mirror of web pages.
LSB Navigator (as described in this answer) looks cool. I did not know about that.
Using grep
Sometimes it's just easiest to search /usr/include yourself. grep works for this, but ack is much better. For example, if I'm trying to find the header that contains getRootLogger:
cd /usr/include
# Debian calls 'ack' ack-grep. Your system may differ.
# Add \b before and after to only match a complete word.
ack-grep '\bgetRootLogger\b'
ack will return a nicely formatted and colorized list of matches.
You can wrap this up in a function and put it in your .bashrc file (or equivalent) for easy use:
function findheaderfor() {
ack-grep \\b$1\\b /usr/include /usr/local/include
}
Try the man pages, I use them a lot. You get the files you need to include.
Sometimes you want to pass a section number. Here are some examples :
man 2 socket
man 2 accept
man 3 fopen
man sem_post
2 is for system call related functions
3 is for function from the C library.
If there is no ambiguity, the section number is not needed
If you are looking for kernel function definition or kernel source navigation, you should definitely try lxr.linux.no
Sure, have you tried "man" in Linux?
For C functions, you may want to do "man 3 ".
You could use LSB Navigator (use search field in the top-right corner). However, most functions, about which you will find header information there, have manpages as well.

Resources