Programming for Linux on Windows - linux

I am in a strange scenario, where I must use a work windows 8 desktop how ever I am writing code to be run on a real time Linux machine. I am writing code for a Real-time system, so will need to implement many non-windows headers like RTAI and such. Obviously I can not run these on windows 8, so was curious if anyone had any suggestions for compiling and testing without having to upload code to the RTOS based computer I am programming for each time I want to run a program. I unfortunately can't use a virtual machine and would like to avoid coding in the terminal in order to remotely code on the linux machine.
Any suggestions?

You can code in Windows or whatever OS you like, what system your programming computer uses has absolutely nothing to do with the target system.
The cross compiler you are using must obviously be for the intended target system. Same goes for debugger & program download tools. Your program must either run in a simulator or it must run on the real target. The latter is strongly recommended.
So all you have to do is to acquire the right software tools. Since these are almost always written for Windows, that should be easy.

Related

How do I use the "nwjc" versions for Mac and Linux, on Windows?

NW.js has this feature it calls "Protect JavaScript Source Code": https://nwjs.readthedocs.io/en/latest/For%20Users/Advanced/Protect%20JavaScript%20Source%20Code/
The JavaScript source code of your application can be protected by compiling to native code and loaded by NW.js. You only have to distribute the compiled code with your app for production.
JS source code is compiled to native code with the tool nwjc , which is provided in the SDK build.
The compiled code is not cross-platform nor compatible between versions of NW.js. So you’ll need to run nwjc for each of the platforms when you package your application.
I downloaded the SDK distributions for Windows, Mac and Linux, and looked into the files inside them.
The Windows one has a "nwjc.exe" file, ready to be used and works. Good.
But the Mac and Linux ones have no .exe, but instead just a "nwjc" executable. This is obviously for running on macOS and Linux, respectively. Huh?
My used OS is Windows. I am developing my NW.js application on Windows, to be distributed on Windows, Mac and Linux. And I cannot run those Linux/macOS executables on a Windows system. But I have to do so, since they are for some reason not cross-platform.
This seems like a dead end to me. I either have to not "protect" my application (and thus have it stolen/copied/broken/hacked), or buy two separate computers (one expensive Mac and one PC for Linux) and do this step on those. Which of course defeats the whole point of "simple" cross-platform development.
Before you say so, I have tried running Linux in a VM and it's terrible. And Macs cannot even be legally emulated AFAIK.
Most likely, this is going to cause my application to be Windows-only, which is really sad since a major reason for going this route was to have "simple" cross-platformness which "just works".
Is there something I'm missing about this?
PS: I already do "crush" my code with Uglify-JS, before the "protection" stage.
The source protection works by saving a copy of the application as it is currently running in the OS's memory. This means you must run the command on the actual operating system, so it can load the app into memory and then save it as a V8 snapshot (V8 is the JS engine used by Chromium/Node/NW.js).
You can use tools like VirtualBox or VMWare to emulate other OS's on Windows. Getting OSX to run in an emulator is a pain, but there are youtube tutorials to explain how. Linux is very easy though, I'd start there if you are unfamiliar. Though running your application on actual hardware and manually testing in each OS is always best.
If this is too cumbersome, then you may consider not worrying about source protection until later. You can still set up your app for distribution on the other OS's without needing to emulate them if you don't use this feature. Though again, always best to manually test on each OS.

How to simulate ThreadX application on Windows OS

I have an application using ThreadX 5.1 as the kernel.
The Image is flashed on to a hardware running an ARM 9 processor.
I'm trying to build a Simulator for the application that can be run on Windows (say XP, 32-bit).
Is there any way I can make it run on Windows, without modifying the entire source code to start calling win32 system calls?
You can build a Simulator for the application that can be run on Windows with "ThreadX for Win32".
"ThreadX for Win32"'s specification is hear.
http://rtos.com/products/threadx/Win32
Yes you can if you are willing to put in the work.
First observe that each threadx system call has an equivalent posix call except for events.
So your threadx program can run as a single process using posix threads, mutexes, etc.
Events can be handled by an external library (there are a few out there).
If you find this difficult in windows then the simplest thing to do is set up a linux vm. I use an ubuntu vm running on Virtual Box. It is very easy to set up. All you will need is the cdt version of eclipse.
Next you need to stub out all of your low level system calls.
This is also easier than you might think. For example, if you have a SPI driver to read and write to flash, you can replace your flash with a big array which is quite easy to work with at this level.
Having said all this, you may get more mileage if your threadx application is modular. Then you can test each module on it's own and you don't need to mess with threads, etc.
As a first approximation this may give you what you need without going the distance to port the whole thing to run under posix.
I have done this successfully in the past and developed a full set of unit tests for a module that allowed me to develop and test it (on my mac) before going to the target. Development is much faster and reliable this way.
Another option you may want to consider is to find a qemu project that supports your microprocessor. With some work you can develop a complete simulator for your platform and then run the real firmware under the emulator.
Good luck.

Native windows Linux

I know about several projects for cross compiling between linux and Windows.
The Wine project is great for running windows application inside Linux.
andLinux is a linux running inside Windows.
My question is, can we compile a complete linux OS with a Windows compiler (like mingw32, visual studio , ...) in order to get a linux system which is fully compatible with the Windows PE executable format ?
As wine demonstrates, the PE format isn't really the problem with compatibility.
PE only defines how the program is pieced together at load time. Under windows, RUNDLL interprets it, loads all the program sections to memory, loads all the supporting dlls to memory and patches up the function pointers so that there is a program sitting in memory ready to go. (See http://msdn.microsoft.com/en-us/library/ms809762.aspx for more details. Its a good read!)
There is little stopping you writing a kernel module to do all of this. With the details in the page linked above it may not be to hard and someone may already have done it.
The real issue is the fundamentals of the operating system. Even if linux could load a PE, there would be problems around the fundamental difference in file names (\ or /) as well as the permissions model which is different and the windows registry which doesn't exist under linux. That's before you get into the different windowing model for GUIs.
Therefore the task of getting a windows program to run under linux is less about the program loader and much more about emulating all of the windows DLLs under Linux. As i understand it, this is the main heart of wine.

How to verify cross platform installation steps

I have to check installation steps of my application on different production machines. I want to check how can I install my application on HP UX. I have only linux/windows machines but dont have real physical HP unix machine. Is there any way i can check installation steps of HP unix. I am thinking of any virtual environment or any flavour that run on linux or windows which gives accessiblity and functionality of HP unix.
I am looking something to cross check platfrom installation steps.
The short answer is no. HP-UX is as different from Linux as Linux is from Windows (almost). There would be many differences in libraries, patches, installed utilities, build tools, etc.
A few examples:
HP-UX does not come pre-installed with the bash shell
HP-UX uses a proprietary software packager and installer called swinstall (analogous to RPM but completely different)
Partition layout is different
Many common utilities behave differently. "echo" is one of many examples. This will affect things if your build process uses shell utilities
Even if you can test the install, don't you need to test the product's operation on HP-UX?
Not saying it's impossible. If your application uses basic, nonspecific utilities for install, it might work. There is no way to know without a running installation. Unfortunately you need Itanium hardware and the O/S.
My recommendation would be to get your application working on Solaris and any other Unixes first. The more platforms you test on, the more portable your code will become on all of them. Then, put out some feelers and find someone with a system you can borrow time on.
Worst case, find an Itanium server like an rx2620 on eBay, should not cost too much. Even better if the seller forgets to wipe the O/S :). You'll need a terminal and possibly null modem. 11.31 (11iv3) is the latest version of the O/S.

Any lightweight *nix environment for programming

Is there any lightweight *nix OS dedicated for programming purposes?
Actually, I have a full installation of Mandriva in my computer; but sometimes in Windows I must use Virtualbox to run some *nix OS.
Because I only need the OS for only programming in this case, so I just want to ask you about it. Of course, I searched about this on the net; but I also want to have your opinions...
Basically I need C/C++, Java, Python environment.
The only Linux distro you should use is Arch Linux. Please read why it is so great for developers :)
I'm an Arch Linux user, so my opinion may be biased.
Actually, a machine that you do development on shouldn't be lightweight. It should be heavy. full of compilers, interpreters, profilers, debuggers, IDEs, editors, benchmarks, checked-out code from repos, development versions of system libraries, test suites, generated large test files, backup tools, virtual machines, chroots, music to set-up comfort environment, mail, office suite to do the paperwork.
I mean, install Putty and connect to your machine (a), or do all development on virtual machine (b), that is kept on external hard drive (that's what I did, when I needed this), so you can use it everywhere where VirtualBox can run.
As for linuxes, I personally would like to use Gentoo Linux, as it can be customized to be lightweight. But unless you're really experienced with all linux administration stuff, customization may take a lot of time. So as a (c) variant, I'd advise to use any distribution (like your Mandriva), because normally base system takes about 10% of "weight" that you need for development on top of that.
And, by the way, boot speed is irrelevant on VirtualBox, since you can save virtual machine state entirely on hard drive and restore it within seconds.
I recommend xubuntu. I keep a full programming environment on a 4GB thumb drive with me at all times... just in case. :-)
I have a Debian install with X, windowmaker, firefox, vim, gcc, make and dependencies. Also, source control tools. Not much more, other than stuff that's useful in shell scripts. About 1.4G used on disk. Boots quickly. Very little BS involved.
I used to use OpenBSD on my old laptop. Similar to the above, but even more minimalist. You upgrade the OS with tar and patch. :-) Very nice, very small. Only reason I switched away from it is because I got a new machine which needed ndiswrapper for wifi...
PS: seems like this should be a community wiki...
Don't forget about Cygwin, which gives you a Unix-like environment right within your Windows box.
What about something like Puppy or DSL?
They aren't dedicated to programming, but they are small and lightweight.
I'd use something like GRML.
It really depends on what you are trying to do in terms of development.
Questions I would ask myself before development.
a) Who is the audience of the applications?
b) Is it a web based application or a desktop application?
c) How heavy is the number crunching part?
The first questions sometimes dictate the programming language you will be using. If it is for system administrator, I believe you will be writing a console application with command line interface, that the choice would be using programming language like shell scripts languages, C, C++, and a few other script languages like Python and Ruby.
For second question, If you are doing a web based application or mobile application, you would need to get the SDK with the libraries, and it would pretty much dictate the environment you will be working on.
For the number crunching part, you would need to look into libraries like CUDA or Fortran libraries that are designed for these type of applications.
Personally I use the Gentoo and Puppy Linux distro. If you need do C, Java and python, you could just download the stage3 tar ball of Gentoo linux, download the SDK from Oracle, and you are set to go.
Sometimes people want to do the developement in Windows environment, and don't want to miss the Unix tools, using cygwin and mingw in Windows environment would be viable options.
I recommend trisquel mini is the best which is also ubuntu based. I am using it.I installed eclipse ide in it with 1 gb ram. It uses only 200 mb for running os for more information visit my https://hassan004.blogspot.com/2022/01/weight-linux-distro-trisquel-mini.html

Resources