(OLD) (ARCHIVED) Puppy Linux Discussion Forum Forum Index (OLD) (ARCHIVED) Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info

This forum can also be accessed as http://oldforum.puppylinux.com
It is now read-only and serves only as archives.

Please register over the NEW forum
https://forum.puppylinux.com
and continue your work there. Thank you.

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups    
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 04 Dec 2020, 01:15
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
ToolBox-1.0 - Multi-Call Binary Maker
Moderators: Flash, Ian, JohnMurga
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
Page 1 of 1 [2 Posts]  
Author Message
SFR


Joined: 26 Oct 2011
Posts: 1802

PostPosted: Wed 18 Dec 2019, 15:53    Post subject:  ToolBox-1.0 - Multi-Call Binary Maker  

Some time ago I was investigating the possibility of creating a BusyBox-like multi-call binary, but, as opposed to BusyBox and alike, creating it from already compiled binaries.
I didn't find anything like that on the internet, but eventually came across the memfd_create system call, which creates an anonymous file in RAM than can be executed just like any file on a disk.
There is one downside, though - this syscall was added in kernel 3.17 and it's both build-time (kernel headers) and run-time requirement.

This tool can be used to create e.g. all-in-one, portable collection of favourite binaries (preferably statically linked and UPXed), but also scripts and other resources, like docs, images, etc.

Quick start:

0. Download the attached tarball and extract it
1. Make sure you have devx.sfs loaded
2. Put all binaries, scripts and other stuff in applets directory
3. Run ./toolbox.sh

(More info and a few examples of cross-compiling can be found in README file.)

This will create a multi-call binary named, by default, toolbox:
Code:
# ./toolbox
Usage:
./toolbox <applet> [arguments]          execute an applet
./toolbox -l|--list                                    list available applets
./toolbox -d|--dump <applet>              dump an applet to stdout
./toolbox -v|--version                            show version info
./toolbox -h|--help                                this very help
#

As you can see, you can run a specific applet by using its name as the first argument.
Just like with BusyBox, you can also create symlinks pointing to that binary:
Code:
./toolbox -l | tr '\n' '\0' | xargs -0 -n1 ln -s toolbox

This, obviously, will be working only with binaries and scripts, not with non-executable assets.

There's also an option dump an applet to stdout, which may be desired in case of text files and maybe scripts, but for binary files stdout should be redirected to a file:
Code:
./toolbox -d some_app > some_app

Btw, symlinks are embeddable as well (given that their targets are also found in applets dir), so you can embed e.g. busybox or dropbearmulti with all the relevant symlinks included.

Have fun &
Greetings!
toolbox-1.0.tar.gz
Description  MD5: f31ce0b0c96def6f6bbd1dfb6e2dba8e toolbox-1.0.tar.gz
gz

 Download 
Filename  toolbox-1.0.tar.gz 
Filesize  5.19 KB 
Downloaded  205 Time(s) 

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
sc0ttman


Joined: 16 Sep 2009
Posts: 2806
Location: UK

PostPosted: Wed 18 Dec 2019, 17:38    Post subject:  

Ooooh... this looks great..

I'd love to combine a few tools, to create a simpler, single binary file "webpack" alternative, that takes nice CLI options, instead of a config file...

Ideally something that can do these things:

- JSON file parser
- CSV parser
- read .hbs file, use mustache or handelbars templating system to output HTML

...ideally it would also contain rollup.js (for transpiling JS), and a sass transpiler... if that's possible...

This might be the place to start!

_________________
Pkg, mdsh, Woofy, Akita, VLC-GTK, Search
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [2 Posts]  
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 1.6589s ][ Queries: 13 (1.4221s) ][ GZIP on ]