[OpenWrt-Devel] Reducing the root file system in openwrt

Ronaldo Afonso ronaldo at ronaldoafonso.com.br
Wed Mar 7 14:01:12 EST 2018


  Arjav,

  As far as I know, the final package will end up in the "staging_dir"
directory, not the build_dir. Inside the build_dir will be all the binaries
compiled by the package.

  Try doing something like:

   1) Edit the Makefile(s) and remove the lines that install binaries you
don't want.
   2) Issue: make V=s package/"the package you are compiling"/{clen,install}
   3) Check the bin and staging_dir directories (the bin directory is where
the final package will be, in the staging_dir, you can check what was put
inside the package)



2018-03-07 10:24 GMT-03:00 Arjav Parikh <parikharjav24 at gmail.com>:

> Hi Ronaldo,
>
> I tried doing that by removing the copy line in Makefile but anyhow those
> files come into build_dir.
>
> I suspect that those files get included from dl directory. Is my
> understanding in this correct?
>
> If I remove packages from dl directory then I get compilation errors.
>
>
> Thanks & Regards,
> Arjav Parikh
>
> On Mar 7, 2018 6:49 PM, "Ronaldo Afonso" <ronaldo at ronaldoafonso.com.br>
> wrote:
>
>>   Arjav,
>>
>>   I'm not 100% sure of that, but if I were you I would take a look at the
>> Makefiles that generate those packages whose files you don't want to be
>> included in the final build image.
>>
>>   Often the "install" directive of an OpenWrt Makefile is where
>> developers "include" the files they want to be include in the final image.
>>
>>   Here is an example of libbz2 package:
>>
>>  77 define Package/libbz2/install
>>  78     $(INSTALL_DIR) $(1)/usr/lib/
>>  79     $(CP) $(PKG_BUILD_DIR)/libbz2.so.$(PKG_VERSION) $(1)/usr/lib/
>>  80     $(LN) libbz2.so.$(PKG_VERSION) $(1)/usr/lib/libbz2.so.1.0
>>  81 endef
>>
>>   For example, if you don't want the "libbz2.so" to be included, you can
>> remove lines 79 and 80.
>>
>>
>>
>>
>>
>> 2018-03-07 9:00 GMT-03:00 Arjav Parikh <parikharjav24 at gmail.com>:
>>
>>> Hi Ronaldo,
>>>
>>> I am building firmware for IPQ806x platform. I have been able to
>>> reduce my firmware image from 22 MB to 10 MB  by disabling unwanted
>>> kernel modules and libraries using make menuconfig.
>>>
>>> But there are files in root-ipq806x/lib/fimrware directory of approx
>>> size 4.4 MB. I do not require any of the files present in this
>>> directory. I tried to remove those files by removing its entry from
>>> root-ipq806x/usr/lib/opkg/info/wigig-firmware.list assuming that on
>>> next build these files wont appear but still the files are there in
>>> /lib/firmware directory.
>>> By removing these files I can further reduce filesystem by 4 MB.
>>>
>>>
>>> On Wed, Mar 7, 2018 at 5:07 PM, Ronaldo Afonso
>>> <ronaldo at ronaldoafonso.com.br> wrote:
>>> >   Hi Arjav,
>>> >
>>> >   Which kind of firmware are you using? An OpenWrt prebuilt (from
>>> > https://downloads.openwrt.org/releases/) or a firmware build by
>>> yourself?
>>> >
>>> >   Well, in or case, I suggest you build your firmware ... using "make
>>> > menuconfig" is the first thing to try for removing unnecessary
>>> binaries.
>>> >
>>> >
>>> >
>>> > 2018-03-07 8:02 GMT-03:00 Arjav Parikh <parikharjav24 at gmail.com>:
>>> >>
>>> >> Hi,
>>> >>
>>> >> I want to reduce the root file system size for my project. Till now
>>> >> after removing the unnecessary kernel modules, libraries and using
>>> >> strip binary the file system size has been reduced to 8.3 MB. Bu there
>>> >> are still some files which are not required and I am unaware of how to
>>> >> prvent these files from being included in my file system using
>>> >> openwrt.
>>> >>
>>> >> For Ex: there are multiple binaries in /lib/firmware which are not
>>> >> required. This folder itself contains size of 4.4 MB, apart from these
>>> >> there are many libraries in /lib as well as /usr/lib which are not
>>> >> required.
>>> >>
>>> >> Can anyone please guide of how to remove firmware binaries and
>>> >> libraries in openwrt.
>>> >>
>>> >> --
>>> >> Thanks & Regards,
>>> >> Arjav Parikh
>>> >> _______________________________________________
>>> >> openwrt-devel mailing list
>>> >> openwrt-devel at lists.openwrt.org
>>> >> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > Ronaldo Afonso
>>> > 11 9 5252 0484
>>> > www.ronaldoafonso.com.br
>>>
>>>
>>>
>>> --
>>> Thanks & Regards,
>>> Arjav Parikh
>>>
>>
>>
>>
>> --
>> Ronaldo Afonso
>> 11 9 5252 0484
>> www.ronaldoafonso.com.br
>>
>


-- 
Ronaldo Afonso
11 9 5252 0484
www.ronaldoafonso.com.br
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20180307/77fa4778/attachment.htm>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list