Embedded Linux Setup Path

Source: Internet
Author: User

Bloggers are now doing the development of a platform for a Realtek SDK. For some needs, add/usr/local/bin to the PATH environment variable.

The embedded Linux file system does not have/etc/profile similar files, only/etc/rcs. Bo Master found in the/etc/rcs add ' path= $PATH:/usr/local/bin ' did not make it in the serial terminal to take effect.

Bo Master Reasoning, why the system default PATH is: '/bin:/sbin/:/usr/bin '? Where did you specify that?

Bloggers finally found the BusyBox in the original. Because the init command called after the embedded Linux system is started is actually a subcommand in busybox.

In the init command, the system is initialized. The PATH environment variable is included.

In BUSYBOX/LIBBB/MESSAGES.C, there are the following:

As you can see, if we want to add another path, we should change the Bb_additional_path macro.

And this macro is defined in Busybox/include/platform.h:

This seems to be just for Android platforms.

If the ' Bb_additional_path ' is not defined above, it is defined by default in BUSYBOX/LIBBB/MESSAGES.C, but is empty by default.

Let's change it here:

So, after the system starts, the value of path is: "/sbin:/usr/sbin/:/bin:/usr/bin:/usr/local/bin".


Embedded Linux Setup Path

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.