Page 3 of 20

Posted: Sat 02 Nov 2013, 16:42
by Iguleder
Nope.

However, I was able to build it for x86_64 when I remove the last 3 cases. I get a black screen when I run it, though.

Posted: Sat 02 Nov 2013, 19:43
by technosaurus
wtf, now I need to see it, can you point me to a copy of the source you are using?

Posted: Sun 03 Nov 2013, 03:39
by Iguleder
goingnuts put them in this thread.

Posted: Sun 03 Nov 2013, 07:42
by goingnuts
The tiny Xvesa is patched to give black screen.

I have XFree86-4.8.0 building Xvesa, Xfbdev and XFree86 with uclibc. I have attached the background patch and my build script. Some external functions are missing but you will get the picture.
The Xvesa/Xfbdev is 930K static linked - the XFree86 is 8.8Mb.
20131104: Removed files as not relevant

Posted: Sun 03 Nov 2013, 07:45
by nooby
http://www.murga-linux.com/puppy/viewto ... 532#730532
Goingnuts writes
Posted: Mon Oct 14, 2013 Post subject:
Link to present tiny-Xserver-0.03 source

https://www.dropbox.com/s/ndamatph1sci8 ... .03.tar.gz

I trust somebody correct me if I got the link wrong :)

Posted: Sun 03 Nov 2013, 08:39
by Iguleder
Yes, but it crashes with a segfault, so the screen freezes.

Posted: Sun 03 Nov 2013, 09:11
by goingnuts
Have you tried using a tiny Xfbdev/Xvesa already build? Could indicate if its a problem with your build or your environment.

Posted: Sun 03 Nov 2013, 12:08
by Iguleder
No can do - I want a native 64 bit server built by me. Other builds are 32 bit.

Posted: Sun 03 Nov 2013, 17:57
by technosaurus
on x86 the code expands to:
gcc -I../include -E fbblt.c >fbblt.E

Code: Select all

typedef CARD32 FbBits;  //this is platform dependent
...
      case (sizeof (FbBits) - 3) | (1 << (5 - 3)):... break;
      case (sizeof (FbBits) - 3) | (2 << (5 - 3)):... break;
      case (sizeof (FbBits) - 2) | (1 << (5 - 3)):... break;
      case sizeof (FbBits) - 3: ... (no break, falls through)
      case sizeof (FbBits) - 2: ... break;
      case sizeof (FbBits) - 1: ... break;
holy crap, what a mess of unwieldy macros

Posted: Thu 07 Nov 2013, 19:29
by Iguleder
I think int32_t and sizeof(int32_t) is the way to go. This code assumes integer types are not padded, which is totally wrong with today's compilers.

I'll try this and report. 8)

EDIT: seems to build just fine. It's still compiling (I'm using an old Atom netbook, since my shiny new laptop HDD burst in flames), so it's going to take a while before I can try this out :)

EDIT 2: I get a black screen when I run it. Keyboard and mouse don't work and I have to CTRL + ALT + DEL.

Posted: Fri 08 Nov 2013, 03:02
by technosaurus
does Ctl+Alt+BkSpc work so you can check logs? ... or maybe
X... &
XPID=$!
sleep 10
kill $XPID
... read logs on console or in /var

Posted: Fri 08 Nov 2013, 08:30
by Iguleder
Hehe, of course I tried this trick.

No logs and the screen remains black after the server death, so I have no choice but to reboot.

EDIT: it runs! I get a black screen with a X pointer - I can move it and stop the server as usual. However, nothing runs against this server, even JWM - the screen remains black.

Posted: Fri 08 Nov 2013, 13:40
by technosaurus
aha, check to make sure all your /etc and /var directories are available ... IIRC, I had the same issue on microsaurus until creating the right .X11-something directory (where it places sockets to communicate with clients)

Posted: Fri 08 Nov 2013, 14:58
by Iguleder

Code: Select all

strings Xfbdev | grep ^/


Nothing interesting here.

EDIT: interesting. It connects to the socket (/tmp/.X11-unix/whatever), the server sends something, then the client sends something. Afterwards, the client enters an infinite select().

EDIT 2: here's what I get (in standard output) when I run LXTask:
The program 'lxtask' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadValue (integer parameter out of range for operation)'.
(Details: serial 43 error_code 2 request_code 2 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
Also, it seems the same JWM runs fine against Debian's normal X server, so the problem must be in tinyxserver.

Posted: Fri 08 Nov 2013, 20:13
by Iguleder
If anyone wants to help with the debugging efforts, here's a brief compilation tutorial - use it under Debian Wheezy x86_64.

First, obtain the build environment -

Code: Select all

git clone https://github.com/iguleder/lazyux.git
Under config, change SYSROOT to something sane (i.e /opt/lazyux).

Then, start building the whole thing -

Code: Select all

cd lazyux
for i in linux_headers musl zlib tinyxlib tinyxserver; do sh build.sh $i; done
The result is $SYSROOT/bin/Xfbdev, a statically-linked X server (940 KB here). It should work just fine (/opt/lazyux/bin/Xfbdev :1) - you'll see a black screen with a big X pointer. However, as I said - applications fail - they connect to the X server, but all requests seem to fail hard.

(No warranty, use at your own risk)

Posted: Fri 08 Nov 2013, 22:33
by 01micko

Code: Select all

bash-4.2$ stat -c %s ../sysroot/bin/Xfbdev
952624
Now I'm out of my league !!!

Built fine on Slackware64-14.1

Don't waste too much time but how can I use it? Guess I need to build your distro?

Posted: Fri 08 Nov 2013, 22:36
by Iguleder
It's not a distro (yet) - it's just an extracted initramfs at the moment. You can build the kernel package ("linux"), pack $SYSROOT in an initramfs (manually) and boot this thing :)

EDIT: you'll also need to build lazy-utils (the package name is "lazy_utils") and loksh. By the way - I've successfully built Slacko and Precise images with these tools instead of the BusyBox init, udev, syslogd etc' - boots much faster and consumes less RAM.

Posted: Fri 08 Nov 2013, 22:40
by 01micko
Iguleder wrote:It's not a distro (yet) - it's just an extracted initramfs at the moment. You can build the kernel package ("linux"), pack $SYSROOT in an initramfs (manually) and boot this thing :)

EDIT: you'll also need to build lazy-utils (the package name is "lazy_utils") and loksh.
ok... I'll try it on a stick, got it, your udev, busybox and sh replacements.

Posted: Fri 08 Nov 2013, 22:46
by Iguleder
I just PMed a Tiny Core developer, seeking debugging help.

My enemy's (X.Org's bloat) enemy is my friend :lol:

Posted: Fri 08 Nov 2013, 23:17
by technosaurus
BTW, I have a tiny standalone blkid replacement if you want to include it.
I spit out a function that will write the fsinfo to a struct for use in mount() (for the fstype parameter and possibly to mount by UUID or label) but I decided to use UUIDs in byte order and all CAPS with no '-' separators because it complicated the code unnecessarily (unlike std blkid which prints some little endian, some big and some in upper case and others in lower)

Here is its current state:

Code: Select all

#include <linux/types.h>
struct fsinfo{ char *type; char *lbl; __u8 *uuid; __u8 ulen; __u8 llen; };
#define SB struct __attribute__((packed))

extern void getfs(int fd, struct fsinfo *ret){
  union __attribute__((packed)){
    __u8 buf[4096];
    /* +0-4096 */
    SB{char d0[3072];__u16 mgc;}ad;
    SB{__u32 mgc;}b;
    SB{__u32 mgc;char d0[44];char lbl[16];}cram;
    SB{char d0[1080];__u16 mgc;char d1[34];char d2:2;__u8 is3:1;char d3:5;char d4[3];char d5:6;__u8 is4:1; char d6:1;char d7[7];__u8 uuid[16];char lbl[16];}ext;
    SB{char d0[1024];__u32 mgc;char d1[82];char lbl[16];char d2[6];__u8 uuid[16];}f2;
    SB{char d0[67];__u8 uuid[4];char lbl[11];__u32 mgc;}fat32;
    SB{char d0[39];__u8 uuid[4];char lbl[11];__u32 mgc;}fat16;
    SB{char d0[1030];__u16 mgc;char d1[6];__u16 mgc3;}minix;
    SB{char d0[1030];__u16 mgc;char d1[44];__u8 uuid[16];char lbl[80];}nil;
    SB{char d0[3];__u32 mgc;char d1[65];__u8 uuid[8];}nt; /* NTFS label is on a different block AND in utf16 => omitting */
    SB{char d0[8];__u16 mgc;}oc;
    SB{__u32 mgc;}rom;
    SB{__u32 mgc;}squash;
    SB{__u32 mgc;char d0[28];__u8 uuid[16];char d1[60];char lbl[12];}x;
    SB{char d0[572];__u32 mgc;}xia;
    /* +8192-12288 */
    SB{char d0[676];char lbl[32];__u8 uuid[8];char d1[656];__u32 mgc;}u;
    /* +32768-36864 */
    SB{__u32 mgc;char d1[132];char lbl[16];__u8 uuid[16];}j;
    /* +65536-69632 */
    SB{char d0[64];__u64 mgc;char d1[195];__u8 uuid[16];char lbl[255];}btr;
    SB{char d0[52];__u32 mgc;char d1[28];__u8 uuid[16];char lbl[16];}reiser;
  }u;
  char i=0;
  do {
    if (read(fd, &u.buf, sizeof(u.buf)) < 1) return; /* can't use mmap on pipes */
    switch(i){
	case 0: /* 0-4096 bytes */
      if (u.fat32.mgc==0x33544146) {*ret=(struct fsinfo){"vfat",u.fat32.lbl,u.fat32.uuid,sizeof(u.fat32.uuid),sizeof(u.fat32.lbl)};return;}
      if (u.fat16.mgc==0x31544146) {*ret=(struct fsinfo){"vfat",u.fat16.lbl,u.fat16.uuid,sizeof(u.fat16.uuid),sizeof(u.fat16.lbl)};return;}
      if (u.nt.mgc==0x5346544e) {*ret=(struct fsinfo){"ntfs","",u.nt.uuid,sizeof(u.nt.uuid),0};return;}
      if (u.ext.mgc==0xEF53) {*ret=(struct fsinfo)
        {(u.ext.is3)?(u.ext.is4)?"ext4":"ext3":"ext2",u.ext.lbl,u.ext.uuid,sizeof(u.ext.uuid),sizeof(u.ext.lbl)};return;}
  	  if (u.squash.mgc==0x73717368) {*ret=(struct fsinfo){"squashfs","",NULL,0,0};return;}
	  if (u.ad.mgc==0xadf5) {*ret=(struct fsinfo){"adfs","",NULL,0,0};return;}
	  if (u.b.mgc==0x1badface) {*ret=(struct fsinfo){"bfs","",NULL,0,0};return;}
   	  if (u.cram.mgc==0x28cd3d45) {*ret=(struct fsinfo){"cramfs",u.cram.lbl,NULL,0,sizeof(u.cram.lbl)};return;}
      if (u.nil.mgc==0x3434) {*ret=(struct fsinfo){"nilfs",u.nil.lbl,u.nil.uuid,sizeof(u.nil.uuid),sizeof(u.nil.lbl)};return;}
      //OracleCF
  	  if (u.rom.mgc==0x2d6d6f72) {*ret=(struct fsinfo){"romfs","",NULL,0,0};return;}
      if (u.f2.mgc==0xF2F52010) {*ret=(struct fsinfo){"f2fs",u.f2.lbl,u.f2.uuid,sizeof(u.f2.uuid),sizeof(u.f2.lbl)};return;}
      if (u.minix.mgc3==0x4d5a || u.minix.mgc==0x137F || u.minix.mgc==0x138F || u.minix.mgc==0x2468 || u.minix.mgc==0x2478)
        {*ret=(struct fsinfo){"minix","",NULL,0,0};return;}
      if (u.x.mgc==0x42534658) {*ret=(struct fsinfo){"xfs",u.x.lbl,u.x.uuid,sizeof(u.x.uuid),sizeof(u.x.lbl)};return;}
      if (u.xia.mgc==0x012fd16d) {*ret=(struct fsinfo){"xiafs","",NULL,0,0};return;}
      break;
    /* 4096-8192 */
    case 2: /* 8192-12288 */
      if (u.u.mgc==0x54190100 || u.u.mgc==0x00011954) {*ret=(struct fsinfo){"ufs",u.u.lbl,u.u.uuid,sizeof(u.u.uuid),sizeof(u.u.lbl)};return;}
      goto REISER;
	/* 12288-16384 */ /* 16384-20480 */ /* 20480-24576 */ /* 24576-28672 */ /* 28672-32768 */
	case 8 :/* 32768-36864 */
      if (u.j.mgc==0x3153464a) {*ret=(struct fsinfo){"jfs",u.j.lbl,u.j.uuid,sizeof(u.j.uuid),sizeof(u.j.lbl)};return;}
      break;
    case 16: /* 65536-69632 */
      if (u.btr.mgc==0x4D5F53665248425FULL) {*ret=(struct fsinfo){"btrfs",u.btr.lbl,u.btr.uuid,sizeof(u.btr.uuid),sizeof(u.btr.lbl)};return;}
REISER:
      if (u.reiser.mgc==0x73496552) {*ret=(struct fsinfo){"reiserfs",u.reiser.lbl,u.reiser.uuid,sizeof(u.reiser.uuid),sizeof(u.reiser.lbl)};return;}
      break;
    }
  }while(i++<16);

}
and blkid

Code: Select all

#include <linux/types.h>
struct fsinfo{ char *type; char *lbl; __u8 *uuid; __u8 ulen; __u8 llen; };
extern void getfs(int fd, struct fsinfo *ret);

int main(int argc, char **argv){
	unsigned int i,fd;
	if (argc==1){
		return 1;	/* TODO if no args use /proc/partitions & handle stdin */
	}
	for(i=1;i<argc;++i){
		if(fork()==0){
			fd = open(argv[i], 04000);
			if (fd<2) return 2;
			struct fsinfo fs={0};
			getfs(fd,&fs);
			close(fd);
			if (fs.type) {
				printf("%s:",argv[i]);
				if (fs.llen && fs.lbl[0] && fs.lbl[0]!=' ' )
					printf(" LABEL=\"%s\"",fs.lbl);
				if (fs.ulen){
					printf(" UUID=\""); /* non-"standard" format*/
					while(fs.ulen)printf("%02X",fs.uuid[--fs.ulen]);
					printf("\"");
				}
				printf(" TYPE=\"%s\"\n",fs.type);
				return 0;
			}else return 3;
		}
	}
	while(i--)wait();
	return 0;
}