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;








-1















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.










share|improve this question
























  • 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

















-1















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.










share|improve this question
























  • 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













-1












-1








-1








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.










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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

















  • 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












1 Answer
1






active

oldest

votes


















0
















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.






share|improve this answer



























  • 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










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
);



);













draft saved

draft discarded


















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









0
















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.






share|improve this answer



























  • 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















0
















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.






share|improve this answer



























  • 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













0














0










0










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.






share|improve this answer
















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.







share|improve this answer














share|improve this answer



share|improve this answer








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

















  • 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








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.



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현