I'm building Kernel for my embedded ARM-based system (system is a ARM7 VARISCITE DART6UL).
Since I need to build Kernel appending my local version to it, I read it's possible to edit (using make menuconfig) the right local version I need, writing in General setup->"Local version - append to kernel release".
Commands I execute to edit .config kernel are the following:
make mrproper
make imx6ul-var-dart_defconfig
make menuconfig
My question is: why my kernel release that I appended in the graphical kernel menu config file doesn't still remain saved?
Everytime I enter in menuconfig it disappear: Is there a way to fixed it, avoiding the need to rewrite each time?
Regards
Paolo
You need to copy back the .config file to arch/arm/configs/imx6ul-var-dart_defconfig
Related
I am a beginner and started learning C using VS Codium in Ubuntu. So I have a file named "programm1". And every time I try to run it in terminal with "./programm1" it doesnt recognise changes I made, unless I type "make programm1"
Is it supposed to be like this? Or is there ways to make it automatic, so I dont have to save every change I make with "make programm1"?
Your binary, programm1 doesn't know how it is build. Your build system, in this case, make specifies how to build your binary. As you found that you can execute a build manually. This is how I prefer to work (and in nvim I have the plugin ale enabled for real-time feedback).
Linux has a mechanism called inodify that allows a program to be notified of file system changes. You may want to check out wrappers for the API including the packages entr, inotify-hookable and inotify-tools.
Another option is to configure your editor to run make for you when you save a file.
I have a custom board running Yocto (Jethro) and would like to run a single u-boot command, preboot. Obviously, breaking the boot sequence with space and running it manually works. How do I get it to run automatically? More specifically, where is the startup command sequence, by default?
Edit: Also, I am aware I can edit the environment at runtime. However, I am trying to build this change into the image so I can distribute it.
When you are in the uboot environment. Enter printenv, it will list the environment variables that uboot uses.
There is a variable name bootcmd. Currently, mine contain a bunch of if else command. Similarly, add your prefer function there for boot.
And after it is finished and tested. Use saveenv to store the edit
Here is a syntax for uboot.
Edit:
U-Boot allows to store commands or command sequences in a plain text file. Using the mkimage tool you can then convert this file into a script image which can be executed using U-Boot's autoscr command. U-boot Scripting Capabilities
Typically, your U-Boot recipe will build U-Boot for a single machine, in that case, I'd normally just patch the compiled in, default, U-Boot environment to do the right thing. This is achieved by
SRC_URI_machine += "file://mydefenv.patch"
Or (even better) use your own git tree. This would also have the additional benefit that your system might be able to boot up and to something useful, even if the environment would be totally corrupted.
Another possibility is to do it like Charles suggested in a comment to another answer, create an environment offline, and have U-Boot load it, see denx.de/wiki/view/DULG/UBootScripts
A third possibility, that I've also used sometimes, is to construct the environment offline (possibly using the same or a similar mechanism as in the link above), and the flash the environment to flash during the normal flash programming process. Though, most of the time I've done this on AT91's, using a tcl script similar to at91 Sam-Ba TCL script
No matter which method you chose, the bootcmd variable in U-Boot should hold your boot script.
The general answer is that bootcmd is run by default, and if there is persistent environment you can change the command and 'saveenv' so that it's kept.
It is easiest to modify the said bootcmd, which is executed anyway.
As an alternative to patching the kernel, it is possible to override the command in u-boot.
Create a file e.g. platform-top.h at the same place where you would place the patch file (it might already exist) and override the CONFIG_BOOTCOMMAND.
The result will look something like this:
/* ... */
/* replace the memory write with any other valid command */
#define CONFIG_BOOTCOMMAND "mw 0x1 0x1 && run default_bootcommand"
Don't forget to make the file known in your bbapend SRC_URI = "file://platform-top.h"
I'm working on an embedded Linux system that has a specific I2C platform driver and I'm writing a custom I2C driver. Everything works fine, but I have a problem with their dependencies.
As my custom driver uses the default I2C functions, once I compile it, the make command automatically updates the modules.dep file saying that my driver depends on i2c-core to run, but that is not enough. In order to i2c-core to be configured I need to load i2c-omap first (the platform's driver) and only then my driver works properly.
Unfortunately, I can't find any dummy function to call and thus trick the make into adding another dependency when it generates my driver. Also, I would prefer an automated solution instead of modifying modules.dep with something like sed -i 's/RE1/RE2/' modules.dep.
So, is there any way to explicitly add a dependency to a module when I compile it?
Thanks!
I found an answer here: http://www.xml.com/ldd/chapter/book/ch11.html
I solved my problem calling
request_module("i2c-omap");
Anyway, this does not exactly update the dependencies file as I first intended. If anyone knows a way to do that, please add a comment here!
I am trying to interface a 16x2 LCD with Beagleboard xM using GPIO. I have done this by using a shell script and it's working very good. Now I want to achieve the same functionality by writing a kernel module. I know little bit about kernel programming as I'm in the learning phase. Need some guidance. Thanks in advance!
Writing a kernel module is different then shell scripting. You must write your own code in C++, declaring the kernel mode, and then compile it. I found one example, but don't have time to check it, so I am leaving that to you.
Here is one example of writing kernel modules, and here is one tutorial for interfacing 16x02 lcd.
If you have a script you can load it like a module in linux ,
In /etc/rcS.d folder you will find a lot of scripts like S13-some_name.sh . These scripts will be automatically run by the kernel while booting up. So you can just add your scipt here to make it as a module
So one thing have to do is find the last number used in these list of scripts and rename your driver script by prepending the next number to the last in the list
for eg:
if the last script in /etc/rcS.d is S53logger.sh
Rename your scipt as S54-name-.sh (don't forget to change attributes by chmod +x)
If the /etc/rcS.d is not present there might be a file rc.local file you just add the driver script to it
I am writing a program in C on Linux environment (Debian-Lenny) and would like the program to be updated when an update is available (the program gets notified when a new update is available). I am looking for a way that the program can update itself.
What I am thinking is that the main program invokes a new program to handle the update. The updater program will have(access to) the source code and receive the update information about the changes on the source code, something like that:
edit1: line 20, remove column 5 to 20;
edit2: line25, remove column 4-7 then add "if(x>3){" from the column4
edit3: line 26, enter a new line and insert "x++;"
then kill the main process, recompile the source code, and then replace the new binary with the old one.
or is there a better (easier) and standard way to implement the ability that a program can update itself?
I use the program to control a system with a Linux embedded board. Therefore, I don't want the source code to be accessible to another person (if the system is hacked or something).
If the best way to update a program by using the source code, how do you suggest me to secure the source code? If you suggest me to encrypt the source code, what function (Linux C) can the program use to encrypt and decrypt the source file?
If your target system is Debian, then you should just take advantage of the Debian packaging system to provide updates. Package your compiled application in a .deb package, distribute it on an APT archive which is included in your system's sources.list, and just use cron to schedule a regular update check with apt. The .deb package can include a post-installation script that restarts your application.
You could run an apt-proxy caching proxy on your "gateway" nodes that have internet access, and have the other nodes use that as their apt source.
Distributing source code in this case is probably not appropriate, because then you would need to include a full compiler toolchain on your target system.
What you're describing is very similar to the 80s-style of delivering Unix source code, popularized by the development of PERL. You use diff to get a record of changes between different versions of the source-code, then distribute this "patch" file, and use patch to perform the necessary modifications at the client-end. This doesn't address the network-communication or version-control issues.
A possible downside is that a first-time download may need to apply many patches to bring the version up. This is often the case when investigating old source from nntp:comp.sources.unix.