Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 20 Jun 2018, 03:54
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Developing FirstRUN for Puppy CD's initial boot
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 5 of 5 [63 Posts]   Goto page: Previous 1, 2, 3, 4, 5
Author Message
technosaurus


Joined: 18 May 2008
Posts: 4819
Location: Kingwood, TX

PostPosted: Sun 01 Jan 2012, 21:40    Post subject:  

Oops, we kinda got off topic due to old title. I will start a new thread soon (after I post a tutorial on glade1, since I am bringing gtk1 back from the ashes.)
_________________
Check out my github repositories. I may eventually get around to updating my blogspot.
Back to top
View user's profile Send private message Visit poster's website 
s243a

Joined: 02 Sep 2014
Posts: 1074

PostPosted: Fri 27 Apr 2018, 23:24    Post subject:  

technosaurus wrote:
Ok here it is, Puppy in <1mb in a single bzImage

Resource usage in X with jwm running and an rxvt terminal open:
MEMUSAGEKB=5020 (with background) 2892kb without background image

Resource usage at the console:
MEMUSAGEKB=2288

I wanted to see how far I could go so I ended up disabling even proc and sys, (which breaks top and ps) so I needed a way to get memory usage. I also replaced busybox with dash and mount from embutils (sh is used by rxvt which also needs /dev/pts so needed to mount a devpts) and just for grins i wrote my own init in C . I could get the resource usage down under 2Mb if jwm were compiled with only X11 with maybe xpm support and used st instead of rxvt

here is the code I wrote for memused
Code:
#include <sys/sysinfo.h>

int main(int argc, char **argv){
   struct sysinfo info;
   sysinfo(&info);
   printf("MEMUSEDKB=%d\n",(info.totalram - info.freeram)*info.mem_unit/1024);
}


here is my init code
Code:

#include <unistd.h>
#include <sys/wait.h>
#include <stdlib.h>

//these could be functions but gcc complains less this way
#define EGGSACKWEIGHT(a) ({int s,p;if((p=fork())==0){execvp(a[0],a);}else{while(wait(&s)!= p);}})
#define SHIFTN(i,a) ({ int j=0;while(a[j] != NULL){a[j]=a[j+i];j++;}})
#define EGGSACK(a)   ({if((fork())==0) execvp(a[0],a);})
int main(int argc, char** argv) {
//export PATH="/bin" HOME="/root" TERM="xterm /bin/sh" SHELL="/bin/sh" PS1="# " USER=root LOGNAME=$USER HISTSIZE=1000 HISTFILE="$HOME/.history" INPUTRC=/etc/inputrc
//setenv("PATH","/bin",1);
putenv("PATH=/bin");
putenv("HOME=/root");
putenv("TERM=xterm");
putenv("SHELL=/bin/sh");
putenv("PS1=#");
putenv("USER=root");
putenv("LOGNAME=root");
putenv("HISTSIZE=1000");
putenv("HISTFILE=/root/.history");
putenv("INPUTRC=/etc/inputrc");

char* X[99];
//mount devpts /dev/pts -t devpts
   X[0]="mount";
   X[1]="devpts";
   X[2]="/dev/pts";
   X[3]="-t";
   X[4]="devpts";
   X[5]=NULL;
   EGGSACK(X);

//Xvesa -screen 640x480x16 -nolisten tcp -tst -I &
   X[0]="Xvesa";
   X[1]="-screen";
   X[2]="640x480x16";
   X[3]="-nolisten";
   X[4]="tcp";
   X[5]="-tst";   
   X[6]=NULL;
   EGGSACK(X);

//script? ... try getenv("XINITRC") and getenv("HOME") + /.xinitrc

putenv("SHELL=/bin/sh");
putenv("DISPLAY=:0");

X[0]="jwm";
X[1]="-display";
X[2]=":0";
X[3]=NULL;
EGGSACKWEIGHT(X);

X[0]="killall";
if (argc>1) {
   X[1]="Xvesa"; //see above... maybe change to X
}else{
   X[1]="Xorg";
}

X[2]=NULL;
EGGSACK(X);

X[0]="sh";
X[1]=NULL;
EGGSACKWEIGHT(X);
}


I also commented this line in the kernel source (init/do_mounts.c) - the wait isn't needed here
Code:
   //wait_for_device_probe();

http://murga-linux.com/puppy/viewtopic.php?p=990031#990031


That would fit on a floppy disk from 1987!

Have you considered adding this project to a github repo?
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4819
Location: Kingwood, TX

PostPosted: Sat 28 Apr 2018, 00:12    Post subject:  

s243a wrote:
That would fit on a floppy disk from 1987!

Have you considered adding this project to a github repo?
Actually the 5.25" HD floppies from 1982 would probably work.

I started doing a rewrite as PLiNG but I am busy working on other projects at the moment. Fortunately I documented things first as I thought of them so I don't just write them down in code and then forget what the code was supposed to do.

_________________
Check out my github repositories. I may eventually get around to updating my blogspot.
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 5 of 5 [63 Posts]   Goto page: Previous 1, 2, 3, 4, 5
Post new topic   Reply to topic 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: 0.0407s ][ Queries: 13 (0.0036s) ][ GZIP on ]