AM3352 Module How to start an application after MLO - u-boot

For AM3352 modules:
How to start a application after MLO (1st stage of Boot loader) without starting the boot loader (u-boot)?
How to start an application?
What are the prerequisites?

When the next stage is to be loaded from a filesystem rather than a direct offset, the variable CONFIG_SPL_FS_LOAD_PAYLOAD_NAME controls what the first stage (SPL) will load and then jump to. With regards to prerequisites and "starting an application", what is loaded must be a stand alone binary and handle everything that it needs and wants to do.

Related

How to precompile typescript when packaging with electron-forge

The app starts with a blank screen for a while before the app really loads
I'm using electron-forge's react-typescript template.
I can make a dmg or deb file successfully, but I noticed when I run the packaged app, there will be a blank screen for a while before the app actually load especially the first time
I checked the distributable file and found the whole source code inside it, so I guess it's because it has to compile typescript every time?
Then how to "precompile" my source code and use that to make a distributable app?
update:
Since the project was developed by other colleague, I just found out this project is using electron-compile to compile it on the fly, maybe the solution has something to do with this?
I checked the distributable file and found the whole source code inside it, so I guess it's because it has to compile typescript every time?
This is not true. Current stable uses electron-prebuilt-compile (https://github.com/electron-userland/electron-forge/blob/1709af0bc53bd962466dd2025672b95f2e9399cc/packages/api/core/src/util/electron-version.ts#L6) which creates precompiled cache for typescript files for packaging time. Typescript source is only needed for module resolution in actual filesystem.
there will be a blank screen for a while before the app actually load especially the first time
This requires profiling application itself to find out what is happening in meanwhile. It is possible module resolution takes long or either any js execution time's blocking, but can't tell without profiling it.

How a C application can update itself in Linux environment at run time

First I want to ask whether is it possible for an application to update itself at runtime on same address space?
If yes, what's the best way to implement the logic?
Usecase : My application is running on a board which is connected to network. At runtime if it detects a new version of same application, then how to update the application on same memory address, where previous one is stored.
As per my understanding first we should take the backup of update and at the time of boot load, main application should be updated with backup and then launch the application normally. Am I right?
Usually you can replace the file containing the executable while it's running without problems.
After you update the file, you can start the application like always, and close your running instance.
If you however want to do it at runtime (i.e. without forking or starting new process), I don't think it's possible without extremely weird hacks:
if you plan to "rebase" your program memory with new executable's code, you'd need to figure the stack, memory and instruction pointers for each thread. You'd need to become a disassembler.
if you plan to call a stub in your program after loading it into auxilliary memory segment, that's fine, but you need to figure where the target function is, and what happens if it's gone in your next update. Plus it's totally platform-specific.
if you plan to standardize the above approach by using shared libraries that are dynamically loaded and unloaded, I see no problem - it's very similar to the approach where you restart entire process.
I'd go with replacing just the executable, or the third option if I have a very good reason for this. The last option is nice since it lets you update your application's components separately (but at the same time this might cause you maintenance headaches later on.)
What you need is something akin to a bootloader. In this case: you will have two programs on the device, hereafter referred to as the Loader and the App.
On your initial install of the system: write the App to the beginning of memory and the Loader somewhere further down to give space if the App grows in size in the future. (Keep note of the beginning memory address of the Loader)
The App will run normally as if it was the only program, periodically checking for updates to itself. If it finds an update on the network, use a GOTO to go to the first memory location of your Loader, which will then begin running and can write over the original App with the new App found on the network. At the end of your Loader, GOTO back to the (new) App.
See this Stack Overflow question for ideas on how to GOTO to specific memory addresses. Goto a specific Address in C

Debugging & profiling a runtime-loaded module

I need to load and run a C module using dlopen() / LoadLibrary(), and be able to review extensive profiling & debugging information of the hosted module only (not the host program), via a live log displayed as part of the host:
How exactly would I go about extracting stack state and profiling info from the hosted module, at runtime? gprof and gdb? And doing so without slowing things down awfully?
Could any of the debugging and profiling information that comes back, be mixed up (i.e. between host and hosted), provided that I compile both the host and hosted modules with the correct, respective compiler switches? I need a completely clean separation of log data i.e. just the hosted module.

Improve WPF Application Coldstart: Suggestions to run program when machine starts up

Is it possible to load your WPF application when the machine starts up? Our WPF application is taking 30 seconds on our existing client hardware, and we'd like to "hide" that by having our application startup when the machine is booted. But the fact that our application boots on startup should be invisible to the user.
How would we go about building such a thing? Is there a term to google that will provide a tutorial? It would be nice if there's a WPF specific-one we can grab.
Note: In case there's any moral qualms to this (since I agree that having 20 programs startup when your computer does is frustrating!), we're building software for a specialized industry who will be using their computer to run primarily our applications.
The easiest approach would be
make sure your big libraries are installed in the GAC
write a dummy app that uses (most of) those libs. Actually use them so they get loaded.
run the dummy on startup
make the dummy stop by itself, or keep it alive hidden
This would in no way interfere with the starting of the normal application. The benefit is that the libraries get loaded and jitted. The drawback that your app still needs to load & initialize.
Sasha had a few more tips not listed here, rebasing your modules, leveraging the prefetch facility and compression (UPX, yuk!).

"Out of browser" web application running at Start-Up?

I've become familiar with the new concept of "out of browser" web applications, supported in the recent Silverlight, JavaFX, Adobe AIR etc.
Listening recently to a podcast on the subject by Scott Hanselman, I've become aware that one of the purposes behind these new architectures is to allow for "desktop-application-feel". Also, I understand some (or all) of these allow for some offline access to a sandbox of resources. This really sounds as if these frameworks could be an alternative to "real" desktop applications, as long as the application does not require messing with the user's machine (i.e. access to peripherals, certain file IO, etc).
I have a very specific question. My application needs to run at start-up. Is it possible to do so using such a framework without requiring the user to download and run a certain executable?
For example, I could always direct the user to download a small EXE that will put a .lnk file in the start-up directory, but I want to avoid such a patch.
To summarize: is it possible to have an out-of-browser web application setup itself to run at start-up without requiring file download?
To further clarify, this question does not come from an "evil" place, but rather from trying to decide whether "out-of-browser" frameworks are indeed a proper alternative to a desktop application, for my specific requirements.
The BkMark example here shows how to start an application on startup using Adobe Air. So, yes it is possible.
So, here's the deal: web apps in general will have a security context around them, and by default won't have access to write to the filesystem (outside of a temp files), access the registry, etc.
One way is, as you said, have the user run something or configure it so the lnk is executed on startup.
Another way, and I think, more in line of what you want, is that the user can run the program himself, click some button in the application, and it's configured.
I know with Java you could do this, but the user has to allow full access to their system, because your app would need to change System configuration. Then you could just configure it (by writing a lnk to your WebStart JNLP in the Startup folder)
For Internet Exploder, Javascript apps do have write access to the disk.
For other (better-secured) browsers you will either need to have a download, or Adobe AIR.
Assuming you are building for Windows, launching an executable at startup can be done several ways.
For user session startup, you can achieve this either by putting a lnk file in the appropriate folder, or with a registry entry. For operating system startup, you can achieve this with a registry entry. There are several permutations:
run application once on boot (UI not allowed)
run application every boot (UI not allowed)
start service every boot according to policy set in registry
run application once on user session start
run application every user session
Since an out of browser application has UI I expect you mean run application every user session and in this case you may as well put an LNK file in the user's startup folder.
I just created a shortcut for an SL4 OOB application, and this was the Target of the shortcut:
"C:\Program Files (x86)\Microsoft Silverlight\sllauncher.exe" 2635882436.localhost
A search of my disk revealed that location 2635882436.localhost is a folder.
C:\Users\<mylogin>\AppData\LocalLow\Microsoft\Silverlight\OutOfBrowser\2635882436.localhost
I rather doubt an OOB app of any type could place a shortcut in the Startup folder unless you somehow obtained Full Trust.

Resources