busybox utility
Dear all, I am checking busybox utility, Is there any other package available similar to busybox which we can use in embedded system . Thanks ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: busybox utility
Le Tue, 22 Nov 2011 14:05:14 +0530, naveen yadav yad.nav...@gmail.com a écrit : I am checking busybox utility, Is there any other package available similar to busybox which we can use in embedded system . This question is not kernel-related, so it shouldn't be posted on linux-kernel@ or kernelnewbies@. As an alternative to Busybox, you might want to have a look at Embutils http://www.fefe.de/embutils/ or probably the Toolbox thing from Android. But none of them have the same amount of features that Busybox has. Thomas -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: LPC bus access howto
On Mon, Nov 21, 2011 at 05:53:30PM +0100, Guillaume Knispel wrote: On Mon, 21 Nov 2011 17:01:29 +0100 Andre Haupt an...@bitwigglers.org wrote: Hi all, We have a FPGA which will be connected to the LPC bus. This FPGA will provide some GPIO functionality, a rotary encoder, etc. Now i want to write a kernel driver to talk to this FPGA. I am unsure how to get access to the LPC bus in the first place. What kernel APIs should i use? How to get the memory mapping right, etc? The LPC is typically automatically mapped by the hardware (southbridge) for some fixed ranges, various configurable ranges and might also use PCI substractive decoding. LPC is indeed an ISA bus with the physical layer replaced by something with fewer signals, but from the point of view of the software there is almost no difference, so look for how to program ISA drivers and you will probably have your answer. So request_mem_region(), ioremap(), ioread*() and iowrite*() are my friends here right? Still unsure how to obtain the LPC base address. Is this mapped to 0xA-0xF as with ISA? cheers, Andre ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: how set_user_nice() function is called
Thanks for reply. I also asked that set_user_nice where and when is called(file and line). I think it is not called after each forking operation, isn't it? Could you give calling order between functions from do_fork() like that func1()-func2()-... Regards. On Mon, Nov 21, 2011 at 3:59 AM, Mulyadi Santosa mulyadi.sant...@gmail.comwrote: On Mon, Nov 21, 2011 at 00:31, Enes Albay - انس الباى albaye...@gmail.com wrote: Hi! anybody knows that where is set_user_nice() function called in the kernel? i couldn't find that. i just found that in forking operation do_fork()-copy_process()- dup_task_struct() called then set_user_nice() called but i couldn't find that where. Also how/where do_fork() function called in kernel i couldn't find. In x86, do_fork() is called from sys_fork()... check : http://lxr.linux.no/#linux+v3.1.1/arch/x86/kernel/process.c#L235 While sys_fork() itself, since it's a syscall handler, is called from entry.S. Please refer to: http://lxr.linux.no/#linux+v3.1.1/arch/x86/ia32/ia32entry.S#L475 -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com -- Enes Albay ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
x86 kernel build chain - how bzImage gets created
Hi All, Hopefully this will help demystify the build process Notation: primary input file (file size in bytes) | + additional input file | * command | \- output file (file size in bytes) The file sizes are arbitrary and are based on the current configuration options I have set for a small kernel. They are simply there to illustrate the relative differences in file sizes. Note that vmlinux.o is not used to generate bzImage but I've included it for completeness + arch/x86/kernel/head_32.o + arch/x86/kernel/head32.o + arch/x86/kernel/head.o + arch/x86/kernel/init_task.o + init/built-in.o + usr/built-in.o + arch/x86/built-in.o + kernel/built-in.o + mm/built-in.o + fs/built-in.o + ipc/built-in.o + security/built-in.o + crypto/built-in.o + block/built-in.o + lib/lib.a + arch/x86/lib/lib.a + lib/built-in.o + arch/x86/lib/built-in.o + drivers/built-in.o + sound/built-in.o + firmware/built-in.o + arch/x86/pci/built-in.o + net/built-in.o | * ld -m elf_i386 -r -o vmlinux.o | \-vmlinux.o (2,889,050) + arch/x86/kernel/head_32.o + arch/x86/kernel/head32.o + arch/x86/kernel/head.o + arch/x86/kernel/init_task.o + init/built-in.o + usr/built-in.o + arch/x86/built-in.o + kernel/built-in.o + mm/built-in.o + fs/built-in.o + ipc/built-in.o + security/built-in.o + crypto/built-in.o + block/built-in.o + lib/lib.a + arch/x86/lib/lib.a + lib/built-in.o + arch/x86/lib/built-in.o + drivers/built-in.o + sound/built-in.o + firmware/built-in.o + arch/x86/pci/built-in.o + net/built-in.o + .tmp_kallsyms2.o | * ld -m elf_i386 --build-id -T arch/x86/kernel/vmlinux.lds | \-vmlinux (2,629,659) | * objcopy -R .comment -S | \-arch/x86/boot/compressed/vmlinux.bin (2,094,132) | * gzip | \- arch/x86/boot/compressed/vmlinux.bin.gz (1,074,711) | * .incbin | \- piggy.S | * gcc | \- piggy.o (1,075,419) | + arch/x86/boot/compressed/head_32.o + arch/x86/boot/compressed/misc.o + arch/x86/boot/compressed/string.o + arch/x86/boot/compressed/cmdline.o + arch/x86/boot/compressed/early_serial_console.o | * ld -m elf_i386 -T arch/x86/boot/compressed/vmlinux.lds | \-arch/x86/boot/compressed/vmlinux (1,099,538) | * objcopy -O binary -R .note -R .comment -S | \- arch/x86/boot/vmlinux.bin (1,092,060) | | + arch/x86/boot/a20.o | + arch/x86/boot/bioscall.o | + arch/x86/boot/cmdline.o | + arch/x86/boot/copy.o | + arch/x86/boot/cpu.o | + arch/x86/boot/cpucheck.o | + arch/x86/boot/early_serial_console.o | + arch/x86/boot/edd.o | + arch/x86/boot/header.o | + arch/x86/boot/main.o | + arch/x86/boot/mca.o | + arch/x86/boot/memory.o | + arch/x86/boot/pm.o | + arch/x86/boot/pmjump.o | + arch/x86/boot/printf.o | + arch/x86/boot/regs.o | + arch/x86/boot/string.o | + arch/x86/boot/tty.o | + arch/x86/boot/video.o | + arch/x86/boot/video-mode.o | + arch/x86/boot/version.o | + arch/x86/boot/video-vga.o | + arch/x86/boot/video-vesa.o | + arch/x86/boot/video-bios.o | | | * ld -m elf_i386 -T arch/x86/boot/setup.ld | | | \-arch/x86/boot/setup.elf (186,171) | | | * objcopy -O binary arch/x86/boot/setup.elf | | + \- arch/x86/boot/setup.bin (12,604) | * arch/x86/boot/tools/build | \- arch/x86/boot/bzImage (1,104,864) ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: x86 kernel build chain - how bzImage gets created
On Tue, Nov 22, 2011 at 12:46 PM, Graeme Russ graeme.r...@gmail.com wrote: Hi All, Hopefully this will help demystify the build process Notation: primary input file (file size in bytes) | + additional input file | * command | \- output file (file size in bytes) The file sizes are arbitrary and are based on the current configuration options I have set for a small kernel. They are simply there to illustrate the relative differences in file sizes. Great! Thanks for sharing this. Note that vmlinux.o is not used to generate bzImage but I've included it for completeness [...] + net/built-in.o | * ld -m elf_i386 -r -o vmlinux.o | \-vmlinux.o (2,889,050) What is the purpose of vmlinux.o then? thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: x86: Executing a raw vmlinux image (embedded environment)
Thanks syed, Ok, I did a little more digging... On 22/11/11 16:34, sk.syed2 wrote: /vmlinux2,629,659 bytes /vmlinux.o 2,889,050 bytes /arch/i386/boot/bzImage 1,104,864 bytes /arch/x86/boot/bzImage 1,104,864 bytes /arch/x86/boot/vmlinux.bin 1,092,060 bytes /arch/x86/boot/compressed/vmlinux 1,099,538 bytes /arch/x86/boot/compressed/vmlinux.bin 2,094,132 bytes /arch/x86/boot/compressed/vmlinux.bin.gz1,074,711 bytes I understand that /arch/x86/boot/compressed/vmlinux.bin.gz is a compressed version of /arch/x86/boot/compressed/vmlinux.bin, and /arch/i386/boot/bzImage and /arch/x86/boot/bzImage are the same file and that it is the 16-bit boot code + /arch/x86/boot/compressed/vmlinux.bin.gz This is correct. but I don't understand the rest... I traced it all out. I sent a separate message to the ML documenting the bzImage build chain - It's rather fascinating My guess is that /vmlinux.o is the ELF image generated by the compiler + linker stage and /vmlinux may be /vmlinux.o objdump'd into a raw binary and perhaps /arch/x86/boot/vmlinux.bin is a further stripped version of/vmlinux, but I'm at a loss with /arch/x86/boot/compressed/vmlinux vmlinux is ELF image with ELF header. So actual point of kernel entry would be at an offset, somewhere after the ELF header. vmlinux.bin is what you would get after doing #objcopy -O binary vmlinux vmlinux.bin. vmlinux.bin has only obj code and nothing else. To be more precise: arch/x86/boot/compressed/vmlinux.bin is the result of #objcopy -R .comment -S vmlinux so it is still an ELF image arch/x86/boot/vmlinux.bin is the result of: #objcopy -O binary -R .note -R .comment -S arch/x86/boot/compressed/vmlinux arch/x86/boot/compressed/vmlinux has the decompression stub + compressed version of arch/x86/boot/compressed/vmlinux.bin In any event, it looks like either /arch/x86/boot/compressed/vmlinux.bin or /vmlinux is what I need to copy into RAM @ 0x10 (1MiB) which is where my non-relocatable kernel is compiled to. copy vmlinux.bin. I don't think either is what I want - arch/x86/boot/vmlinux.bin still contains a compressed kernel. And the contents of the compressed section is an ELF image which requires more memcpys and memsets What I really want, I think, is: #objcopy -O binary -R .comment -S vmlinux Which is not generated during the build process - How to setup the memory map (keeping in mind I have 2GB of contiguous memory with no BIOS/ACPI etc to worry about clobbering - Any other tricks I need to be aware of.. Check if x86 kernel expects some parameters(like machineid, bootargs location etc) in some registers. Check if x86 has low level debug support(like DEBUG_LL). Also you might want to check how initial page tables are being setup in kernel. I need to have a good look at what goes into arch/x86/boot/setup.bin - That will really tell me what I need to do Thanks, Graeme ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: x86 kernel build chain - how bzImage gets created
Hi Daniel On 22/11/11 21:59, Daniel Baluta wrote: On Tue, Nov 22, 2011 at 12:46 PM, Graeme Russ graeme.r...@gmail.com wrote: Hi All, Hopefully this will help demystify the build process Notation: primary input file (file size in bytes) | + additional input file | * command | \- output file (file size in bytes) The file sizes are arbitrary and are based on the current configuration options I have set for a small kernel. They are simply there to illustrate the relative differences in file sizes. Great! Thanks for sharing this. Your welcome :) Note that vmlinux.o is not used to generate bzImage but I've included it for completeness [...] + net/built-in.o | * ld -m elf_i386 -r -o vmlinux.o | \-vmlinux.o (2,889,050) What is the purpose of vmlinux.o then? I don't know - Anyone? Regards, Graeme ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
RE: a few questions regarding acpi and kernel configuration
Hi, To cut down drivers you should configure your .config file in your source. You will have to recompile kernel. For pata you have , CONFIG_PATA_AMD=y CONFIG_PATA_OLDPIIX=y CONFIG_PATA_SCH=y This can be set to n instead of y to remover support of pata. This can be done to other modules also. -Original Message- From: kernelnewbies-boun...@kernelnewbies.org [mailto:kernelnewbies-boun...@kernelnewbies.org] On Behalf Of Littlefield, Tyler Sent: 19 October 2011 03:43 To: kernelnewbies@kernelnewbies.org Subject: a few questions regarding acpi and kernel configuration Hello all: I have a few questions, I was hoping someone could help me out here. First, I'll start off by saying that my netbook is a sort of PDA for me. I just boot it up and when I'm taking care of stuff for work running around getting info and that, I can use it to grab the info. I use Linux for this, but my battery dies kind of quickly. I'm also looking to optomize performance as much as possible. So, I sat down and tried to optomize a kernel. Both to save space (since this is a smaller drive), and to make things a bit quicker, even by a little bit. I put the config here: http://tds-solutions.net/config.tar.bz2 First, I'm curious what else I can yank out of there to make everything smaller. I'd like to cut down on the drivers and all that, and just include the driver for my specific harddrive if that's possible, as well as the wireless card. Can I turn off scsi/pata/ata since I have a sata drive? Is there other stuff I missed that I could take out? Finally, my last two questions. 1) Is there a way to access acpi so I can put the computer into standby quickly? I'm not sure how to pull that off from the cli, but doing it with code would work. 2) Is there a way for me to detect when the lid of my laptop has been closed and put it into standby, and/or set an idle timer to put it into standby? If there are clients out there that can interface with acpi and help with this, awesome. If not, and I need to code something up, that works too. Finally, I'm trying to find a way, since I do not use it to turn off the display. Is this possible? -- Take care, Ty Web: http://tds-solutions.net The Aspen project: a light-weight barebones mud engine http://code.google.com/p/aspenmud Sent from my toaster. ___ 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: Path for STOLEN Packets!!!
On 11/22/2011 1:26 PM, Kesava Srinivas wrote: Hi , Even after lot of google; didn't get the accurate answer for this. After STEALING Packets (NF_STOLEN); want to send the Manipulated Packet (added extra header) to some of the available net devices. Please let me know what is the Function that I Should call to do this step ?? Also; once the skb was expanded by 20 bytes to add new ip header; do I need to reassign the skb pointer to the new location ?? -Thanks in Advance, VKS ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies Hi srinivas, You can send/transmit the manipulated skb buffer by passing it to dev_queue_xmit . Be carefull though, any error crafting the packet, a kernel panic is waiting 4 you :-) These articles might help http://www.phrack.org/issues.html?issue=61id=13 http://www.phrack.org/issues.html?issue=61id=13 http://www.phrack.org/issues.html?issue=55id=12#article Regards shivanth ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re:
Sorry for the spam here, my email account was stolen. On Mon, Nov 21, 2011 at 11:22 PM, Jimmy Pan dsp...@gmail.com wrote: ..Do you want to feel something new? Do you want to feel new unforgettable sensations? This is for you! http://un-ocean.fr/p.g.php?wellink_friend_id=14ox0 ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: x86 kernel build chain - how bzImage gets created
On Tue, Nov 22, 2011 at 17:46, Graeme Russ graeme.r...@gmail.com wrote: Hi All, Hopefully this will help demystify the build process Hi! Wow great man! I deeply suggest to write that into kernelnewbies wiki too Once again, great job! -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Serial console temporarily garbled
I'm working on an embedded system running a 2.6.32 kernel originally derived from RHEL6. The hardware architecture is similar to a PC. The device is a specialized server. It uses an 8250 compatible serial port for the console. When it's booting up, everything looks fine until it initializes the serial driver. At that point the output to the console becomes garbled until (I think...) getty runs for the console port. Then it's readable again. It looks as though the initialization of the serial driver is setting the wrong baud rate, or perhaps some other configuration. During the boot process, this garbled output happens for about 1 second, during which probably a few thousand characters of garbage are output. The grub boot parameter specifies console=ttys0,57600 The getty line for the console specifies T0:23:respawn:/sbin/getty -L ttys0 57600 vt100 It's not clear to me how the serial driver is supposed to be initialized to the right baud rate. Is the parameter from the boot line supposed to be used? (Just to complicate matters, we're using a Debian userspace with this kernel). Here's how it looks on the console: [4.429923] Non-volatile memory driver v1.3 [4.438325] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled ÿ[4.615305] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a ST16650V2 ;s¶6T=$ɽ¤©;s¶v´=ĽÁÔP%1D²äÍÓÉK æÑ- %1¹©;s¶5V=ÔÍê£!¬E¹)¥°? U000ÉP%19)$%°©;s61v=¡ 0¦0¦1r2CÔJ °æÁ0424¬Ñ6/F3d °0 ÕÁ4! Much garbage deleted... ؤµ!V°ÉD¨«Í'µõ;Ðs°W¶G=dÉ©¥®5ÕV$´Ô¥½Y§ ³°V%jê;Ðs1·Ë=t²E%²ÑiÑ)¤D!6f¸ÕêLoading, please wait... PuTTYPuTTYPuTTYBegin: Loading essential drivers ... done. Begin: Running /scripts/init-premount ... PuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYdone. Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done. If anyone can point me in the right direction to understand this, that would be great. I think the repeated 'PuTTY' strings result from control characters being sent to the terminal, which is PuTTY. It's answerback string is 'PuTTY' by default. Thanks, Neil Baylis ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Serial console temporarily garbled
Hi Neil, On Tue, Nov 22, 2011 at 10:20 AM, Neil Baylis neil.bay...@gmail.com wrote: I'm working on an embedded system running a 2.6.32 kernel originally derived from RHEL6. The hardware architecture is similar to a PC. The device is a specialized server. It uses an 8250 compatible serial port for the console. When it's booting up, everything looks fine until it initializes the serial driver. At that point the output to the console becomes garbled until (I think...) getty runs for the console port. Then it's readable again. It looks as though the initialization of the serial driver is setting the wrong baud rate, or perhaps some other configuration. During the boot process, this garbled output happens for about 1 second, during which probably a few thousand characters of garbage are output. The grub boot parameter specifies console=ttys0,57600 Did you mean ttyS0? The capital S is significant. The serial ports default to 9600 baud, which is probably what the garbage coming out is. The getty line for the console specifies T0:23:respawn:/sbin/getty -L ttys0 57600 vt100 This should probably also be ttyS0 -- Dave Hylands Shuswap, BC, Canada http://www.davehylands.com ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Serial console temporarily garbled
My apologies for the confusion, I meant ttyS0. I mistyped when composing the email. Neil On Tue, Nov 22, 2011 at 10:43 AM, Dave Hylands dhyla...@gmail.com wrote: Hi Neil, On Tue, Nov 22, 2011 at 10:20 AM, Neil Baylis neil.bay...@gmail.com wrote: I'm working on an embedded system running a 2.6.32 kernel originally derived from RHEL6. The hardware architecture is similar to a PC. The device is a specialized server. It uses an 8250 compatible serial port for the console. When it's booting up, everything looks fine until it initializes the serial driver. At that point the output to the console becomes garbled until (I think...) getty runs for the console port. Then it's readable again. It looks as though the initialization of the serial driver is setting the wrong baud rate, or perhaps some other configuration. During the boot process, this garbled output happens for about 1 second, during which probably a few thousand characters of garbage are output. The grub boot parameter specifies console=ttys0,57600 Did you mean ttyS0? The capital S is significant. The serial ports default to 9600 baud, which is probably what the garbage coming out is. The getty line for the console specifies T0:23:respawn:/sbin/getty -L ttys0 57600 vt100 This should probably also be ttyS0 -- Dave Hylands Shuswap, BC, Canada http://www.davehylands.com ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
GPL-only symbol Error
Hi All, Basically, I am developing a kernel module named xyz.ko and my MODULE_LICENSE is Proprietary. I have got an error GPL-incompatible module xyz.ko uses GPL-only symbols. I am having trouble identifying it. How to avoid this error in during MODPOST?. Is there any way to avoid this error? Can you someone throw light on this. Regards, S. Sengottuvelan. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
RE: GPL-only symbol Error
From: kernelnewbies-boun...@kernelnewbies.org [mailto:kernelnewbies-boun...@kernelnewbies.org] On Behalf Of Sengottuvelan S Sent: Tuesday, November 22, 2011 1:49 PM To: Kernel Newbies Subject: GPL-only symbol Error Hi All, Basically, I am developing a kernel module named xyz.ko and my MODULE_LICENSE is Proprietary. I have got an error GPL-incompatible module xyz.ko uses GPL-only symbols. I am having trouble identifying it. How to avoid this error in during MODPOST?. Is there any way to avoid this error? Can you someone throw light on this. Regards, S. Sengottuvelan. Legally, I believe your only option is to change your code to not reference the EXPORT_SYMBOL_GPL () symbols that it is currently referencing. Jeff Haran ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: GPL-only symbol Error
Hi Jeff, I have few symbols with this error especially - sock_recv_timestamp(). Is there way to refer this or similar API in my module with MODULE_LICENSE is Proprietary. How do I know equavalent non-EXPORT_SYMBOL_GPL APIs to achieve similar functionality. Regards Sengottuvelan.S On Tue, Nov 22, 2011 at 1:53 PM, Jeff Haran jha...@bytemobile.com wrote: ** ** ** ** *From:* kernelnewbies-boun...@kernelnewbies.org [mailto: kernelnewbies-boun...@kernelnewbies.org] *On Behalf Of *Sengottuvelan S *Sent:* Tuesday, November 22, 2011 1:49 PM *To:* Kernel Newbies *Subject:* GPL-only symbol Error ** ** Hi All, Basically, I am developing a kernel module named xyz.ko and my MODULE_LICENSE is Proprietary. I have got an error GPL-incompatible module xyz.ko uses GPL-only symbols. I am having trouble identifying it. How to avoid this error in during MODPOST?. Is there any way to avoid this error? Can you someone throw light on this. Regards, S. Sengottuvelan. ** ** Legally, I believe your only option is to change your code to not reference the EXPORT_SYMBOL_GPL () symbols that it is currently referencing. ** ** Jeff Haran ** ** -- Regards, S. Sengottuvelan. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
RE: GPL-only symbol Error
From: Sengottuvelan S [mailto:sengottuvela...@gmail.com] Sent: Tuesday, November 22, 2011 2:09 PM To: Jeff Haran Cc: Kernel Newbies Subject: Re: GPL-only symbol Error Hi Jeff, I have few symbols with this error especially - sock_recv_timestamp(). Is there way to refer this or similar API in my module with MODULE_LICENSE is Proprietary. How do I know equavalent non-EXPORT_SYMBOL_GPL APIs to achieve similar functionality. Regards Sengottuvelan.S On Tue, Nov 22, 2011 at 1:53 PM, Jeff Haran jha...@bytemobile.com wrote: From: kernelnewbies-boun...@kernelnewbies.org [mailto:kernelnewbies-boun...@kernelnewbies.org] On Behalf Of Sengottuvelan S Sent: Tuesday, November 22, 2011 1:49 PM To: Kernel Newbies Subject: GPL-only symbol Error Hi All, Basically, I am developing a kernel module named xyz.ko and my MODULE_LICENSE is Proprietary. I have got an error GPL-incompatible module xyz.ko uses GPL-only symbols. I am having trouble identifying it. How to avoid this error in during MODPOST?. Is there any way to avoid this error? Can you someone throw light on this. Regards, S. Sengottuvelan. Legally, I believe your only option is to change your code to not reference the EXPORT_SYMBOL_GPL () symbols that it is currently referencing. Jeff Haran sock_recv_timestamp() is an inline function, but it calls __sock_recv_timestamp() which is declared like so: EXPORT_SYMBOL_GPL(__sock_recv_timestamp); And that is I suspect what is generating the error. You can try to find equivalent functionality in other kernel code that is not so declared. Good luck with that. Even if you do find it, don't be surprised if down the line you decide to upgrade the kernel you are using and then you find that what were EXPORT_SYMBOL() symbols have been changed to EXPORT_SYMBOL_GPL() and you'll have to do it all over again, if it turns out to be even possible. That's a bad place to be in since its usually completely unanticipated work. Blows development schedules right out of the water. I've seen others when faced with this who build their own kernels from sources just modify the problematic EXPORT_SYMBOL_GPL()s to EXPORT_SYMBOL()s. I don't know if that is legal. I wouldn't do it personally. Consult a lawyer before you go down that road. This stuff is designed to encourage you and more specifically the company you work for to declare your module as GPL and make it available for others to use. That's how Linux grows. Convincing management to do so can be quite challenging though. If your company must keep its intellectual property private, they can always dump Linux and use one of the BSD derivatives instead that aren't covered by GPL. Good luck, Jeff Haran ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: GPL-only symbol Error
On Tue, Nov 22, 2011 at 02:08:59PM -0800, Sengottuvelan S wrote: Hi Jeff, I have few symbols with this error especially - sock_recv_timestamp(). Is there way to refer this or similar API in my module with MODULE_LICENSE is Proprietary. How do I know equavalent non-EXPORT_SYMBOL_GPL APIs to achieve similar functionality. There are none, you need to fix the license of your kernel module. You do realize the kernel developer community's stance on non-GPL Linux kernel modules, right? Any reason why your company feels they can go against their wishes? thanks, greg k-h ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: GPL-only symbol Error
On Tue, Nov 22, 2011 at 02:35:24PM -0800, Jeff Haran wrote: I've seen others when faced with this who build their own kernels from sources just modify the problematic EXPORT_SYMBOL_GPL()s to EXPORT_SYMBOL()s. I don't know if that is legal. I wouldn't do it personally. Consult a lawyer before you go down that road. It is not legal and companies have gotten into big trouble by trying to do that, or by creating gpl-condom kernel modules that wrap gpl-only symbols and export them again. Do not do that without the full buy-in from your legal department as they do not want to hear about it from an external query first. This stuff is designed to encourage you and more specifically the company you work for to declare your module as GPL and make it available for others to use. That's how Linux grows. Convincing management to do so can be quite challenging though. If your company must keep its intellectual property private, they can always dump Linux and use one of the BSD derivatives instead that aren't covered by GPL. Exactly, if you want to use Linux, you must abide by the license of it, just like any body of software. What would happen if you decided to ignore the license of Microsoft's operating system? :) thanks, greg k-h ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
RE: GPL-only symbol Error
-Original Message- From: Greg KH [mailto:g...@kroah.com] Sent: Tuesday, November 22, 2011 2:44 PM To: Jeff Haran; Sengottuvelan S; Kernel Newbies Subject: Re: GPL-only symbol Error On Tue, Nov 22, 2011 at 02:35:24PM -0800, Jeff Haran wrote: I've seen others when faced with this who build their own kernels from sources just modify the problematic EXPORT_SYMBOL_GPL()s to EXPORT_SYMBOL()s. I don't know if that is legal. I wouldn't do it personally. Consult a lawyer before you go down that road. It is not legal and companies have gotten into big trouble by trying to do that, or by creating gpl-condom kernel modules that wrap gpl-only symbols and export them again. Do not do that without the full buy-in from your legal department as they do not want to hear about it from an external query first. Greg, Just curious, can you provide links to these cases? I've read the COPYING file at the top of the Linux source tree. I am not a lawyer, but I don't see anything in it that would prohibit somebody from taking the GPL kernel sources, changing the EXPORT_SYMBOL_GPL()s to EXPORT_SYMBOL()s, publishing that modified kernel source as required by the GPL license but then keep their module source that uses the now non-GPL symbols private. It seems like it should be prohibited in the spirit of open source, but I don't see any mention of these symbol declarations in the license. Thanks, Jeff Haran ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: GPL-only symbol Error
On Tue, Nov 22, 2011 at 04:34:21PM -0800, Jeff Haran wrote: Just curious, can you provide links to these cases? No kernel cases ever became public, but the SAMBA team have lots of public cases where they have successfully handled this type of case. I've read the COPYING file at the top of the Linux source tree. I am not a lawyer, but I don't see anything in it that would prohibit somebody from taking the GPL kernel sources, changing the EXPORT_SYMBOL_GPL()s to EXPORT_SYMBOL()s, publishing that modified kernel source as required by the GPL license but then keep their module source that uses the now non-GPL symbols private. It seems like it should be prohibited in the spirit of open source, but I don't see any mention of these symbol declarations in the license. The license does not say anything about this, nor should it. thanks, greg k-h ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: GPL-only symbol Error
Hi Jeff, On Wed, Nov 23, 2011 at 11:34 AM, Jeff Haran jha...@bytemobile.com wrote: -Original Message- From: Greg KH [mailto:g...@kroah.com] Sent: Tuesday, November 22, 2011 2:44 PM To: Jeff Haran; Sengottuvelan S; Kernel Newbies Subject: Re: GPL-only symbol Error On Tue, Nov 22, 2011 at 02:35:24PM -0800, Jeff Haran wrote: I've seen others when faced with this who build their own kernels from sources just modify the problematic EXPORT_SYMBOL_GPL()s to EXPORT_SYMBOL()s. I don't know if that is legal. I wouldn't do it personally. Consult a lawyer before you go down that road. It is not legal and companies have gotten into big trouble by trying to do that, or by creating gpl-condom kernel modules that wrap gpl-only symbols and export them again. Do not do that without the full buy-in from your legal department as they do not want to hear about it from an external query first. Greg, Just curious, can you provide links to these cases? I've read the COPYING file at the top of the Linux source tree. I am not a lawyer, but I don't see anything in it that would prohibit somebody from taking the GPL kernel sources, changing the EXPORT_SYMBOL_GPL()s to EXPORT_SYMBOL()s, publishing that modified kernel source as required by the GPL license but then keep their module source that uses the now non-GPL symbols private. It seems like it should be prohibited in the spirit of open source, but I don't see any mention of these symbol declarations in the license. The mere fact that the gpl-condom module links to EXPORT_SYMBOL_GPL functions make it, in and of itself, a GPL module ergo, there is no such thing as a gpl-condom module Regards, Graeme ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: GPL-only symbol Error
On Tue, 22 Nov 2011 17:21:46 -0800 Jeff Haran jha...@bytemobile.com wrote: -Original Message- From: Graeme Russ [mailto:graeme.r...@gmail.com] Sent: Tuesday, November 22, 2011 5:10 PM To: Jeff Haran Cc: Greg KH; Sengottuvelan S; Kernel Newbies Subject: Re: GPL-only symbol Error Hi Jeff, On Wed, Nov 23, 2011 at 11:34 AM, Jeff Haran jha...@bytemobile.com wrote: -Original Message- From: Greg KH [mailto:g...@kroah.com] Sent: Tuesday, November 22, 2011 2:44 PM To: Jeff Haran; Sengottuvelan S; Kernel Newbies Subject: Re: GPL-only symbol Error On Tue, Nov 22, 2011 at 02:35:24PM -0800, Jeff Haran wrote: I've seen others when faced with this who build their own kernels from sources just modify the problematic EXPORT_SYMBOL_GPL()s to EXPORT_SYMBOL()s. I don't know if that is legal. I wouldn't do it personally. Consult a lawyer before you go down that road. It is not legal and companies have gotten into big trouble by trying to do that, or by creating gpl-condom kernel modules that wrap gpl-only symbols and export them again. Do not do that without the full buy-in from your legal department as they do not want to hear about it from an external query first. Greg, Just curious, can you provide links to these cases? I've read the COPYING file at the top of the Linux source tree. I am not a lawyer, but I don't see anything in it that would prohibit somebody from taking the GPL kernel sources, changing the EXPORT_SYMBOL_GPL()s to EXPORT_SYMBOL()s, publishing that modified kernel source as required by the GPL license but then keep their module source that uses the now non-GPL symbols private. It seems like it should be prohibited in the spirit of open source, but I don't see any mention of these symbol declarations in the license. The mere fact that the gpl-condom module links to EXPORT_SYMBOL_GPL functions make it, in and of itself, a GPL module ergo, there is no such thing as a gpl-condom module Regards, Graeme Graeme, Perhaps, but that's not what I asked about. It seems to me the essence of GPL is that it grants people the right to modify GPL sources like the Linux kernel in any way they want so long as they make those changes available to whoever uses the code in the future. I don't see anything in it that prohibits specific changes. So if I take a symbol that in the sources from kernel.org is declared with EXPORT_SYMBOL_GPL(), make a 1 line change that declares it EXPORT_SYMBOL() and put that on a publically available web site, how have I violated GPL? Let's say I then ship a product that uses that custom kernel and a non-GPL kernel module of my own writing that only works with the custom kernel, how is that prohibited in the GPL license? Not that I am planning on doing this and I've never done it in the past, but technically it seems that there would be no violation here. I guess you can't really take some GPL code from a third party, do some random paperwork or magic trick that basically constitute an unilateral declaration from you that what was once considered and clearly identified as derivatives are not anymore, publish said derivatives that you pretend are not and do so in an incompatible licence, and get along with it. On the contrary such behavior would very probably constitute something like willfulness infringement if such thing is applicable (but IANAL and so over...) -- Guillaume Knispel Avencall - 10 bis, rue Lucien Voilin - 92800 Puteaux Tel. : (+33) 141 389 960 ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: GPL-only symbol Error
On Tue, Nov 22, 2011 at 8:21 PM, Jeff Haran jha...@bytemobile.com wrote: Graeme, Perhaps, but that's not what I asked about. It seems to me the essence of GPL is that it grants people the right to modify GPL sources like the Linux kernel in any way they want so long as they make those changes available to whoever uses the code in the future. I don't see anything in it that prohibits specific changes. So if I take a symbol that in the sources from kernel.org is declared with EXPORT_SYMBOL_GPL(), make a 1 line change that declares it EXPORT_SYMBOL() and put that on a publically available web site, how have I violated GPL? Let's say I then ship a product that uses that custom kernel and a non-GPL kernel module of my own writing that only works with the custom kernel, how is that prohibited in the GPL license? Not that I am planning on doing this and I've never done it in the past, but technically it seems that there would be no violation here. Thanks, Jeff Haran I assume you know it is against the GPL to remove the license statements. If I was to write it, the implementation of EXPORT_SYMBOL_GPL() would have embedded license statements. Thus if you removed it, you would be removing a license statement and are in violation of the GPL. Somehow, I think the kernel legal brains have come up with even better ideas than I have. Greg (not KH) ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
RE: GPL-only symbol Error
-Original Message- From: Guillaume Knispel [mailto:gknis...@proformatique.com] Sent: Tuesday, November 22, 2011 5:40 PM To: Jeff Haran Cc: Graeme Russ; Greg KH; Sengottuvelan S; Kernel Newbies Subject: Re: GPL-only symbol Error On Tue, 22 Nov 2011 17:21:46 -0800 Jeff Haran jha...@bytemobile.com wrote: -Original Message- From: Graeme Russ [mailto:graeme.r...@gmail.com] Sent: Tuesday, November 22, 2011 5:10 PM To: Jeff Haran Cc: Greg KH; Sengottuvelan S; Kernel Newbies Subject: Re: GPL-only symbol Error Hi Jeff, On Wed, Nov 23, 2011 at 11:34 AM, Jeff Haran jha...@bytemobile.com wrote: -Original Message- From: Greg KH [mailto:g...@kroah.com] Sent: Tuesday, November 22, 2011 2:44 PM To: Jeff Haran; Sengottuvelan S; Kernel Newbies Subject: Re: GPL-only symbol Error On Tue, Nov 22, 2011 at 02:35:24PM -0800, Jeff Haran wrote: I've seen others when faced with this who build their own kernels from sources just modify the problematic EXPORT_SYMBOL_GPL()s to EXPORT_SYMBOL()s. I don't know if that is legal. I wouldn't do it personally. Consult a lawyer before you go down that road. It is not legal and companies have gotten into big trouble by trying to do that, or by creating gpl-condom kernel modules that wrap gpl- only symbols and export them again. Do not do that without the full buy-in from your legal department as they do not want to hear about it from an external query first. Greg, Just curious, can you provide links to these cases? I've read the COPYING file at the top of the Linux source tree. I am not a lawyer, but I don't see anything in it that would prohibit somebody from taking the GPL kernel sources, changing the EXPORT_SYMBOL_GPL()s to EXPORT_SYMBOL()s, publishing that modified kernel source as required by the GPL license but then keep their module source that uses the now non-GPL symbols private. It seems like it should be prohibited in the spirit of open source, but I don't see any mention of these symbol declarations in the license. The mere fact that the gpl-condom module links to EXPORT_SYMBOL_GPL functions make it, in and of itself, a GPL module ergo, there is no such thing as a gpl-condom module Regards, Graeme Graeme, Perhaps, but that's not what I asked about. It seems to me the essence of GPL is that it grants people the right to modify GPL sources like the Linux kernel in any way they want so long as they make those changes available to whoever uses the code in the future. I don't see anything in it that prohibits specific changes. So if I take a symbol that in the sources from kernel.org is declared with EXPORT_SYMBOL_GPL(), make a 1 line change that declares it EXPORT_SYMBOL() and put that on a publically available web site, how have I violated GPL? Let's say I then ship a product that uses that custom kernel and a non-GPL kernel module of my own writing that only works with the custom kernel, how is that prohibited in the GPL license? Not that I am planning on doing this and I've never done it in the past, but technically it seems that there would be no violation here. I guess you can't really take some GPL code from a third party, do some random paperwork or magic trick that basically constitute an unilateral declaration from you that what was once considered and clearly identified as derivatives are not anymore, publish said derivatives that you pretend are not and do so in an incompatible licence, and get along with it. On the contrary such behavior would very probably constitute something like willfulness infringement if such thing is applicable (but IANAL and so over...) If I planned to do this, I wouldn't change the license. The custom kernel sources I posted to the would-be web site would still have the same COPYING file. You say it can't be done, but so far I've read nothing that convinces me that it would be illegal according to the verbiage of the license. Again, given the scenario I described, how would the existing GPL2 license file that accompanies the kernel sources prohibit it? It seems to me that the answer so far is nothing and as such the previous assertion that doing this would be illegal is not supported by the law, at least not in the US where I live. Perhaps in other countries the laws of copyright are different, but if there has been anything in these recent international trade agreements that has been successful it has been a standardization of the intellectual property law that governs this kind of thing across different national boundaries. I personally am all for open source. I wish I could have been more successful in the past at convincing my employers to open up their proprietary modules and push them upstream, if no other reason that it would have made my life
RE: GPL-only symbol Error
-Original Message- From: Greg Freemyer [mailto:greg.freem...@gmail.com] Sent: Tuesday, November 22, 2011 5:57 PM To: Jeff Haran Cc: Graeme Russ; Greg KH; Sengottuvelan S; Kernel Newbies Subject: Re: GPL-only symbol Error On Tue, Nov 22, 2011 at 8:21 PM, Jeff Haran jha...@bytemobile.com wrote: Graeme, Perhaps, but that's not what I asked about. It seems to me the essence of GPL is that it grants people the right to modify GPL sources like the Linux kernel in any way they want so long as they make those changes available to whoever uses the code in the future. I don't see anything in it that prohibits specific changes. So if I take a symbol that in the sources from kernel.org is declared with EXPORT_SYMBOL_GPL(), make a 1 line change that declares it EXPORT_SYMBOL() and put that on a publically available web site, how have I violated GPL? Let's say I then ship a product that uses that custom kernel and a non-GPL kernel module of my own writing that only works with the custom kernel, how is that prohibited in the GPL license? Not that I am planning on doing this and I've never done it in the past, but technically it seems that there would be no violation here. Thanks, Jeff Haran I assume you know it is against the GPL to remove the license statements. If I was to write it, the implementation of EXPORT_SYMBOL_GPL() would have embedded license statements. Thus if you removed it, you would be removing a license statement and are in violation of the GPL. Perhaps, but you didn't write it. The implementation of EXPORT_SYMBOL_GPL() is this: /* For every exported symbol, place a struct in the __ksymtab section */ #define __EXPORT_SYMBOL(sym, sec) \ extern typeof(sym) sym; \ __CRC_SYMBOL(sym, sec) \ static const char __kstrtab_##sym[] \ __attribute__((section(__ksymtab_strings), aligned(1))) \ = MODULE_SYMBOL_PREFIX #sym;\ static const struct kernel_symbol __ksymtab_##sym \ __used \ __attribute__((section(__ksymtab sec), unused)) \ = { (unsigned long)sym, __kstrtab_##sym } #define EXPORT_SYMBOL_GPL(sym) \ __EXPORT_SYMBOL(sym, _gpl) How does that constitute a legal license document? It's C preprocessor gibberish that only a software engineer can understand. Law is decided in courts, in juries of peers, at least the US. Any judge that is asked to rule on the validity of the above as a legal document would laugh the attorney out of court. Somehow, I think the kernel legal brains have come up with even better ideas than I have. I would hope they had, but so far I've seen no evidence to that effect. Jeff Haran ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: GPL-only symbol Error
On Tue, Nov 22, 2011 at 05:21:46PM -0800, Jeff Haran wrote: Perhaps, but that's not what I asked about. It seems to me the essence of GPL is that it grants people the right to modify GPL sources like the Linux kernel in any way they want so long as they make those changes available to whoever uses the code in the future. I don't see anything in it that prohibits specific changes. So if I take a symbol that in the sources from kernel.org is declared with EXPORT_SYMBOL_GPL(), make a 1 line change that declares it EXPORT_SYMBOL() and put that on a publically available web site, how have I violated GPL? If you distribute that, nothing. But if you somehow think that protects your closed source kernel module to now use that symbol exported by the condom module, you are mistaken. Again, talk to a lawyer for the details, they are the best ones to answer this for you, we aren't. Would you ask a lawyer mailing list for medical questions? greg k-h ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: GPL-only symbol Error
On Tue, Nov 22, 2011 at 06:10:27PM -0800, Jeff Haran wrote: But it doesn't do anybody any good to spread misinformation about this topic, particularly with regard to what is and isn't legal. I agree, please don't continue it, but rather, consult a lawyer if you have further questions. greg k-h ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: busybox utility
Dear Friends thanks for reply, I post on Kernel newbies since i could not found any good place to post. We do not want to use busybox due to its licence and security issue. So is there any alternate to busybox .. Thanks On Wed, Nov 23, 2011 at 12:22 AM, Thomas Petazzoni thomas.petazz...@free-electrons.com wrote: Le Tue, 22 Nov 2011 10:11:26 -0800, Jeff Haran jha...@bytemobile.com a écrit : This question is not kernel-related, so it shouldn't be posted on linux-kernel@ or kernelnewbies@. Oh, give me a break. kernelnewbies, as in newbie, as in don't know their way around yet. It's a valid point that questions like this shouldn't go to linux-kernel, but if newbies can't post questions to a newbies mailing list without fear of being chastised for it, then I don't what the list is for. Sorry if my sentence felt offensive. I think the purpose of the newbies mailing list is also for newbies to *learn* their way around, and explaining that posting a question on the right mailing list is I think important. I have no problem with newbies doing mistakes, otherwise I wouldn't be subscribed on this list and I wouldn't reply to questions. So, really, my statement was really for information, but I understand that my wording might have been understood differently. Apologies if that was the case. Best regards, Thomas -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com ___ 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: busybox utility
I post on Kernel newbies since i could not found any good place to post. We do not want to use busybox due to its licence and security issue. What security issue are you concerned about? Can you explain your concern a little more. Also, if you have some busybox specific question, ppl on the busybox mailing list will be able to help you better. -mandeep ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
plz help with the serial port pgm....
rs232 read pgm is not working when i connect in loopback but write is wroking plz help... pgm #include stdio.h #include stdlib.h #include string.h #include unistd.h #include fcntl.h #include termios.h #define _POSIX_SOURCE 1 #define BAUDRATEB9600 #define MODEMDEVICE/dev/ttyS1 int main(void) { int ret, fd; struct termios tio; char buf[255]; /* Open device for reading and writing */ fd = open(MODEMDEVICE, O_RDWR | O_NOCTTY | O_NDELAY); if (fd 0) { fprintf(stderr, Error opening device %s\n, MODEMDEVICE); goto done; } /* get current port attributes */ ret = tcgetattr(fd, tio); if (ret 0) { fprintf(stderr, Error retreiving attributes, ret=%d\n, ret); goto done; } tcflush(fd, TCIFLUSH); /* set port input speed */ ret = cfsetispeed(tio, BAUDRATE); if (ret) { fprintf(stderr, Error setting input Baud rate, ret=%d\n, ret); goto done; } /* set port output speed */ ret = cfsetospeed(tio, BAUDRATE); if (ret) { fprintf(stderr, Error setting output Baud rate, ret=%d\n, ret); goto done; } tio.c_cflag = ~CRTSCTS; /* HW flow ctl OFF */ tio.c_cflag = ~PARENB; /* no parity */ tio.c_cflag = ~CSTOPB; /* 1 stop bit */ tio.c_cflag = ~CSIZE; /* 1 stop bit */ tio.c_cflag |= CS8; /* char size; 8N1 */ tio.c_cflag |= CREAD; /* enable receiver */ /* set port attributes */ ret = tcsetattr(fd, TCSANOW, tio); if (ret 0) { fprintf(stderr, Error setting attributes, ret=%d\n, ret); goto done; } fcntl(fd, F_SETFL, FNDELAY); ret = write(fd, ab\r, 3); if (ret 0) fprintf(stderr, write() of 3 bytes failed!, ret=%d\n, ret); printf(no of data written = %d\n,ret); usleep(5000); while (1) { ret = read(fd, buf, sizeof(char)); if (ret 0) { printf(%c,buf[0]); } } done: close(fd); return 0; } ## output../a.out no of data written = 3 strace ./a.out read(3, 0xbfa8d5dd, 1) = -1 EAGAIN (Resource temporarily unavailable) read(3, 0xbfa8d5dd, 1) = -1 EAGAIN (Resource temporarily unavailable) read(3, 0xbfa8d5dd, 1) = -1 EAGAIN (Resource temporarily unavailable) read(3, 0xbfa8d5dd, 1) = -1 EAGAIN (Resource temporarily unavailable) read(3, 0xbfa8d5dd, 1) = -1 EAGAIN (Resource temporarily unavailable) read(3, 0xbfa8d5dd, 1) = -1 EAGAIN (Resource temporarily unavailable) read(3, 0xbfa8d5dd, 1) = -1 EAGAIN (Resource temporarily unavailable) read(3, 0xbfa8d5dd, 1) = -1 EAGAIN (Resource temporarily unavailable) read(3, 0xbfa8d5dd, 1) = -1 EAGAIN (Resource temporarily unavailable) ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: plz help with the serial port pgm....
Hi shibin On Tue, Nov 22, 2011 at 9:48 PM, shibin k reeny shibinkre...@gmail.com wrote: rs232 read pgm is not working when i connect in loopback but write is wroking plz help... Rather than trying to debug your program, I'll point you at this document: http://tldp.org/HOWTO/Serial-Programming-HOWTO/ and point at some sample code which I wrote a while ago, which I know works: http://svn.hylands.org/host/sertest/sertest.c -- Dave Hylands Shuswap, BC, Canada http://www.davehylands.com ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies