implementing open/write function for FAT file system - filesystems

I have to implement open/write function in the Broadcomd(firmware code) availabel at http://www.broadcom.com/support/communications_processors/downloads.php, I am going through http://elm-chan.org/fsw/ff/00index_e.html to develop an understanding of FAT file system. I have developed some understanding of the code too from the above link. But still not able to write the full fledge code...missing some design part....Could u guys plz help me to develop an implementation level understanding.

After going through the FAT32 data structures, and viewing the raw sectors with the help of NTdiskviewer utility...I have developed better understanding. Currently I have implemented it partially and open/create functions are working very fine.

Related

Using TPM under embedded Linux on ARM

I want to learn about using TPM in embedded Linux on ARM for secureboot, TrustZone etc. But I'm currently lost finding a good starting point.
I used the search engines and read some stuff like "DEN0006D_Trusted_Board_Boot_Requirements" and "Infineon-ISPN-Use-Case-Secured-boot-for-ARM-processor-platforms-ABR-v01_00-EN". But nothing which really helped me gaining knowledge.
Either I used the wrong searching words or the information is mainly closed. The most stuff I found is about TPM and Windows...
Can someone recommend any webpage, book, video or something else to start?
Edit: Beside the things in the solution, I can recommend the free open book "A Practical Guide to TPM 2.0" https://link.springer.com/book/10.1007/978-1-4302-6584-9
I was using TPM lately on an embedded Linux and it's really a hard topic.
If you are talking about TPM itself, the first thing is which version you are using.
I am assuming that you are using TPM 2.0.
A good starting point for me was: tpm-js. You can use this tool
to learn a few things about TPM. You can browse sources of this project to
get a little deeper knowledge.
Then you can use Tpm2-tss library. Only a few months ago they
implemented the FAPI layer that simplifies the whole development.
And also there is a TPM 2.0 architecture doc that can help you a
lot, but I don't think it is a good starting point.
The last and very good source of information for me ware the people behind tpm2-tss library. Ask them on the tpm2-tss Git-Hub page.
I don't recommend you to use tpm2 tools. There ware a lot of changes lately and it will be really confusing for you in the beginning. First you need to learn the differences between hierarchies and the difference between primary key and it's child keys. A lot of these information you will find in tpm-js.

Where to start with Linux Kernel Modules?

A little background, I'm a CMPE Student currently in an Operating Systems class. I have some basic knowledge of C coding but am more comfortable with C++ (taken about 3 semesters of that). Other than that, never had any other formal training in coding. Also, I've got a basic understanding of the linux environment.
I am working on a project that requires me and my team to code a linux kernel module that can do the following:
echoes data passed from user-level processes by printing the data received to the kernel log
is able to pass data from one user process to another.
must be possible to use the kernel module as an inter-process communication abstraction. module should provide for situations where a sender posts data to it but no receiver is waiting.module must cover the situation where a receiver asks for data but there is no data available.
module must cover the situation where a receiver asks for data but there is no data available.
must be a limit in the buffer capacity in your module.
Now I don't know how difficult this seems to those with a background in programming, but this seems like an impossibly complicated task for someone in my position.
Here's what I've done so far:
Coded, Compiled, Inserted, and Removed the basic "hello world" linux kernel module successfully
Read through about the first 4 or 5 chapters of The Linux Kernel Module Programming Guide
Read through a few stackoverflow posts, none of which seem to be able to direct me to where I need to go.
So finally here's my question: Can someone please point me in the direction that I need to go with this? I don't even know where to being to find commands to use for reading in user-level process data and I need somewhere to start me off. TLPD was great for insight on the topic but isn't helping me get to the point where I will have a workable project to turn in. In the past, I would learn off of reading source code and reverse engineering, is there anywhere I can find something like that? Any and all help is appreciated.
-Will
I've found that the Linux Kernel Module Programming Guide is a pretty good resource. From the sounds of it, something like a character device might work best for your purposes, but I'm not sure if you have other constraints.
Another direction I might consider (though this could be a bad path) is to look at examples in the Linux kernel for a kernel module that has similar functionality. I don't have a good example offhand, but perhaps look through /drivers/char/.
What you describe is pretty much the same as a pipe.
Read chapter three of Linux Device Drivers.
(But don't just copy the scull pipe example …)

Starting with the Core Audio framework

For a project that I intend to start on soon, I will need to play back compressed and uncompressed audio files. To do that, I intend to use the Core Audio framework. However, I have no prior experience in audio programming, and I'm really not sure where to start. Are there any beginner level resources or sample projects that can demonstrate how to build a simple audio player using Core Audio?
A preview of a book on Core Audio just came out. I've started reading it and as a beginner myself I find it helpful.
It has a tutorial style teaching method and is very clear in its explanations. I highly recommend it.
Although the questiona has already been answered.. I would like to add in a little more tips since I've struggled with the same issue for months:
Here is a very simple example code I created based on sample code on the learning core audio book.
The Matt Gallagher audio streaming tutorial is a definite must.. in addition to providing an excellent example of streaming audio live.. its also provides a simple example of multi-threading.. which brings me to the next VERY IMPORTANT point
In Apple's concurrency guide.. they advise against using multithreading.. and give you a host of suggestions like GCD and NSOperations etc etc.. NOT A GOOD IDEA when it comes to core audio.. at least real time audio.. b/c real time audio is extremely sensitive to any kind of blocking or expensive operations.. more than you can imagine (ie sometimes even simple NSLog statements can make the audio break up or even not play at all!!) Here is an indispensable read regarding this part of audio.
Audio programming is a different kind of programming than what most of us are used to. Hence take your time to understand concepts.. a lot of them will take time to sink in.. for example the difference between an audio file format and an audio streaming format.. the difference between compressed audio and PCM (non-compressed) audio.. examples abound.
One key point that took me a while to comprehend: to access audio files within the iPad library.. the only way to read them is via the AVAssetReader API methods.. not through the other APIs like AudioFileReadPackets etc.. (although if you store a file manually in your project.. then you can).. the AVAssetReader is a lot less user friendly than the other API.. but once the concepts of core audio sink in.. you won't find much of a difference.. My example uses AVAssetReader
See the discussion I've been having with Justin here.. in it you'll see a lot of pitfalls that i've fallen into and you'll get an idea on how to avoid them. Remember, especially with Core Audio.. it's not about knowing how to solve the problem.. it's about knowing what problem to solve in first place.
If you or any one else has any questions with regards to core audio please feel free to write up a question on stack overflow and point it out to me by commenting on one of my own questions just to bring it to my attention.. i've been helped a lot by the community here and i really wanna offer help in return
I wrote some sample code after spending a long time trying to figure out a similar problem as yours.
The sample code allows the user to select a song from their iPod library, it then creates an uncompressed (LPCM) copy of the file (using AVAssetReader/AVAssetWriter), and plays it back using AudioUnit (which is part of CoreAudio).
If you want to play an arbitrary file, just remove the bits of my code that create the uncompressed copy (look for AVAssetReader/AVAssetWriter), and instead have the class point to some other song file.
http://www.libsdl.org/
i think for your requirement you can get better support from above link

Program visible to Linux as normal directory

I'm trying to write program to work as programmable directory, in other words: User, or other systems open that directory and read/write files or dirs. I try to create program to cache most used files in memory (less I/O to HDD), but right now I don't know how to achive that. There are probably some docs about this but I can't find them. I know that there is FUSE, NFS and others, but reading their source is quite difficult. If any one has info about implementation in C lang I'll be very grateful.
Sorry for my English..
FUSE has a C interface - take a look at their Hello World example.
If you want a simple implementation, try Python's FUSE library. A quick tutorial can be found here.
You could have a look at the GIO library — it's part of GTK, but can be used separately. The documentation is pretty thorough, and if you need to do some quick prototyping you can use the PyGTK GIO bindings to mess around before going back and writing it in C.
It's licensed under the LGPL.
If you find it easier to code in Python, it's possible to create a compiled program using cx_Freeze.

reading FAT12 image file in C

I have a FAT12 image file and I have to open it and read it. I would like to view this image file(directories/files with in) so I can have an idea of what outcomes I should be getting. Anyone know of a good software that would let me view this FAT12 image file? Also can someone guide towards the right directions when trying to read the content of this image file?
There are a number of open source FAT filesystem implementations around.
One which I think has nice clear portable code, though there are bugs, particularly in FAT12 implementation, is http://www.larwe.com/zws/products/dosfs/index.html.
On Linux you can just mount it using the loopback device.
There is Segger files system called emFile. It is portable fs, i have emFile working on number of embedded operating system with minimal (almost none, a few simple function that need to be implemented for each os) development effort. It's not expensive as well,i mean if you doing something for fun you probably don't want to spend money at all , but for commercial use it's cheap.
http://hachoir.org/wiki/hachoir-parser
HTH

Resources