Is there any way to harcode Linux kernel boot options? [duplicate] - linux-kernel

This question already has answers here:
Editing Kernel command-line arguments inside Kernel
(2 answers)
Closed 2 years ago.
I am working on SoC and I need to pass the kernel root partition name:
root=/dev/mmcblk0p1
I can not pass it via uEnv.txt. Is there any way to pass this boot option using the kernel configuration files or something like this?

You can do this via your bootloader. I am going to assume you are using the most common bootloader for SoC's: U-Boot. U-Boot has a variable called bootargs that normally holds all the command line options for the kernel (like root=). To append bootargs with what you want, you would enter the following in the U-Boot prompt
setenv bootargs $(bootargs) root=/dev/mmcblk0p1
If you want to permanently save the variable then you need to enter the command saveenv to tell U-Boot to save this change to disk. After this you can issue your normal boot commands.

Related

How to set the environment of a SDK in a script file?

Some operations related to embedded Linux (e.g. Kernel build etc) requires the use of toolchain, thus the first command is:
$ source /opt/fslc-x11/2.2.1/environment-setup-armv7at2hf-neon-fslc-linux-gnueabi
I'd like to place this command inside a .sh script for Ubuntu: what's the right way?

Change path of the package directory in Julia (on Windows) [duplicate]

This question already has answers here:
Change Package directory in Julia
(2 answers)
Closed 6 years ago.
How can I change the path of the package directory in Julia? I not found answer in documentation from section Package Manager Functions.
I use Julia v0.4.6 on Windows.
Option 1
How about this command from the documentation:
push!(LOAD_PATH, "C:\Path\To\My\Module\")
Which can be run from within Julia, or, as the docs say:
Putting this statement in the file ~/.juliarc.jl will extend LOAD_PATH on every Julia startup. Alternatively, the module load path can be extended by defining the environment variable JULIA_LOAD_PATH.
Option 2
The SET command in windows should be equivalent to export in unix/linux based systems: Windows equivalent of $export. E.g.
SET JULIA_PKGDIR=C:\your\directory
From here, this should enable one to follow the answer from #Gnimuc: Change Package directory in Julia

Editing Kernel command-line arguments inside Kernel

U-boot passes kernel command-line parameters. In my requirement I want to edit these parameters in the kernel source tree and don't want to change U-boot code. I am using 2.6.35 kernel.
So please guide me which part of the kernel source I have to check for this.
Follow this procedure:
Enter the kernel config by typing make menuconfig
Enter the menu Processor type and features
Enable Built-in kernel command line
Specify your command line by clicking on Built-in kernel command string
Select Built-in command line overrides boot loader arguments if you want bootargs to be ignored
You can change if from kernel config:-
+CONFIG_CMDLINE="foo=1"
+CONFIG_CMDLINE_EXTEND=y
Check runtime:-
$cat /proc/cmdline

how to make emacs recognize bash environment variables, including self-defined ones

I have this need to let Emacs recognize all the shell environment variables.
The current setup:
I use VirtualBox and launch Emacs there to remotely access server files via the Tramp mode. When i do c-x c-f, and type
$RESOURCE_HOME/foo.bar
Emacs can't recognize this path, even if this is a valid path on the server -- $RESOURCE_HOME is a self-defined var.
I know this question's been answered there: How do I make Emacs recognize bash environment variables for compilation?
But there are so many self-defined variables that I don't want to write them manually.
I wonder if it's possible to solve it in a better way.
NOTE: i'm using Tramp mode, so please clarify your ideas saying vbox machine vs. server machine. Thanks!
Emacs already lets you use envvars like you suggest above. So your problem is that those vars aren't defined in Emacs's environment. Most likely it's because you define those vars in your shell's init file but that you start Emacs from a context where the shell hasn't been involved so those init files haven't been started yet.
If so, a simple fix is to start Emacs from a shell.

How to use single step mode in QEMU?

I am new to qemu and I read that it allows for a singlestep mode emulation. This is helpful because I am trying to dump some addresses of the physical ram every cycle. Unfortunately, the qemu documentation is very bad. I know how to enable the singlestep mode from the qemu monitor but I have no idea where to put the code that I want to execute at every step. Does anyone have any information about this?
You can use gdb to attach to the guest with the
--gdb tcp::
option to qemu and then use
$ gdb <binary>
(gdb) symbol-file <sym file>
(gdb) target remote <host>:<port number>
(gdb) b <function>
(gdb) c
'b' sets a breakpoint. 'n' 's' 'i' can be used to step though the code. Entering "info" in gdb mode will show more info
http://www.xenproject.org/help/questions-and-answers/problem-with-vga-passthrough.html
From above link is the command line option for entering singlestep modes for QEMU. Next is to get the source code for QEMU (http://wiki.qemu.org/Download)
The function monitor.c:do_singlestep(Monitor *mon, const QDict *qdict)
just simply set a flag "singlestep". Note this is not the same as the "singlestep_enabled", which is to emulate hardware singlestep emulation.
(global var is declared in vl.c).
Now look into all the functions in targt-i386/translate.c - where "singlestep" flag are tested are:
if (singlestep) {
gen_jmp_im(pc_ptr - dc->cs_base);
gen_eob(dc);
break;
}
This is the place where the binaries are either executed (or "translated" to be more exact), or otherwise hardware exception raised and handler (for example). If there is any behavior you want to modify perhaps u can try here?
From Ubuntu Documentation
-singlestep
Run the emulation in single step mode.

Resources