Taking my first steps with the Porting of Busybox

Having played around with Busybox a bit, I was ready to go in and change around some settings, break some stuff, and hopefully put it back together in a more portable and optimized package, ready for anything the near future could throw at it!

My first order of business was to search the code for
  1. Inline assembler calls that can be replaced with high level code C/C++, etc for portability and platform independence
  2. Inline assembler calls  that can be replaced with atomic constructs in C/C++, etc for portability and platform independence
  3. Malloc and free memory calls that can be replaced by RESERVE_CONFIG_BUFFER/RELEASE_CONFIG_BUFFER by auditing the system calls and using the CONFIG_BUFFER mechanism – this is an issue that is still pending so any comments / help will be appreciated.

I identified the following files (with associated code) for the first two items detailed above:

 

 root/include/libbb.h

snip1


root/shell/ash.c

snip2


root/procps/powertop.c

snip4snip5


root/e2fsprogs/blkid/probe.h

snip6 snip8 snip9

 

My plan is to use some PTHREAS library codes to replace the

#define barrier() __asm__ __volatile__(“”:::”memory”)

inline assembler with C/C++ code in the root/include/libbb.h and root/shell/ash.c files. I’m also looking at changing the code for byte swap routine in the root/e2fsprogs/blkid/probe.h file with some atomic code.

Any thoughts on the matter are welcome!

 

Leave a comment