yocto项目修改busybox

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

yocto项目修改busybox

Jump to solution
5,929 Views
luoyaojun
Contributor II

在使用yocto项目生成image过程中涉及到一些busybox中的命令行增加、删除,比如,我想删除busybox中的udhcpc的命令:

bitbake -c menuconfig busybox 去掉udhcpc的选项

bitbake busybox 重新编译busybox

bitbake core-image-base重新生成image,生成的image中仍然带udhcpc,我该如何修改busybox去掉或增加一些命令?是否需要修改bb文件中的SRC_URI?去掉ftp://xxxxxx/udhcpc

Labels (1)
0 Kudos
1 Solution
5,479 Views
karangajjar
Senior Contributor II

Hi luo yaojun,

You can follow the below steps to disable just udhcpc from the image file:

1. $ bitbake -c menuconfig busybox

2. Unselect udhcpc and udhcpd.

    Save & exit

3. $bitbake -c diffconfig busybox

4. Create busybox_%.bbapend under directory:

    sources/poky/meta/recipes-core/busybox/

    Add below two lines in the file created above:

    FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
    SRC_URI += "file://fragment.cfg

5. Copy the file (fragment.cfg) created in step 3 to sources/poky/meta/recipes-core/busybox/

    Copy below to line to the file fragment.cfg

    CONFIG_UDHCPD=n
    CONFIG_UDHCPC=n

6. $bitbake <image>

You can see the sbin will not contain udhcpc.

Also, you can follow the below document for package dependencies and task list:

https://community.nxp.com/docs/DOC-94953 

Regards,

Karan Gajjar

View solution in original post

7 Replies
5,479 Views
karangajjar
Senior Contributor II

Hi luo yaojun,

Have you tried modifying conf/local.conf? You can follow the Yocto Project Reference Manual  and check out the macros that we can use to remove the packages that we do need. Like PACKAGE_EXCLUDE, BAD_RECOMMENDATIONS.

Regards,

Karan Gajjar

0 Kudos
5,479 Views
luoyaojun
Contributor II

我尝试过使用PACKAGE_EXCLUDE=“busybox-udhcpc dhcp”的方式去掉udhcpc命令,但都没成功。

0 Kudos
5,479 Views
karangajjar
Senior Contributor II

Hi luo yaojun,

We checked with BAD_RECOMMENDATIONS = "busybox-udhcpc" in conf/local.conf. After rebuilding the image, we could not any file with *udhcpc* in the roots. Can you let us know if above command works? And which binary file you want to remove?

Regards,

Karan Gajjar

0 Kudos
5,479 Views
luoyaojun
Contributor II

我想要删除image中的udhcpc命令,而这个命令是通过busybox生成的:

lrwxrwxrwx 1 root root 19 4月 6 07:53 sbin/udhcpc -> /bin/busybox.nosuid

这样的命令我该如何删除?

另外:

我该如何知道哪个命令属于那个package,例如:我需要添加useradd命令(非adduser命令,adduser是通过busybox生成的),这个命令应该是需要单独下载源码编译的,dot文件中没有找到useradd的相关信息,但是fsl-image-qt5这个image中包含了useradd命令。我该append哪个package来安装它们?

0 Kudos
5,479 Views
karangajjar
Senior Contributor II

Hi luo yaojun,

You can add the following lines in your local.conf.

VIRTUAL-RUNTIME_base-utils = ""
VIRTUAL-RUNTIME_login_manager = "shadow"

NOTE: This will remove all busybox commands from the image.

Do you want to remove all busybox commands or just udhcpc?

Regards,

Karan Gajjar

0 Kudos
5,479 Views
luoyaojun
Contributor II

只想去掉udhcpc命令。

是否有相关文档描述在yocto中新增、删除某个命令或者库所需要的depend包名字?

例如我需要添加alsa库,我使用bitbake -s |grep alsa-*搜索结果如下:

alsa-lib :1.0.28-r0
alsa-lib-native :1.0.28-r0
alsa-oss :1.0.17-r1
alsa-state :0.2.0-r5
alsa-tools :1.0.28-r0
alsa-utils :1.0.28-r1
alsa-utils-alsaconf :1.0.28-r1
flite-alsa :1.3-r1
fsl-alsa-plugins :1.0.25-r0
nativesdk-alsa-lib :1.0.28-r0
python-pyalsaaudio :0.4-ml2

这些package各自包含哪些内容?是否有相关文档描述?

0 Kudos
5,480 Views
karangajjar
Senior Contributor II

Hi luo yaojun,

You can follow the below steps to disable just udhcpc from the image file:

1. $ bitbake -c menuconfig busybox

2. Unselect udhcpc and udhcpd.

    Save & exit

3. $bitbake -c diffconfig busybox

4. Create busybox_%.bbapend under directory:

    sources/poky/meta/recipes-core/busybox/

    Add below two lines in the file created above:

    FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
    SRC_URI += "file://fragment.cfg

5. Copy the file (fragment.cfg) created in step 3 to sources/poky/meta/recipes-core/busybox/

    Copy below to line to the file fragment.cfg

    CONFIG_UDHCPD=n
    CONFIG_UDHCPC=n

6. $bitbake <image>

You can see the sbin will not contain udhcpc.

Also, you can follow the below document for package dependencies and task list:

https://community.nxp.com/docs/DOC-94953 

Regards,

Karan Gajjar