How to set a global variable value in C to shell environment variable?Linux kernel booting stops at Uncompressing Linux… Ok, booting the kerneluboot environment variable save doesn't seem to workHow do I find ARM Linux entry point when it fails to uncompress?Linux-2.6.10 MIPS restarts after “Starting kernel …”GNU assembler Directives in X-Loader start.sU-Boot ethernet hardware MAC address in environment on SD cardBooting u-boot from eMMc flashPassing kernel params from U-Boot to ARM Linux when device tree is usedSWUpdate multiple bootenv sections
In mathematics is there a substitution that is "different" from Vieta's substitution to solve the cubic equation?
Taking the first element in a list of associations
Is it rude to ask my opponent to resign an online game when they have a lost endgame?
Map a function that takes arguments in different levels of a list
Are there any writings by blinded and/or exiled Byzantine emperors?
Can an intercepting fighter jet force a small propeller aircraft down without completely destroying it?
How do I stop making people jump at home and at work?
Is there anything in the universe that cannot be compressed?
Meaning of "educating the ice"
Updating multiple vector points at once with vertex editor in QGIS?
Ideal characterization of almost convergence
What is the maximal acceptable delay between pilot's input and flight control surface actuation?
How to run a command 1 out of N times in Bash
Why didn't Thatcher give Hong Kong to Taiwan?
Calculus Books, preferably Soviet.
Are manifolds admitting a circle foliation covered by manifolds with a (non-trivial) circle action?
Why are Latin and Sanskrit called dead languages?
Lumix G7: Raw photos only in 1920x1440, no higher res available
I have two helper functions that are the exact same, one executes and one doesn't. How come?
Punishment in pacifist society
Why did the VIC-II and SID use 6 µm technology in the era of 3 µm and 1.5 µm?
Can a country avoid prosecution for crimes against humanity by denying it happened?
How does Harry wear the invisibility cloak?
co-son-in-law or co-brother
How to set a global variable value in C to shell environment variable?
Linux kernel booting stops at Uncompressing Linux… Ok, booting the kerneluboot environment variable save doesn't seem to workHow do I find ARM Linux entry point when it fails to uncompress?Linux-2.6.10 MIPS restarts after “Starting kernel …”GNU assembler Directives in X-Loader start.sU-Boot ethernet hardware MAC address in environment on SD cardBooting u-boot from eMMc flashPassing kernel params from U-Boot to ARM Linux when device tree is usedSWUpdate multiple bootenv sections
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
While porting U-Boot on a specific hardware,
a function has to parse a header to get OS entry point to jump into it.
Say, the function get's the os entry point into a global 'C' variable uint32_t osentry
.
How to set this value to U-Boot shell command 'go'
?
I see U-Boot go (shell) command, has to be set as go $entry
In few examples, I see the entry is fixed address set as shell environment value.
Whereas, for me it is in a global 'C' variable.
u-boot
add a comment |
While porting U-Boot on a specific hardware,
a function has to parse a header to get OS entry point to jump into it.
Say, the function get's the os entry point into a global 'C' variable uint32_t osentry
.
How to set this value to U-Boot shell command 'go'
?
I see U-Boot go (shell) command, has to be set as go $entry
In few examples, I see the entry is fixed address set as shell environment value.
Whereas, for me it is in a global 'C' variable.
u-boot
U-Boot supplies several commands to start OS kernels (bootefi, booti, bootm, bootz). The concept of all of these is that the kernel image supplies the entry point. U-Boot can read the file with the OS kernel from lots of different storage media. I can not think of any reason to hard code an entry point. - If you want to port U-Boot to a new hardware you should do it in a way that is compatible with upstream U-Boot and send patches to the developer list to get your hardware mainlined.
– Xypron
Mar 28 at 21:04
@Xypron, thanks,it is NOT hard-coded. The question is once the U-Boot gets the entry point, how it jumps into it. I see same sample boards use 'go' command to jump into the entry point. To follow that, I had to set the entry address in a environmental variable as 'go' is a shell command. If not, other way how U-Boot can jump into the entry point would be helpful.
– sniper
Mar 29 at 4:37
Kernel images already contain a field indicating the entry point. You just load the kernel, the initial ramdisk and the device tree into memory and call the appropriate command to start the kernel passing the loading addresses.
– Xypron
Mar 30 at 16:58
add a comment |
While porting U-Boot on a specific hardware,
a function has to parse a header to get OS entry point to jump into it.
Say, the function get's the os entry point into a global 'C' variable uint32_t osentry
.
How to set this value to U-Boot shell command 'go'
?
I see U-Boot go (shell) command, has to be set as go $entry
In few examples, I see the entry is fixed address set as shell environment value.
Whereas, for me it is in a global 'C' variable.
u-boot
While porting U-Boot on a specific hardware,
a function has to parse a header to get OS entry point to jump into it.
Say, the function get's the os entry point into a global 'C' variable uint32_t osentry
.
How to set this value to U-Boot shell command 'go'
?
I see U-Boot go (shell) command, has to be set as go $entry
In few examples, I see the entry is fixed address set as shell environment value.
Whereas, for me it is in a global 'C' variable.
u-boot
u-boot
asked Mar 28 at 1:44
snipersniper
3582 gold badges5 silver badges19 bronze badges
3582 gold badges5 silver badges19 bronze badges
U-Boot supplies several commands to start OS kernels (bootefi, booti, bootm, bootz). The concept of all of these is that the kernel image supplies the entry point. U-Boot can read the file with the OS kernel from lots of different storage media. I can not think of any reason to hard code an entry point. - If you want to port U-Boot to a new hardware you should do it in a way that is compatible with upstream U-Boot and send patches to the developer list to get your hardware mainlined.
– Xypron
Mar 28 at 21:04
@Xypron, thanks,it is NOT hard-coded. The question is once the U-Boot gets the entry point, how it jumps into it. I see same sample boards use 'go' command to jump into the entry point. To follow that, I had to set the entry address in a environmental variable as 'go' is a shell command. If not, other way how U-Boot can jump into the entry point would be helpful.
– sniper
Mar 29 at 4:37
Kernel images already contain a field indicating the entry point. You just load the kernel, the initial ramdisk and the device tree into memory and call the appropriate command to start the kernel passing the loading addresses.
– Xypron
Mar 30 at 16:58
add a comment |
U-Boot supplies several commands to start OS kernels (bootefi, booti, bootm, bootz). The concept of all of these is that the kernel image supplies the entry point. U-Boot can read the file with the OS kernel from lots of different storage media. I can not think of any reason to hard code an entry point. - If you want to port U-Boot to a new hardware you should do it in a way that is compatible with upstream U-Boot and send patches to the developer list to get your hardware mainlined.
– Xypron
Mar 28 at 21:04
@Xypron, thanks,it is NOT hard-coded. The question is once the U-Boot gets the entry point, how it jumps into it. I see same sample boards use 'go' command to jump into the entry point. To follow that, I had to set the entry address in a environmental variable as 'go' is a shell command. If not, other way how U-Boot can jump into the entry point would be helpful.
– sniper
Mar 29 at 4:37
Kernel images already contain a field indicating the entry point. You just load the kernel, the initial ramdisk and the device tree into memory and call the appropriate command to start the kernel passing the loading addresses.
– Xypron
Mar 30 at 16:58
U-Boot supplies several commands to start OS kernels (bootefi, booti, bootm, bootz). The concept of all of these is that the kernel image supplies the entry point. U-Boot can read the file with the OS kernel from lots of different storage media. I can not think of any reason to hard code an entry point. - If you want to port U-Boot to a new hardware you should do it in a way that is compatible with upstream U-Boot and send patches to the developer list to get your hardware mainlined.
– Xypron
Mar 28 at 21:04
U-Boot supplies several commands to start OS kernels (bootefi, booti, bootm, bootz). The concept of all of these is that the kernel image supplies the entry point. U-Boot can read the file with the OS kernel from lots of different storage media. I can not think of any reason to hard code an entry point. - If you want to port U-Boot to a new hardware you should do it in a way that is compatible with upstream U-Boot and send patches to the developer list to get your hardware mainlined.
– Xypron
Mar 28 at 21:04
@Xypron, thanks,it is NOT hard-coded. The question is once the U-Boot gets the entry point, how it jumps into it. I see same sample boards use 'go' command to jump into the entry point. To follow that, I had to set the entry address in a environmental variable as 'go' is a shell command. If not, other way how U-Boot can jump into the entry point would be helpful.
– sniper
Mar 29 at 4:37
@Xypron, thanks,it is NOT hard-coded. The question is once the U-Boot gets the entry point, how it jumps into it. I see same sample boards use 'go' command to jump into the entry point. To follow that, I had to set the entry address in a environmental variable as 'go' is a shell command. If not, other way how U-Boot can jump into the entry point would be helpful.
– sniper
Mar 29 at 4:37
Kernel images already contain a field indicating the entry point. You just load the kernel, the initial ramdisk and the device tree into memory and call the appropriate command to start the kernel passing the loading addresses.
– Xypron
Mar 30 at 16:58
Kernel images already contain a field indicating the entry point. You just load the kernel, the initial ramdisk and the device tree into memory and call the appropriate command to start the kernel passing the loading addresses.
– Xypron
Mar 30 at 16:58
add a comment |
1 Answer
1
active
oldest
votes
How to set a global variable value in C to shell environment variable?
Use the env_set_addr() function to set an environment variable for use as an address from an ordinary program variable.
From include/common.h:
/**
* env_set_addr - Set an environment variable to an address in hex
*
* @varname: Environment variable to set
* @addr: Value to set it to
* @return 0 if ok, 1 on error
*/
ADDENDUM
For some reason, I could n't find this function in the code base I use.
You neglect to mention what version of U-Boot that you are using.
env_set() and its friends were apparently introduced in version 2017.09 to replace setenv() and its friends.
I used similar setenv(), after formatting with sprintf.
Since version 2011.12 the simple setenv() has been augmented with setenv_addr() and/or setenv_hex(), which will convert the unsigned long integer to a string of hex digits for you.
If you are still using a version of U-Boot older than 2011.12, then you will have to do what you describe.
For some reason, I could n't find this function in the code base I use. I used similar setenv(), after formatting with sprintf. It can be done only after environmental settings are inited in the init sequence.
– sniper
Mar 29 at 8:07
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55388972%2fhow-to-set-a-global-variable-value-in-c-to-shell-environment-variable%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
How to set a global variable value in C to shell environment variable?
Use the env_set_addr() function to set an environment variable for use as an address from an ordinary program variable.
From include/common.h:
/**
* env_set_addr - Set an environment variable to an address in hex
*
* @varname: Environment variable to set
* @addr: Value to set it to
* @return 0 if ok, 1 on error
*/
ADDENDUM
For some reason, I could n't find this function in the code base I use.
You neglect to mention what version of U-Boot that you are using.
env_set() and its friends were apparently introduced in version 2017.09 to replace setenv() and its friends.
I used similar setenv(), after formatting with sprintf.
Since version 2011.12 the simple setenv() has been augmented with setenv_addr() and/or setenv_hex(), which will convert the unsigned long integer to a string of hex digits for you.
If you are still using a version of U-Boot older than 2011.12, then you will have to do what you describe.
For some reason, I could n't find this function in the code base I use. I used similar setenv(), after formatting with sprintf. It can be done only after environmental settings are inited in the init sequence.
– sniper
Mar 29 at 8:07
add a comment |
How to set a global variable value in C to shell environment variable?
Use the env_set_addr() function to set an environment variable for use as an address from an ordinary program variable.
From include/common.h:
/**
* env_set_addr - Set an environment variable to an address in hex
*
* @varname: Environment variable to set
* @addr: Value to set it to
* @return 0 if ok, 1 on error
*/
ADDENDUM
For some reason, I could n't find this function in the code base I use.
You neglect to mention what version of U-Boot that you are using.
env_set() and its friends were apparently introduced in version 2017.09 to replace setenv() and its friends.
I used similar setenv(), after formatting with sprintf.
Since version 2011.12 the simple setenv() has been augmented with setenv_addr() and/or setenv_hex(), which will convert the unsigned long integer to a string of hex digits for you.
If you are still using a version of U-Boot older than 2011.12, then you will have to do what you describe.
For some reason, I could n't find this function in the code base I use. I used similar setenv(), after formatting with sprintf. It can be done only after environmental settings are inited in the init sequence.
– sniper
Mar 29 at 8:07
add a comment |
How to set a global variable value in C to shell environment variable?
Use the env_set_addr() function to set an environment variable for use as an address from an ordinary program variable.
From include/common.h:
/**
* env_set_addr - Set an environment variable to an address in hex
*
* @varname: Environment variable to set
* @addr: Value to set it to
* @return 0 if ok, 1 on error
*/
ADDENDUM
For some reason, I could n't find this function in the code base I use.
You neglect to mention what version of U-Boot that you are using.
env_set() and its friends were apparently introduced in version 2017.09 to replace setenv() and its friends.
I used similar setenv(), after formatting with sprintf.
Since version 2011.12 the simple setenv() has been augmented with setenv_addr() and/or setenv_hex(), which will convert the unsigned long integer to a string of hex digits for you.
If you are still using a version of U-Boot older than 2011.12, then you will have to do what you describe.
How to set a global variable value in C to shell environment variable?
Use the env_set_addr() function to set an environment variable for use as an address from an ordinary program variable.
From include/common.h:
/**
* env_set_addr - Set an environment variable to an address in hex
*
* @varname: Environment variable to set
* @addr: Value to set it to
* @return 0 if ok, 1 on error
*/
ADDENDUM
For some reason, I could n't find this function in the code base I use.
You neglect to mention what version of U-Boot that you are using.
env_set() and its friends were apparently introduced in version 2017.09 to replace setenv() and its friends.
I used similar setenv(), after formatting with sprintf.
Since version 2011.12 the simple setenv() has been augmented with setenv_addr() and/or setenv_hex(), which will convert the unsigned long integer to a string of hex digits for you.
If you are still using a version of U-Boot older than 2011.12, then you will have to do what you describe.
edited Mar 30 at 22:08
answered Mar 29 at 7:08
sawdustsawdust
11.1k1 gold badge26 silver badges40 bronze badges
11.1k1 gold badge26 silver badges40 bronze badges
For some reason, I could n't find this function in the code base I use. I used similar setenv(), after formatting with sprintf. It can be done only after environmental settings are inited in the init sequence.
– sniper
Mar 29 at 8:07
add a comment |
For some reason, I could n't find this function in the code base I use. I used similar setenv(), after formatting with sprintf. It can be done only after environmental settings are inited in the init sequence.
– sniper
Mar 29 at 8:07
For some reason, I could n't find this function in the code base I use. I used similar setenv(), after formatting with sprintf. It can be done only after environmental settings are inited in the init sequence.
– sniper
Mar 29 at 8:07
For some reason, I could n't find this function in the code base I use. I used similar setenv(), after formatting with sprintf. It can be done only after environmental settings are inited in the init sequence.
– sniper
Mar 29 at 8:07
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55388972%2fhow-to-set-a-global-variable-value-in-c-to-shell-environment-variable%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
U-Boot supplies several commands to start OS kernels (bootefi, booti, bootm, bootz). The concept of all of these is that the kernel image supplies the entry point. U-Boot can read the file with the OS kernel from lots of different storage media. I can not think of any reason to hard code an entry point. - If you want to port U-Boot to a new hardware you should do it in a way that is compatible with upstream U-Boot and send patches to the developer list to get your hardware mainlined.
– Xypron
Mar 28 at 21:04
@Xypron, thanks,it is NOT hard-coded. The question is once the U-Boot gets the entry point, how it jumps into it. I see same sample boards use 'go' command to jump into the entry point. To follow that, I had to set the entry address in a environmental variable as 'go' is a shell command. If not, other way how U-Boot can jump into the entry point would be helpful.
– sniper
Mar 29 at 4:37
Kernel images already contain a field indicating the entry point. You just load the kernel, the initial ramdisk and the device tree into memory and call the appropriate command to start the kernel passing the loading addresses.
– Xypron
Mar 30 at 16:58