Re: Setting up development environment using QEMU.
On Fri, Jun 8, 2012 at 8:20 PM, Adam Lee adam8...@gmail.com wrote: On Fri, Jun 8, 2012 at 6:46 PM, Adam Lee adam8...@gmail.com wrote: On Fri, Jun 08, 2012 at 06:08:44PM +0600, Aft nix wrote: Sure about this? Check the output of `file vmlinux` You were right then. $file vmlinux $vmlinux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped What's the arch of your host system, and your toolchain? $uname -ar $Linux kernel.vbox 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22 GMT 2011 x86_64 x86_64 x86_64 GNU/Linux $gcc -v Using built-in specs. Target: x86_64-redhat-linux So, just add ARCH var when you making, like this: make ARCH=i386 menuconfig make ARCH=i386 bzImage Tested OK. Thank you for the tips. qemu is booting the kernel now. But it stops with a kernel panic. From qemu console, [2.209887] EXT3-fs (sda): mounted filesystem with writeback data mode [2.210566] VFS: Mounted root (ext3 filesystem) readonly on device 8:0. [2.211393] Freeing unused kernel memory: 456k freed [2.242325] Write protecting the kernel text: 6240k [2.242614] Write protecting the kernel read-only data: 1820k [2.248007] Kernel panic - not syncing: No init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance. [2.248492] Pid: 1, comm: swapper/0 Not tainted 3.4.0+ #3 [2.248596] Call Trace: [2.249743] [c160db4f] panic+0x81/0x17e [2.249843] [c10012d5] init_post+0x75/0xb0 [2.249942] [c183a61a] kernel_init+0x1e0/0x1ea [2.250028] [c183a3df] ? parse_early_options+0x35/0x35 [2.250237] [c183a43a] ? repair_env_string+0x5b/0x5b [2.250326] [c1616cd6] kernel_thread_helper+0x6/0xd I've started reading Documentation/init.txt, But i'm not understanding well. It seems the init binary is missing which should be on the root file system. the sell script i'm using to launch qemu is given below : #!/bin/bash # by, uberj KERNEL=/mnt/build/linux-2.6/arch/i386/boot/bzImage usage(){ echo ./startup.sh group_port hdd image echo Kernel image is $KERNEL. } if [ $# != 2 ] then usage exit fi QEMU_BIN=/usr/bin/qemu HDD=$2 SSH_PORT=$((5100+$1)) GDB_PORT=$((5200+$1)) DEV_CONSOLE=stdio VNC_PORT=$1 echo ===SSH Port=== $SSH_PORT echo ===GDB Port=== $GDB_PORT echo ===VNC Port=== $VNC_PORT $QEMU_BIN \ -cpu qemu64 \ -net nic,model=e1000 \ -net user \ -vnc :$VNC_PORT \ -gdb tcp::$GDB_PORT \ -kernel $KERNEL \ -hda $HDD \ -append root=/dev/sda console=ttyS0 \ -redir tcp:$SSH_PORT::22 \ -serial $DEV_CONSOLE \ I have made my root FS by following method : $losetup /dev/loop0 rootfs.img $mkfs -t ext3 /dev/loop0 My understanding is i have to put the init binary in my root fs. But i'm clueless about how to do that? Cheers. -- Regards, Adam Lee E-mail: adam8...@gmail.com Website: http://adam8157.info -- -aft ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Question: kdb and USB?!
Hi! I wonder what's the status of this as I found no traces of this in latest upstream kernels. I mean direct USB keyboard support. I already tried kdb over USB debug port, but that seems either not available (on the outside ports) or not stable. Is there direct USB keyboard support available? Best, JS ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Setting up development environment using QEMU.
On Sat, Jun 09, 2012 at 04:19:15PM +0600, Aft nix wrote: Thank you for the tips. qemu is booting the kernel now. But it stops with a kernel panic. From qemu console, [2.209887] EXT3-fs (sda): mounted filesystem with writeback data mode [2.210566] VFS: Mounted root (ext3 filesystem) readonly on device 8:0. [2.211393] Freeing unused kernel memory: 456k freed [2.242325] Write protecting the kernel text: 6240k [2.242614] Write protecting the kernel read-only data: 1820k [2.248007] Kernel panic - not syncing: No init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance. [2.248492] Pid: 1, comm: swapper/0 Not tainted 3.4.0+ #3 [2.248596] Call Trace: [2.249743] [c160db4f] panic+0x81/0x17e [2.249843] [c10012d5] init_post+0x75/0xb0 [2.249942] [c183a61a] kernel_init+0x1e0/0x1ea [2.250028] [c183a3df] ? parse_early_options+0x35/0x35 [2.250237] [c183a43a] ? repair_env_string+0x5b/0x5b [2.250326] [c1616cd6] kernel_thread_helper+0x6/0xd ... My understanding is i have to put the init binary in my root fs. But i'm clueless about how to do that? You need a full system, kernel is just the core. I suggest you using Debian stable images for QEMU at http://people.debian.org/~aurel32/qemu (ref: http://wiki.debian.org/QEMU) Or, use busybox to build rootfs like what I am doing: https://github.com/adam8157/kernel-studio -- Regards, Adam Lee E-mail: adam8...@gmail.com Website: http://adam8157.info ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Setting up development environment using QEMU.
On Sat, Jun 9, 2012 at 8:01 PM, Adam Lee adam8...@gmail.com wrote: On Sat, Jun 09, 2012 at 04:19:15PM +0600, Aft nix wrote: Thank you for the tips. qemu is booting the kernel now. But it stops with a kernel panic. From qemu console, [ 2.209887] EXT3-fs (sda): mounted filesystem with writeback data mode [ 2.210566] VFS: Mounted root (ext3 filesystem) readonly on device 8:0. [ 2.211393] Freeing unused kernel memory: 456k freed [ 2.242325] Write protecting the kernel text: 6240k [ 2.242614] Write protecting the kernel read-only data: 1820k [ 2.248007] Kernel panic - not syncing: No init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance. [ 2.248492] Pid: 1, comm: swapper/0 Not tainted 3.4.0+ #3 [ 2.248596] Call Trace: [ 2.249743] [c160db4f] panic+0x81/0x17e [ 2.249843] [c10012d5] init_post+0x75/0xb0 [ 2.249942] [c183a61a] kernel_init+0x1e0/0x1ea [ 2.250028] [c183a3df] ? parse_early_options+0x35/0x35 [ 2.250237] [c183a43a] ? repair_env_string+0x5b/0x5b [ 2.250326] [c1616cd6] kernel_thread_helper+0x6/0xd ... My understanding is i have to put the init binary in my root fs. But i'm clueless about how to do that? You need a full system, kernel is just the core. I suggest you using Debian stable images for QEMU at http://people.debian.org/~aurel32/qemu (ref: http://wiki.debian.org/QEMU) Or, use busybox to build rootfs like what I am doing: https://github.com/adam8157/kernel-studio Hi Adam Thanks for the reply. Googling revealed other ways of debugging. I was not aware that KGDB was merged with linux in 2.6.26. I was under the impression that Linux does not allow kernel debugger in kernel source tree. If i compile a kernel with KGDB , and if i'm not developing for other archs like ppc/arm then there is little gain in qemu's gdb stub. Instead i can fire up a full distro in Virtualbox, configure a virtual serial console and socat from the host. This link : http://www.linuxforu.com/2011/03/kgdb-with-virtualbox-debug-live-kernel/ I'm trying to follow this link instead. I'm not experienced in this field, so my reasoning might be wrong. If it is, please comment on my approach. Cheers. -- Regards, Adam Lee E-mail: adam8...@gmail.com Website: http://adam8157.info -- -aft ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
kernel_sendpage query.
Hi, I've been trying to understand kernel_sendpage but I've not been able to figure it out completely and hopefully someone else knows better so please help me out on this. I'm using kernel_sendpage for a TCP connection and it works well when there are lesser number of kernel threads trying to send data using it. Now the page I hand over to kernel_sendpage is reused again for reading data from the socket and then processing it and then again resending the processed data in the same page again. It's at maximum 2KB data and never lesser than 120 bytes. As I see it in the code, the page isn't copied in the skb frags array it's just assigned and get_page is called to increment the page reference count. (I don't free it anyway until the thread is stopped and it never is unless it gets a signal). Now I don't know wether kernel_sendpage will wait for the page to be sent or it won't. I've tried with MSG_DONTWAIT and passing 0 for flags but after every now and then the problem occurs at client which I'm describing below with the best explanation I could think of... When too many kernel threads are trying to send data using kernel_sendpage, with NO MSG_DONTWAIT flag, then also it seems that this call succeeds? However since I'm reusing the page the data can get overridden by the next sock_recvmsg and when the network stack is ready to send my page it gets garbage data at client? The same issue I observed with MSG_DONTWAIT set even in that case the client sometimes get garbage data. So my query is, To use kernel_sendpage what I need to do in order to be sure that network stack indeed has sent my page and that I can reuse it for sock_recvmsg again. Thanks a lot for reading! Regards, Pranay Kr. Srivastava pranay.shrivast...@hcl.com Software Engineer ERS,HCL Technologies A-5, Sector 24, Noida 201301, U.P. (India) ::DISCLAIMER:: The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents (with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates. Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of authorized representative of HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any email and/or attachments, please check them for viruses and other defects. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Regarding ext4 allocation and deallocation of blocks
Hi, I've been trying to understand ext4 block allocation and deallocation but I've not been able to figure it out completely and hopefully someone else knows better so please help me on this. I'm using kernel 2.6.35.6 and I have the problem as we try to modify file on ext4 file system based partition, system deallocates all previous blocks and allocate new blocks with modified data, so with this behaviour system also changes inode number of file. As I see it in the code, the ext4_free_blocks function is used to deallocate the blocks. I have read and understood this behaviour, now I want to protect some blocks from deallocation i.e. not allowing blocks say 8705 from deallocation, Is it possible? If yes what is the correct way to do so. I have written a module to find out block numbers used by the file before modification( lets take a.txt with block number as 8705), now if I modify file surely new block will be allocated(say 9705) I want to protect 8705 from deallocation, how to do it, if possible? I was trying to put code in ext4_free_block function to avoid deallocation of block 8705 but when I insert module, I am not able to reach code in ext4_free_blocks. I am observing following Behaviour, Initially file(a.txt) with block number 8705 then I inserted my module so came to know block number. Then I open file for modification so after modification new block was 9217. But I was not able to protect 8705 block, as kernel should deallocate it using ext4_free_blocks function, but this was not the case. I again open file for modification( file with 9217 block) and new block is 8708 but this time kernel used ext4_free_blocks to deallocate 9217 block. What is the reason behind this behaviour? Please help me in this issue, if anyone familiar with such behaviour. -- Regards, Akshay Nehe. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: New kernel for Chipbox
Dear Javier, Sorry for late reply, but thank you. I also searched for many things on the net, read a lot of documentation, but it seems almost impossible thing to do... (That is shame, where is the power of linux? :) Just kidding ) Is there any way to do backporting ? For example, adding CIFS or USB WIFI support to my current kernel? If so, what are the steps for it? Best Regards Sertac - Original Message - From: Javier Martinez Canillas martinez.jav...@gmail.com To: Sertac TULLUK ser...@merihvideo.com.tr Cc: Harishkumar V harishpres...@gmail.com; kernelnewbies@kernelnewbies.org Sent: Friday, June 08, 2012 3:16 PM Subject: Re: New kernel for Chipbox On Thu, Jun 7, 2012 at 1:53 PM, Sertac TULLUK ser...@merihvideo.com.tr wrote: Dear Harishkumar; I already know how to find the changes, please see my 1st e-mail below. The problem is, those changes are more than thousands of lines of code, and hundreds of files are added or modified. I wonder, how can I apply those thousands of changes to new kernel source quickly and easily? The bad news is that there isn't a quickly and easily way to do it. The kernel doesn't have an stable API (read Documentation/stable_api_nonsense.txt) and the ARM part of the kernel is one of the most fast changing lately. So probably most of the drivers and SoC enablement platform code won't work with newer kernels. So, this isn't a trivial task. Best regards, -- Javier Martínez Canillas (+34) 682 39 81 69 Barcelona, Spain ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: New kernel for Chipbox
That is better approach. u can try compat-wireless. It supports wide range of kernel version. What wifi are u using, ralink or others? Each wifi has source, u can compile against ur kernel to build module. U need to enable wireless support in ur kernel. On 10 Jun 2012 00:36, Sertac TULLUK ser...@merihvideo.com.tr wrote: Dear Javier, Sorry for late reply, but thank you. I also searched for many things on the net, read a lot of documentation, but it seems almost impossible thing to do... (That is shame, where is the power of linux? :) Just kidding ) Is there any way to do backporting ? For example, adding CIFS or USB WIFI support to my current kernel? If so, what are the steps for it? Best Regards Sertac - Original Message - From: Javier Martinez Canillas martinez.jav...@gmail.com To: Sertac TULLUK ser...@merihvideo.com.tr Cc: Harishkumar V harishpres...@gmail.com; kernelnewbies@kernelnewbies.**org kernelnewbies@kernelnewbies.org Sent: Friday, June 08, 2012 3:16 PM Subject: Re: New kernel for Chipbox On Thu, Jun 7, 2012 at 1:53 PM, Sertac TULLUK ser...@merihvideo.com.tr wrote: Dear Harishkumar; I already know how to find the changes, please see my 1st e-mail below. The problem is, those changes are more than thousands of lines of code, and hundreds of files are added or modified. I wonder, how can I apply those thousands of changes to new kernel source quickly and easily? The bad news is that there isn't a quickly and easily way to do it. The kernel doesn't have an stable API (read Documentation/stable_api_**nonsense.txt) and the ARM part of the kernel is one of the most fast changing lately. So probably most of the drivers and SoC enablement platform code won't work with newer kernels. So, this isn't a trivial task. Best regards, -- Javier Martínez Canillas (+34) 682 39 81 69 Barcelona, Spain __**_ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.**org Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.**org/mailman/listinfo/**kernelnewbieshttp://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies