LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-02-2007, 05:01 PM   #1
lucky_dev36
Member
 
Registered: Jan 2005
Distribution: Debian
Posts: 34

Rep: Reputation: 15
I want to make bzPrograms


I was wondering how kernel developers did it with the kernel, it would be nice to know how to do the same for large executables, and possibly shared libraries. I am working on ls (I know, kinda basic.) to make a bzProg (or bzImage'd program.) It seems as if libc needs to be extended. (I am using zlib, sice these are userspace programs.) I am thinking C, but as I get closer, it looks like it is an ASM job,

Thanks in advance, if no criticism.
 
Old 03-02-2007, 05:45 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I'm not certain what you are doing with the ls command. You might want to look at the source for bzcat. The source for "less" or a postscript viewer may also have sections of code that decompress bzip2 compressed files on the fly.
 
Old 03-02-2007, 08:40 PM   #3
lucky_dev36
Member
 
Registered: Jan 2005
Distribution: Debian
Posts: 34

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jschiwal
I'm not certain what you are doing with the ls command. You might want to look at the source for bzcat. The source for "less" or a postscript viewer may also have sections of code that decompress bzip2 compressed files on the fly.
I was thinking more like the program itself as the compressed file. Nevertheless when I written this, shortly after, I found UPX. It is ok to close this thread now.

P.S.: I said bzPrograms because the Program itself would be gzipped. It would have loaded it at 0x100000 (kinda smells like popcorn) and then load the main() in the decompressed program. However when I would make the program (objcopy with the --add-section option to infuse the gzipped program.) the pointers to the main program segfaulted. The project is off because UPX was found.

BTW: Does upx have better compression ratios?

Last edited by lucky_dev36; 03-02-2007 at 08:48 PM.
 
Old 03-03-2007, 02:13 AM   #4
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
UPX is great stuff. It's what's used to compress the images from the Mars Rovers before sending back to earth. The source is not available though. But it has a little brother called exepack which is open sources so you can study the sources.
I've been improving an old program which does some of what you want. It's called pdv and creates a self extracting/executing archive or file. You can also use wrapper scripts, even for shared libraries, which will unpack and execute programs on-the-fly.

Transparent decompression is available and used many ways under linux -look at cramfs, squashfs, mkisofs using mkzftree and cloop are just a few ways. You can even (patch)configure the kernel to use compressed RAM.
Be aware that most schemes to run compressed executables will have a larger memory overhead, at least when the program starts, so be sure to use with prudence. Also because some won't run during boot-up and compressed shared libs won't always work for all programs.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Belkin Wirless G RTL8185L make[1]: *** No rule to make target `Makefile'. Stop. SilverRock Linux - Wireless Networking 2 02-11-2007 07:25 AM
Make Trouble linking some fortran code Make file problem? any ideas? TheBrick Linux - General 0 05-17-2006 11:21 AM
I accidentally deleted make file in /usr/local/bin, now cannot use make command.... Niceman2005 Linux - Software 2 11-17-2004 07:55 PM
How to make rule for make install and make uninstall melinda_sayang Programming 1 06-14-2004 05:58 AM
make dep,make clean,make bzImage problem Babba Linux - Newbie 2 01-08-2003 03:49 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration