How is saveenv implemented inside u-boot? - environment-variables

I am trying to figure out which part of code inside the u-boot is responsible for writing to the device from the RAM, when we do a saveenv after setenv. I could find printenv and setenv, but not saveenv. Can someone please shed some light on it?

That depends on what nonvolatile storage the platform is configured for. In any case common/nv_edit.c will be built. But (for example) if env lives in SPI flash, then saveenv() in common/env_sf.c will get built and linked. Do "grep saveenv common/*.c" and you'll see other storage options (eeprom, flash, mmc, nand etc).
CONFIG_ options for any platform are in the appropriate .h under include/configs/. Compare ENV-related options with storage options, that should lead to the right part of code for your platform.

Related

Openstack SDK to resize the instance

I have a requirement to read the input YAML file and resize the servers with the specified configuration like(VCPU, Disk,memory..). Note that the server name is already exist in the environment. I have automated this using python code using the cli command. Reference link for command
https://docs.openstack.org/nova/latest/user/resize.html
But the requirement is to implement this via SDK. Please let me know how to implement this logic via python code by invoking openstack SDK?
Operating System: Ubuntu 16.04
Input Yaml:
Servername1: test1
VCPU: 2
Disk: 4000
Memory: 200
Servername2: test2
VCPU: 1
Disk: 1000
Memory: 100
According to the SDK API documentation, the Compute class (doc) has methods called resize_server, confirm_resize_server and revert_resize_server.
Please let me know how to implement this logic via python code by invoking openstack SDK?
The sequence would be:
Read your yaml file.
Find the existing server that you want to resize.
Lookup flavor1 with the specs that you need (VCPUs, disk, memory, etc).
Check that the server doesn't have that flavor already.
Resize the server
Check server is working correctly. How you do that will depend on the context. But if you skip this step and "confirm" anyway there is a risk that you will lose the existing server.
Either confirm resize or revert resize
For more information how to obtain and make calls on the Compute object, please see "Using OpenStack Compute".
1 - You could also synthesize flavors on the fly, but that is liable to give you a flavor management issue in the long term.

require os, Am i missing somehting?

I come from C-family "mainstream" langages and i'm currently giving a try in Lua .
I made a simple code that check for a user entry and try to open an URL (built with user entry) in the default browser.
Saw the command os.execute("start "URL") that failed, saying that "os is undefined".
Well, seemed to be logical. I then researched the reason and discovered the "require" key word (which seems to act as a LoadLibrary or kind).
This is where I'm lost !
All forums says "yeah yeah just add require os and it will do". But it actually fail !
I obviously suspect that i am missing a "file" or path pointing at that "os" description. And that it's so obvious nobody found useful enough to explain or ask for it.
Can someone explain me what does require, in details ? Which file am i supposed to add (if i really need to ?).
If someone also have an online lesson to advise me, i'll accept it with pleasure. I feel like i'm missing a lot of basics and that's really not a "try to step-up" friendly langage
The standard Lua environment has os available without using require, so you must be using a non-standard Lua environment.
When Lua is embedded into different software, access to libraries like os is usually removed, as it is a security risk. (For example, if you allowed full access to the os library to anyone using Lua on a webserver, it would mean that anyone could run random shell commands on that server.)
If your Lua environment has been altered in this way, then there is a good chance that you will never be able to use the os library whatever you do.

How do I know when to use which hyperledger fabric docker container env variables

I played around with Hyperledger Fabric lately and I'm not able to find a good and exhaustive description of ALL environment variables one can set on the hyperledger fabric docker containers (fabric-orderer, fabric-peer, fabric-ca, fabric-tools, fabric-kafka, ...)
Is there such a documentation? I only find so little about the possible variables and what their different values would do and when one would choose which value; even on the official documentation.
Can anyone provide such a list with explanation? Or can we collect information to create such a list?
Ideally, I would like to have something like the following:
fabric-orderer
ORDERER_GENERAL_GENESISMETHOD
values: file, provisional (default)
file is used when you want provide the genesis block as file to the container (see ORDERER_GENERAL_GENESISFILE)
provisional is used when ...
ORDERER_GENERAL_GENESISFILE
value(s): path to genesis file path
fabric-peer
some env var
... explanation ...
Here's also a sample list of some env variables I've seen other people using and don't why, what it means or if it even works:
ORDERER_GENERAL_LEDGERTYPE
ORDERER_GENERAL_BATCHTIMEOUT
ORDERER_GENERAL_MAXWINDOWSIZE
CONFIGTX_ORDERER_KAFKA_BROKERS
ORDERER_GENERAL_LISTENADDRESS
ORDERER_GENERAL_PORT
ORDERER_GENERAL_HOST
...
I hope asking this question here is ok (it's my first).
Thanks a lot for your help!
This is a great question, and would indeed make a good addition to the docs. It is not currently explicitly documented, but I can explain at least how you can determine what the variables are.
We use viper for managing configuration. We ship a sample configuration with the distribution of the docker images and binaries. As you can see, there are three configuration yaml files: configtx.yaml, core.yaml and orderer.yaml. For each configuration parameter in the yaml file, you can derive an environment variable that can be used to override the value in the config file used at startup. The environment variable name is derived from the filename (e.g. CORE for core.yaml), and underscore-separated capitalization of the nested properties in the config, (e.g. CORE_LOGGING_LEVEL).
The sample apps provided contain docker-compose yaml configurations that leverage most of the properties you might consider leveraging for your own purposes.
Meanwhile, I have created a JIRA to track this and invite contributions to help us flesh out an addition to our documentation that provides a useful reference.

How do I make a simple public read-only WebDAV server with SabreDAV?

I recently began looking into WebDAV, as I found it to be an option for letting me play a Blu-ray folder remotely - i.e. without requiring the viewer to download the whole 24gb ISO first.
Add a WebDAV source in Kodi v18 to a Blu-ray folder - and it actually plays! Very awesome.
The server can also be mounted on Windows with
net use m: http://example.com/webdavfolder/
or in Linux with
sudo mount -t davfs http://example.com/webdavfolder/ /mnt/mywebdav
-and should then (in theory) play with any software media players that supports Blu-ray Disc Java (BD-J), such as PowerDVD and VLC.
vlc bluray:///mnt/mywebdav --bluray-menu
PowerDVD.exe AUTOPLAY BD m:
(Unless of course time-out values has been set too low, which seems to be the case for VLC at the moment).
Anyway, all this is great, except I can't figure out how to make my WebDAV server read-only. Currently anyone can delete files as they wish, and that's of course not optimal.
So far I've only experimented with SabreDAV, because afaik that's the only option I have if I want to keep using my existing webhost. Trying with very minimal setups, because I've read that minimal setups should default to a read-only solution. It just doesn't seem to happen.
I initially used the setup from http://sabre.io/dav/gettingstarted/ and tried removing some lines. Also tried calling chmod 0444 MainFolder -R on the webserver. And I can see that everything does get a read-only attribute. But it changes nothing. It's still possible to delete whatever I want. :-(
What am I missing?
Maybe I'm using the wrong technology for what I want to do? Is there some other/better way of offering a Blu-ray folder for remote viewing? (One that includes the whole experience - i.e. full Java menus etc).
I should probably mention that all of this is of course perfectly legal. It is my own Blu-ray project - not copyright material.
Also: Difficult to decide if this belongs on StackOverflow or SuperUser. I ended up posting it on StackOverflow because SabreDAV is about coding, and because there's no sabredav tag on SuperUser.
You have two options:
Create your own file/directory classes for sabre/dav that simply throw an error when trying to delete. You can basically start with a copy of Sabre\DAV\FS\Directory and Sabre\DAV\FS\File and change the methods that do writing.
Since you're considering just using linux file permissions, really the key thing you are missing is that that 'deleting' is not controlled on the file or directory you're trying to delete. To delete a file or directory in unix, all you need is write permissions on the parent directory. However, I wouldn't recommend going this route as doing this will just cause a weird error in sabre/dav, which might leave clients in a confused state. It would result in a 500 error, not the expected 403 error.

Awesome desktop manager widgets

I came upon this problem before, but only now it really renders awesome desktop manager useless.
I was searching how to connect to Wifi with awesome. Found Gigamo Wifi Widget. Cool, how do I eat it?
The awesome wiki entry on widgets does not really answer this question.
I know my question is very stupid and the answer is somewhere in the documentation but I have no idea how to read it. How and where do I add widgets I find on the Net to my awesome lua files?
EDIT:
when searching where is the rc.lua file henfiber mentioned, I came upon Archlinux wiki on Awesome, which put most important things in one page.
You can always use NetworkManager which is available for installation in most official repos. It contains an applet which creates an icon at your system tray. You can launch the applet at start-up, placing this line in your rc.lua file:
awful.util.spawn("nm-applet")
or you can start it manually from your terminal, writing:
$ nm-applet &
Then you can left-click at the NetworkManager Applet icon at the system tray and select from the list of available wifi access points. Additionally, the Network manager applet allows you to perform more advanced functions, like connecting to VPN.
Also, it is quite easy to use 3rd-party widgets you find in the wiki or in github. It requires these steps:
Download the widget .lua file - let's say it is called
cool_widget.lua
move it in ~/.config/awesome/ so it is :
~/.config/awesome/cool_widget.lua
An alternative is to use the structure
~/.config/awesome/cool_widget/init.lua
it is better when your widget requires more than one files.
Load the widget at the top of your rc.lua file:
cool_widget = require("cool_widget")
Add the widget in a wibox (toolbar) in the same way you add built-in
ones

Resources