Thursday, June 11, 2009

Libusb-1.0 in head

Hi everybody,

thompsa@ has imported my work on libusb-1.0 emulation into head. Feel free to test and report me any bugs :)

FYI isochronous and interrupt transfers are not supported for the moment (in reality not yet tested).

If you want some code example of libusb-1.0 you can have a look at the testing programs that I used to validate this library here.

I will try to send a mail to freebsd-ports@ to update the package which used libusb-1.0.

Feel free to mail me or freebsd-usb@ if you have any question on libusb-1.0 emulation.

Cheers,

Saturday, May 23, 2009

coding begins

Hi,

The summer of code begins today.

I've already received goods from Google. The first one is an account on acm :) The second one is in Memphis for the moment and it is my prepaid card with 500$ with google stickers :)

Concerning the code for freebsd, I've already started to work on libusb-1.0 and I have nearly implemented it due to the graceful help of Hans Petter Selasky \o/.

If someone would test or have a look at the libusb-1.0 emulation into FreeBSD just go there. It is all the files prefixed by libusb10. I will try to finish the libusb-1.0 support soon to go into the kernel :)

Cheers,

Wednesday, April 22, 2009

FreeBSD Google Summer of Code


Hi,

Just a little post to tell you that I will participate in the fifth google Summer of Code for the FreeBSD project. My work will focus on USB.

If you want some news on my subject you can find them on the FreeBSD wiki :

This project will probably freeze the current PMBSD development and all my other little projects during the summer time.

I will try to put news of the google Summer of Code on this blog when I have the time during the Summer.

Cheers,

Monday, April 6, 2009

FreeBSD current Xorg and hp2133


Hi,

I've had some difficulties with xorg installation on the hp2133. This installation is not trivial so if you don't manage to do it, you can follow this howto :)

You need to have an updated ports source tree. If you don't have any /usr/ports directory you need to do that :


cd /usr/


cvs -danoncvs@anoncvs.fr.freebsd.org:/home/ncvs checkout -P ports.


you already have an /usr/ports dir you only need to update :

cd /usr/ports cvs update -Pd

Now let's compile Xorg :

cd /usr/ports/x11/xorg
make && make install.

You can have some problem to compile it with randr, to fix it you can do this:

cd /usr/ports/x11/randrproto/ make && make deinstall && make install
cd /usr/ports/x11/libXrandr/
make && make deinstall && make install
cd /usr/ports/x11/xrandr/
make && make deinstall && make install
cd /usr/ports/x11/xorg/
make && make install

Now you have xorg installed, but if you try to launch it with a startx your laptop hangs. You need to update the openchrome driver from the openchrome directory:

cd ~/
make code
cd code
svn co http://svn.openchrome.org/svn/trunk/
cd trunk/
./autogen.sh --prefix=/usr/X11R6
make && make install

Now you have a working X but the mouse and the keyboard don't respond... You need to enable in your rc.conf the dbus and hal:

echo hald_enable=YES >> /etc/rc.conf
echo dbus_enable=YES >> /etc/rc.conf

Now averything works fine.

HTH,

Install FreeBSD current on hp2133

Hi,

Last week, I tried to install FreeBSD current on my hp2133. I had some problems to install it so here is how I did it.

First this laptop has no cdrom, so I installed FreeBSD on it with an usbkey. You need to take another laptop with a FreeBSD and checkout the sources :

cd /usr


cvs -danoncvs@anoncvs.fr.freebsd.org:/home/ncvs checkout -P src


After that you have to build the system for the usb key:

make buildworld
make buildkernel KERNCONF="GENERIC"

When the userland and the kernel are compiled you need to prepare the usb disk :

fsdisk -I /dev/da0
fdisk -B /dev/da0
bsdlabel -w /dev/da0s1a auto
bsdlabel -B /dev/da0s1a
newfs /dev/da0s1a
mount /dev/da0s1a /mnt

Now the disk is mounted & you need to install the binaries on it:

make installworld DESTDIR=/mnt
make installkernel DESTDIR=/mnt KERNCONF="GENERIC"
make distrib-dirs DESTDIR=/mnt
make distribution DESTDIR=/mnt
echo /dev/da0s1a / ufs rw 1 1 > /mnt/etc/fstab
echo hostname="myname" > /mnt/rc.conf
cp -fr /usr/src /mnt/usr/.

Now you can boot with the usb key on the hp2133. Warning: during the bootloader you must boot in failsafe mode, because there are an apic problem on current with the laptop...

When you have booted you can log with the root account without password. Now you need to recompile the userland and the kernel but instead installing it on da you can do it on ad (your disk drive) :

make buildworld

make buildkernel KERNCONF="GENERIC"
fsdisk -I /dev/ad0
fdisk -B /dev/ad0
bsdlabel -w /dev/ad0s1a auto
bsdlabel -B /dev/ad0s1a
newfs /dev/ad0s1a
mount /dev/ad0s1a /mnt
make installworld DESTDIR=/mnt
make installkernel DESTDIR=/mnt KERNCONF="GENERIC"
make distrib-dirs DESTDIR=/mnt
make distribution DESTDIR=/mnt
cp /etc/rc.conf /etc/fstab /mnt/etc

Now you can remove your usb key and boot on your hp2133 drive :)

HTH

Tuesday, March 24, 2009

AT91SAM9261-EK on FreeBSD.

Hi everybody.

Its been a couple of days thatI am trying to port the at91sam9261 SoC on FreebSD and the AT91SAM9261 Evalution Kit.

After two or three day of debugging and developing I finished to boot the card and to have a sexy dmesg that hang on the NFS init. (that's normal because I haven't got implemented the ethernet driver card yet).

If you want some other information about the at91sam9261ek board you can find the datasheets of its SoC here, its schematics here and a picture of this board here.

You can find the dmesg here, the patch here and follow the submit on mailling list here.

If you have any question about this patch and want to mail me about it, you're welcome :)

See you in a next post :)

Sunday, February 22, 2009

PCI


Hello.

This week we are going to talk about PCI. PCI has from 0 up to 254 buses. On each bus you can have devices (maximum 32). The device can have many functions (up to 8). These functions could be useful if you are using a device which has multiple functionality. For example a Video acquisition card could have a function 0 for video acquisition and a function 1 for sound acquisition, etc etc... Some systems, like Linux have some abstraction over pci to handle big super computer configuration that has more than 256 pci. For that they use domains of buses which can have 256 buses each.

Each PCI slot has four interrupts possible (One per interrupt pin (A to D)).

PCI configuration space.

For a set of bus:device:functions you have a trame of 256 bits of data. This trame is called configuration space. the config space looks like :


Warning PCI registers are always little endian.

All the values present in this 256 bits chunk can be read or written (I think that some value are just read-only like the vendor ID or product ID).

Base address is an interesting value because it helps us to know the type of registers (IOports or memory). It helps us to know where the registers start in memory or iospace and where it ends.

For irq the line is present in the 60th bit of the chunk. This bit is set to 0 if the device doesn't support IRQ.

Friday, February 6, 2009

PMBSD


Hello,

You can find here, my newblog specialised in the project Pigeon Mouette BSD.

If you have free time and have interest in kernel or driver development contact me; pmbsd needs more hackers to be operational.

For the moment pmbsd is in version 0.1 but will have an userland for the version 0.3.

Sunday, August 24, 2008

PCC C extensions

Hi,

It's been a while that I wanted to know how PCC (Portable C Compiler) works . So I decided to use it for ksyl (my own educational kernel). I've been thinking that if pcc compiles the whole userland of OpenBSD and whole kernelland with some patches, then it must work with my own kernel :)

The first step for me is to fetch the source of pcc on my desktop and I am lucky because the source tree of my OS has it. So I just need to checkout pcc and compile it:

cvs -danoncvs.de.openbsd.org:/cvs co -P src/usr.bin/pcc
cd src/usr.bin/pcc
make depend && make && make install

Now I ve got a pcc binary and a cpp binary in /usr/local/bin/. So I need to fix the CC var in the ksyl Makefile :

CC = /usr/local/bin/pcc.

Everything seems to be ok, now I will try to compile ksyl :

ksyl@rincewind {4}> make

And then appears the first error :

include/./sys/gdt.h, line 15: syntax error
include/./sys/gdt.h, line 15: invalid function definition
include/./sys/gdt.h, line 15: syntax error
include/./sys/gdt.h, line 21: syntax error
include/./sys/gdt.h, line 21: invalid function definition
include/./sys/gdt.h, line 21: redeclaration of packed
include/./sys/gdt.h, line 21: syntax error
include/./386/idt.h, line 26: syntax error
include/./386/idt.h, line 26: invalid function definition
include/./386/idt.h, line 26: redeclaration of packed
include/./386/idt.h, line 26: syntax error
include/./386/idt.h, line 32: syntax error
include/./386/idt.h, line 32: invalid function definition
include/./386/idt.h, line 32: redeclaration of packed
include/./386/idt.h, line 32: syntax error

These errors came from the different gcc extentions needed to do packing like __attribute__((packed)). The packing of the structure included into gdt.h and idt.h allowed ksyl to work properly. Thus I googled "pcc packing" to find a solution without success to finally.... have a look in pcc sources. I found the solution in the pcc lexer. I must used a pragma :

#pagma pack(1)
struct idt
{
...
};
#pragma pack

After the patch I try to compile it :

ksyl@rincewind {4}> make
ksyl -> compilation OK

All works \o/

Tuesday, May 20, 2008

syscalls...

Hello everybody.

TUHS (The Unix heritage society) guys are very impressive.

During the last two days Warren Toomey has been talking about syscall implementation in Unix V1. There are the following 33 syscalls :



V1_RELE 0 /* release the CPU, i.e. pre-empt this process */
V1_EXIT 1 exit()
V1_FORK 2 fork()
V1_READ 3 read()
V1_WRITE 4 write()
V1_OPEN 5 open()
V1_CLOSE 6 close()
V1_WAIT 7 wait()
V1_CREAT 8 open(path, O_CREAT O_TRUNC O_WRONLY, mode);
V1_LINK 9 link()
V1_UNLINK 10 unlink()
V1_EXEC 11 exec()
V1_CHDIR 12 chdir()
V1_TIME 13 gettimeofday()
V1_MKDIR 14 mkdir()
V1_CHMOD 15 chmod()
V1_CHOWN 16 chown()
V1_BREAK 17 brk()
V1_STAT 18 stat()
V1_SEEK 19 lseek()
V1_TELL 20 lseek(fd, 0, SEEK_CUR);
V1_MOUNT 21 mount()
V1_UMOUNT 22 umount()
V1_SETUID 23 setuid()
V1_GETUID 24 getuid()
V1_STIME 25 settimeofday()
V1_QUIT 26 signal(SIGQUIT,...)
V1_INTR 27 signal(SIGINT,...)
V1_FSTAT 28 fstat()
V1_CEMT 29 signal(SIGEMT,...)
V1_SMDATE 30 utimes()
V1_STTY 31 fcntl(), tcsetattr()
V1_GTTY 32 fcntl(), tcgetattr()
V1_ILGINS 33 signal(SIGILL,...)

With it Unix v1 offers :

- a multitasking system with up to 16 processes
- multiple users- a hierachical filesystem, with empty directories used as mountpoints
- read/write file protection for user/other (no group), plus the execute and set-userid bits
- i-nodes, and filenames separated from i-nodes, allowing hard links
- device files

It's amazing that modern Unices operating systems keep being unchanged since 1971 (37 years) :)