Developing FirstRUN for Puppy CD's initial boot

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#61 Post by technosaurus »

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 [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

#62 Post by s243a »

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: Select all

#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: Select all

#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: Select all

	//wait_for_device_probe();
http://murga-linux.com/puppy/viewtopic. ... 031#990031


That would fit on a floppy disk from 1987!

Have you considered adding this project to a github repo?

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#63 Post by technosaurus »

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 [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

Post Reply