Accessing source codes to modify Linux driver - linux-kernel

I'm a beginner at Linux kernel. I have to modify the Linux driver for a project.
how do I access the source code files (such as ani.c, ath9k.h, etc.)?
I tried looking for them in the following path, but I only found kernel object files (*.ko).
PATH: drivers/net/wireless/ath/ath9k/

It's probably easiest to find them on Linus's GitHub account. You might find the guides linked from "Working with the kernel development community" helpful too.

Related

Build New Driver - How to Install New Device .inf File

Forgive my basic questions, firmware guy here. I have been "gifted" ownership of the driver for a HID device. The current driver is outdated in that it no longer supports the full range of USB pids that this product line supports. I have all of the source code, including a simple text file that includes the list of supported PIDs. I added the new range, and executed several Perl scripts with titles like "IncrementVersions", "BuildINFs" and "BuildWindowsDrivers". I can share these scripts if they're helpful.
The upshot is I seem to have some .inf files that were updated correctly: were up-rev'd, and contain the new range of USB PIDs. But if I right click on one and select "Install", I get a message that says "The system cannot find the file specified". Similalrly, if I got into Dev Man and try to update the driver, Dev Man says I'm already using the best driver for that device.
I do notice that previous versions of this driver were built into setup.exe files. I thought I could install an .inf file directly, but perhaps these setup wrappers contain some necessary functionality? How can I create a setup.exe file from an .inf?
Is any of this helpful in pointing me toward what I might be doing wrong? What can I share that would provide more useful info?
You can install INF files directly but there are three important things to know:
The INF file needs a DefaultInstall section with a line like "CopyINF=your_inf_name.inf". (Actually I think it's not needed on Windows 10 maybe).
You need a CatalogFile directive that refers to a .cat file in the same directory that you have properly signed with your code signing certificate.
You need to right-click on the INF file in Windows Explorer and click "Install" to actually install it.
Since the system is complaining about a missing file, of course you should also read your INF file carefully and make sure all the files it refers to exist somewhere where Windows knows how to find them.

Silverlight 5 Trusted Mode. Accessing FileSystem and Local drives

Is there any way, any chance at all to access entire filesystem in SL app with elevated trust?
That will work both in Windows and Mac?
Through AutomationFactory,PInvoke or unmanaged code?
I need an app that could read local drives, folders and files.
UDP: Ok, seems it's possible to read folders and files using classes of System.IO from mscorlib. Although you still can't get information about local mounted drives. There is no DriveInfo in Silverlight's mscorlib :(
Ok I have an idea about this.
It is straightforward enough with Windows, to get the list of the local drives you can use AutomationFactory. There is plenty amount of examples if you google it. Search for something called SilverlightFileExplorer.
Now on a Mac you can use Directory.EnumerateDirectories("/") and then it gets all the folders in the root. Including Volumes folder which contains shortcuts to the local drives. I'm not an expert of Berkeley System Distribution (BSD) Unix filesystems, so I can't really promise that it would work on any Mac, but this approach works on mine.
I'm still playing around with that. When I get working prototype I'll probably share it through github or something.

Anyone has a copy of osxcrypt source code?

I'd like to get a copy of the following open source code:
http://www.osxcrypt.org/release/OSXCrypt-6.2A-source.zip
The above site is gone, couldn't find any archives googling. So I come here to ask your help. I need some source code to do a virtual disk kernel extension on Mac, so Mac OS X can boot from a virtual disk file, as what we have done for Windows via our VBoot (http://www.vmlite.com/index.php/products/vboot) software.
If you do have a copy and can share with me, that would be great!
Or if you have other ideas on how to develop a virtual disk driver on Mac, that would be useful too. We have done that for Windows/Linux.
Thanks,
Executable download: http://www.apponic.com/free-downloads-327/osxcrypt-6.2a/
As for the source, a Google search constrained to the past year reveals nothing at all. The last post here isn't promising:
In 2008 some fellows took the
Truecrypt source code and wrote their
own Mac version (this was before there
was a Mac version of Truecrypt). It
was called OSXCrypt. It had potential
because it was a kernel extension, not
a user-space implementation like
Truecrypt is. They asked for and took
donations, but once Truecrypt was
released for Mac, these guys took the
money and ran. No one to my knowledge
has heard from them since. Pity.
Google search 'osxcrypt' gives numerous sites from which the binary can be downloaded. However, they all seem to lead to dead-ends - the osxcrypt.org domain is defunct (which is probably indicative of problems with the software; I'd certainly not recommend using it at the moment). Using the WayBack Machine at http://web.archive.org suggests that the website was always rather minimal - there's no evidence of the source being available there for the 2 one-page entries that are available. There were plans to put the material onto SourceForge; the project exists but there are no files available there.
There's a contact email address available via whois osxcrypt.org - maybe you should try that.
After searching in the waybackmachine it was authored by Orlando Bassotto and Matteo Flora.
Maybe someone can ping them.

Mounting archives such as *.zips (work in kernel mode without drivers)

I was wondering if there was a way to make a *.dll that mounts archives in Windows without the need for installing drivers. I've tried mounting *.isos (and was successful), but I needed to install drivers, which was not something my intended audience wants to do (or can do). The other relevant alternatives were for Linux (fuse-zip) or dead projects (zipios++).
Something along the lines of this...http://mountziplibrary.codeplex.com/
Oh, and it'd be great if the solution was GPL v3'd or at least open source.
Thanks.
Have you looked at Dokan? It looks like a Windows equivalent to Fuse.
What you're describing is called an Installable File System (IFS). It theory you don't need a driver: implement a SMB server in application space, and let the existing kernel network client talk to that. It's just TCP/IP at that level.
The proper solution is indeed an IFS driver. Fundamentally, drives are objects in the kernel namespace. As such, the code for them should be part of the kernel, and an application never is.
There was a hobbyist project called WinFUSE once, which worked as an SMB server and redirected FS requests to your .NET code. But it's gone, as far as I know. Proper way is to use a driver-based approach. The driver can be installed and removed on-the-fly if the user has admin rights, and if he doesn't, installation of the application requires admin rights anyway. In Unix/Linux it's the same - you can't mount a disk (not saying about the driver now) if you are not an admin. Could I not mention that Callback File System is the only professional supported solution that lets you accomplish the task?
I've decided to Google around for some answers.
One of particular interest was zziplib. It's for C and transparently accesses archives, just like Windows does, treating it as an actual folder.
Of course, the other implementations given by users work too. This one just fit the bill for me.
Maybe this one helps you: ZLib

Where do I get tracefmt.exe? And how do I read my MSDTC traces?

I followed the KB article from MS in order to turn on MSDTC trace. Unfortunately it was hard to follow, since it doesn't assume a very reasonable and obvious expectation of the reader, specifically "how do I read this binary log file?" I read this page from MSDN as well, where I find that I can't read the log file because I'm missing some executable called tracefmt.exe, and I'm apparently the only one anywhere with this problem.
Hence my question: Why don't I have tracefmt.exe and where do I get it? or, to get to the point: How do I read my MSDTC trace logs?
With Visual Studio 2010 installed, I found the tool in the following location:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\x64\TraceFmt.exe
I then copied the .EXE to the following location:
C:\Windows\System32\Msdtc\Trace
And ran it as follows:
TraceFmt.exe dtctrace.log.2012-06-13-10-38-57-0601-00
Although most of the time I use msdtcvtr.bat, as follows:
C:\Windows\System32\Msdtc\Trace\msdtcvtr.bat -tracelog dtctrace.log.2012-06-13-10-38-57-0601-00
To save on downloading all of the WDK (600MB+), just for 200KB of files, I opted for a 4.7MB download by doing the following:
Download "Windows XP Service Pack 2 Support Tools" from here: http://www.microsoft.com/downloads/details.aspx?FamilyId=49AE8576-9BB9-4126-9761-BA8011FABF38&displaylang=en
If running from XP, just extract and go
If running from 2003 (like I am), you'll get an error saying this can only be installed on XP. So to get around this, use a tool to extract the exe instead.
Inside the exe will be a support.cab, extract the contents of this somewhere
Look for these two files, tracefmt.exe and traceprt.dll. Copy these to your %windir%\system32\msdtc\trace directory
tracefmt (and traceview which is easier to use) are available in the Windows Driver Kit (WDK). It is available here: http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11800. It is in the WDK since this tracing technology is more commonly used in device drivers.
DTC Tracing
The Distributed Services Support Team blog goes over how to trace the DTC in more detail.
Windows Driver Kit
The links in the accepted answer seem to be broken. I've found the Windows Driver Kit homepage and current download link.
Once you have the ISO downloaded and you're at the installation screen, Microsoft Windows Driver Kit, select only Tools from Full Development Environment. The tracefmt.exe is in <install-path>\<version>\Tools\tracing\i386. Make sure you copy the version of tracefmt.exe from the 64-bit or 32-bit directory!
The blogger above moved those files to the DTC folder %systemroot%\MsDtc\Trace, probably so they were in the msdtcvtr.bat path.
After searching for tracefmt.exe and traceprt.dll from the above posts (and elsewhere) I found that you need the 64 bit version of the tools for the program to run on Windows Server 2008.
I found this blog post.
and found that if you have visual studio installed you should be able to find both the 64-bit and 32-bit versions for the exe and dll on your local machine:
ProgramFiles\Microsoft SDKs\Windows\v6.0A\Bin\ (32 bit)
ProgramFiles\Microsoft SDKs\Windows\v6.0A\Bin\x64\ (64 bit)
Tracefmt.exe comes with the Windows Driver Kit.
http://www.microsoft.com/downloads/details.aspx?FamilyID=2105564e-1a9a-4bf4-8d74-ec5b52da3d00&displaylang=en
Very often you should use existed *.mof file for enconding trace files.
In C:\Windows\System32\Msdtc\Trace\ u can see msdtctr.mof.
This file has description of the trace files and u need to use it file like this:
tracefmt log_filename -tmf msdtctr.mof
I found Darren's and Thomas Bratt's answers quite helpful, but in order to successfully parse DTC files using tracefmt, I had to provide the tmf parameter:
tracefmt -tmf msdtctr.mof dtctrace.log
Otherwise every event turned out something like
Unknown( 21): GUID=75f91e0e-d50c-47c9-b06f-3f2013e9da73 (No Format Information found).

Resources