<mkl_> hi...does any one know that is there any implementation trying to make writing file to samba completely in kernel?like reading files from samba, with sendfile and mmap.....My cpu and memory copy is so slow that became the bottleneck, and I would like the writing to samba not going to user space if possible....

<Berge> mkl_: No, there is no Samba implementation in kernel space.mkl_: If context switching is a major concern on your platform, I'm not quite sure if you want to run Samba on it.

<mkl_> is there any substitution? I would need samba to share files....but writing to samba is to slow...

<Berge> If your Samba installation performs poorly, there might be other causes than context switching.CIFS is not a very efficient protocol, especially not with Windows clients.(In my experience, at least.)

2008年8月14日 星期四

No!!! There is no way (AFAIK) to extract vmlinux from vmlinuz/bzImage/zImage/bootpImage!!!

vmlinux is an elf file of whole uncompressed kernel. We first stripped the elf header to produce the Image, a binary file, then compress it, add some decompress code to produce zImage (refer to Linux Image Generation). So we can only extract Image from vmlinuz/bzImage/zImage/bootpImage, but there is no way to obtain the original elf header, which is vmlinux.

I tried to use objcopy to add the elf header, but the result can't be used by oprofile.

I think this should also work for zImage/bootpImage, but I haven't tested yet.

No specific tool exists to unpack the bzImage file, but there exists a script named extract-ikconfig, which decompresses the image and extracts build configuration directives from the image. One may modify it to get the decompressed image directly. Some distributions (e.g. Red Hat and clones) may come with a kernel-debuginfo RPM that contains the vmlinux file for the matching kernel RPM, it typically gets installed under /usr/lib/debug/lib/modules/`uname -r`/vmlinux

Commnet the clean_up to prevent the temp file been removed. The echo added is for debug and information.extract-ikconfig

result of modified extract-ikconfig and objcopyroot@debian:/boot# file Image-2.6.18.elfImage-2.6.18.elf: ELF 32-bit LSB relocatable, no machine, version 1 (SYSV), not strippedroot@debian:/boot# readelf -h vmlinuz-2.6.18readelf: Error: Unable to read in 0xff bytes of section headersreadelf: Error: Not an ELF file - it has the wrong magic bytes at the start

A kernel is a program that constitutes the central core of a computer operating system. It is the first thing that is loaded into memory (which physically consists of RAM chips) when a computer is booted up (i.e., started), and it remains in memory for the entire time that the computer is in operation. An executable, also called an executable file, is a file that can be run as a program.

vmlinuz is a compressed Linux kernel, and it is bootable. Bootable means that it is capable of loading the operating system into memory so that the computer becomes usable and application programs can be run.

vmlinuz should not be confused with vmlinux, which is the kernel in a non-compressed and non-bootable form. vmlinux is generally just an intermediate step to producing vmlinuz.

vmlinuz is located in the /boot directory, which is the directory that contains the files needed to begin booting the system. The file named vmlinuz might be the actual kernel executable itself, or it could be a link to the kernel executable, which might bear a name such as /boot/vmlinuz-2.4.18-19.8.0 (i.e., the name of the specific version of the kernel). This can be easily determined by using the ls command (whose purpose is to list the contents of a specified directory) with its -l option (which tells ls to provide detailed information about each object in the specified directory) as follows:

ls -l /boot

If vmlinuz is an ordinary file (including an executable), the information about it in the first column will begin with a hyphen. If it is a link, it will begin with the letter l.

The Linux kernel is compiled by issuing the following command:

make bzImage

This results in the creation of a file named bzImage in a directory such as /usr/src/linux/arch/i386/linux/boot/.

Compilation is the conversion the kernel's source code (i.e., the original form in which the kernel is written by a human) into object code (which is understandable directly by a computer's processor). It is performed by a specialized program called a compiler, usually one in the GCC (GNU Compiler Collection).

bzImage is then copied using the cp (i.e., copy) command to the /boot directory and simultaneously renamed vmlinuz with a command such as

cp /usr/src/linux/arch/i386/linux/boot/bzImage /boot/vmlinuz

vmlinuz is not merely a compressed image. It also has gzip decompressor code built into it. gzip is one of the most popular compression utilities on Unix-like operating systems.

A compiled kernel named zImage file is created on some older systems and is retained on newer ones for backward compatibility. Both zImage and bzImage are compressed with gzip. The difference is that zImage decompresses into low memory (i.e., the first 640kB), and bzImage decompresses into high memory (more than 1MB). There is a common misconception that bzImage is compressed with the bzip2 utility; actually, the b just stands for big.

The name vmlinuz is largely an accident of history. The kernel binary on the original UNIX as developed at Bell Labs was called unix. When a new kernel containing support for virtual memory was subsequently written at the University of California at Berkeley (UCB), the kernel binary was renamed vmunix.

Virtual memory is the use of space on a hard disk drive (HDD) to simulate additional RAM (random access memory) capacity. It was supported by the Linux kernel almost from Linux's inception, in contrast to some other popular operating systems in use at the time, such as MS-DOS.

Thus, it was a natural progression for the Linux kernel to be called vmlinux. And because the Linux kernel executable was made into a compressed file and compressed files typically have a z or gz extension on Unix-like systems, the name of the compressed kernel executable became vmlinuz.

The bzImage (big zImage) format was developed to overcome this limitation by cleverly splitting the kernel over discontiguous memory regions.

(.........................)

No specific tool exists to unpack the bzImage file, but there exists a script named extract-ikconfig, which decompresses the image and extracts build configuration directives from the image. One may modify it to get the decompressed image directly. Some distributions (e.g. Red Hat and clones) may come with a kernel-debuginfo RPM that contains the vmlinux file for the matching kernel RPM, it typically gets installed under /usr/lib/debug/lib/modules/`uname -r`/vmlinux

There is no bzImage on some architecture (like arm).linux-2.6.16/arch/arm/Makefile

Doesn't work even up to 2.6.27-rc5.http://bbs.chinaunix.net/viewthread.php?tid=1079572要到2.6.25以後?Samba 3.2.2 has support for splice for receive file, but it doesn't work yet.

samba-3.2.2/source/lib/recvfile.c

#if defined(HAVE_LINUX_SPLICE)

/** Try and use the Linux system call to do this.* Remember we only return -1 if the socket read* failed. Else we return the number of bytes* actually written. We always read count bytes* from the network in the case of return != -1.*/

This option changes the behavior of smbd(8) when processing SMBwriteX calls. Any incoming SMBwriteX call on a non-signed SMB/CIFS connection greater than this value will not be processed in the normal way but will be passed to any underlying kernel recvfile or splice system call (if there is no such call Samba will emulate in user space). This allows zero-copy writes directly from network socket buffers into the filesystem buffer cache, if available. It may improve performance but user testing is recommended. If set to zero Samba processes SMBwriteX calls in the normal way. To enable POSIX large write support (SMB/CIFS writes up to 16Mb) this option must be nonzero. The maximum value is 128k. Values greater than 128k will be silently set to 128k.

Note this option will have NO EFFECT if set on a SMB signed connection.

The default is zero, which diables this option.

Default: min receivefile size = 0

Linux has splice support since 2.6.17http://lists.samba.org/archive/samba/2006-December/127887.htmlhttp://kerneltrap.org/node/6505.http://lwn.net/Articles/181170/

linux-2.6.16/net/socket.c

/** Socket files have a set of 'special' operations as well as the generic file ones. These don't appear* in the operation structures but are done directly via the socketcall() multiplexor.*/

1. smbd calling sys_read socket to get received data__arch_copy_to_usercopy_to_usermemcpy_toiovecskb_copy_datagram_iovectcp_rcv_establishedtcp_v4_do_rcvrelease_socktcp_recvmsgsock_common_recvmsgsock_aio_readdo_sync_readvfs_readsys_readret_fast_syscall

A: I don't actually know, but I hope we can get them before end of August.

Q: What about Invoice(發票)?

A: There won't be a invoice for everyone, but one only. I would copy the invoice for each one of you. But if you do need a separate invoice for your order, tell me first, and openmoko could handle that.

2008年8月6日 星期三

Qtopia Core is a C++ framework for GUI and application development for embedded devices. It runs on a variety of processors, usually with Embedded Linux. Qtopia Core provides the standard Qt API for embedded devices with a lightweight window system.

The ferrite is increasing the common mode inductance of the cable because the ferrite has a better magnetic permeability than air. Taping the ferrite to the cable is a bit like a half turn on a ferrite rod. It will still affect the inductance, but not as much as if it went through a ferrite ring.

make qemu - build qemu-neo1973, download the latest official OpenMoko images, flash the images into the virtual NAND flash, create an empty virtual SD card, and run the emulator (you still need to install the makefile as mentioned above, however).

make run-qemu - restarts qemu with the currently flashed OpenMoko images and current virtual SD card.

make run-qemu-snapshot - does the same but starts qemu with -snapshot which causes QEMU to write all changes to temporary files instead of flash and disk image files.This is beneficial in that the virtual Neo1973 is not changed. Also all changes that make run-qemu-snapshot creates occur in parallel. This allows you to run multiple instances without creating incoherent flash and SD card state. You can, however, force the write back by pressing C-a s in the QEMU window. This may be useful to update the flash and disk images in the last qemu instance that is running to preserve the changes.

make download-images - to download the latest official images

make flash-qemu-official - to flash those images

make flash-qemu-local - to flash your latest locally built images, which can then be followed by

make qemu-copy-package-foo - copies foo.ipk to the virtual SD card, which allows you to use ipkg install /media/mmcblk0/file inside the running OpenMoko to install the package.