summaryrefslogtreecommitdiffstats
path: root/defaultenv
Commit message (Collapse)AuthorAgeFilesLines
* defaultenv-2: net: fix commentMarco Felsch2019-06-181-1/+1
| | | | | | | | Since commit acc3a3ef90 ("net: environment: update automounts") the tftp automount mechanism uses all network interfaces. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* kbuild: Use ls(1) instead of stat(1) to obtain file sizeMichael Forney2019-05-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | stat(1) is not standardized and different implementations have their own (conflicting) flags for querying the size of a file. ls(1) provides the same information (value of st.st_size) in the 5th column, except when the file is a character or block device. This output is standardized[0]. The -n option turns on -l, which writes lines formatted like "%s %u %s %s %u %s %s\n", <file mode>, <number of links>, <owner name>, <group name>, <size>, <date and time>, <pathname> but instead of writing the <owner name> and <group name>, it writes the numeric owner and group IDs (this avoids /etc/passwd and /etc/group lookups as well as potential field splitting issues). The <size> field is specified as "the value that would be returned for the file in the st_size field of struct stat". To avoid duplicating logic in several locations in the tree, create scripts/file-size.sh and update callers to use that instead of stat(1). [0] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html#tag_20_73_10 Signed-off-by: Michael Forney <forney@google.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> [afa: imported script and adjusted barebox stat(1) callsites] Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv: Convert init script to CSascha Hauer2019-04-241-79/+0
| | | | | | | | | | | It's hard to get more complicated things right in hush. This commit converts the /env/bin/init script to C code. With this we get a better error handling and better control what is being done. If /env/bin/init exists in the environment then it is still executed instead of the corresponding C code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* console: forbid ctrlc during startupSascha Hauer2019-04-241-0/+2
| | | | | | | | | | | | | | | When global.autoboot_abort_key is set to ctrl-c then the user is expected to press ctrl-c to get to the prompt. The user might press ctrl-c before the init script runs the "timeout" command. In this case the init script is aborted at arbitrary places which leads to inconsistent results depending on the place it is aborted. This patch introduces the global.console.ctrlc_allowed variable. When this variable is set to false ctrl-c is ignored entirely. The variable is set to false by default and changed to true in the init script. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv: Fix dependenciesSascha Hauer2019-02-271-1/+3
| | | | | | | | | | | | | The defaultenv should be rebuilt once a file in it has changed. the genenv script always generates the environment file to a temporary file. Only if it has changed to the last target file the temporary file is moved over the target file. This means we always have to call genenv, thus replace "if_changed" with "cmd". With this dependencies are correctly tracked. New or changed files result in new image builds whereas unchanged environments do not unnecessarily result in new images. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv-2: centralize nfs commands for 'net'Vivien Didelot2019-01-211-4/+2
| | | | | | | | | | Setting the nfsroot variable as well as the kernel bootargs for the interface used to reach the server is specific to nfs, which are used only if there's no initramfs to load from tftp. Move these statements within the condition. Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv-2: trigger DHCP before booting 'net'Vivien Didelot2019-01-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some variables may be set from DHCP requests, as shown below: barebox@ZII VF610 Development Board, Rev C:/ echo $global.hostname dev-rev-c barebox@ZII VF610 Development Board, Rev C:/ echo $global.net.server 0.0.0.0 barebox@ZII VF610 Development Board, Rev C:/ dhcp eth0: 100Mbps full duplex link detected T T T eth0: DHCP client bound to address 192.168.203.31 barebox@ZII VF610 Development Board, Rev C:/ echo $global.hostname zii-dev-rev-c-1 barebox@ZII VF610 Development Board, Rev C:/ echo $global.net.server 192.168.203.1 barebox@ZII VF610 Development Board, Rev C:/ These variables are used by the boot/net script, so it is necessary to trigger DHCP before we set the TFTP file paths, otherwise booting from net will fail like below and will need to be triggered twice: running /env/bin/init... Hit m for menu or any key to stop autoboot: 1 booting 'net' eth0: 100Mbps full duplex link detected T T T eth0: DHCP client bound to address 192.168.203.31 WARNING: eth1: No MAC address set. Using random address 8a:ee:18:f5:98:e7 T T T T T T T T T T T T T T T T T T T T could not open /mnt/tftp/none-linux-dev-rev-c: No such file or directory ERROR: Booting 'net' failed: No such file or directory boot: No such file or directory type exit to get to the menu barebox@ZII VF610 Development Board, Rev C:/ boot booting 'net' Loading ARM Linux zImage '/mnt/tftp/none-linux-zii-dev-rev-c-1' Loaded initrd unknown '/mnt/tftp/none-initramfs-zii-dev-rev-c-1' initrd is at 0x82509000-0x835593ff Loading devicetree from '/mnt/tftp/none-oftree-zii-dev-rev-c-1' commandline: console=ttyLP0,115200n8 ip=dhcp Ucompressing Linux... done, booting the kernel. To fix this, bring the interfaces up before setting up tftpboot. Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv: resolve global.net.server before using itSascha Hauer2019-01-071-1/+7
| | | | | | | global.net.server may contain a hostname, so we have to resolve it before using it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv: Pass serverip to nfsroot stringSascha Hauer2019-01-041-1/+1
| | | | | | This is necessary to allow overwriting the NFS server Linux boots from. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv-2: add bnet script to second stage barebox over netOleksij Rempel2018-12-041-0/+7
| | | | | | | | | | Doing cycling barebox boot over the net is a good testing practice. It is possible to detect at least some bugs before flushing it to the system. Suddenly it looks like, it is done not oft enough. So, let's add this option mainline. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv-2: make abort key to stop autoboot configurableOleksij Rempel2018-06-071-3/+14
| | | | | | | | | | | | currently supported only two options: any key and ctrl-c "any key" is default option. To configure it, use: nv autoboot_abort_key=any or nv autoboot_abort_key=ctrl-c Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* console: move global.allow_color handling to C codeSascha Hauer2018-02-223-5/+2
| | | | | | | | | We have global.allow_color, but this is limited to the environment only. Move creation and handling of this variable to C code so that we can add support for colored output to commands/console controlled by the same variable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* build: fix that defaultenv is always rebuiltSam Ravnborg2018-01-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From fcffd0176b3394cc664d9bf5b31b053253323bfb Mon Sep 17 00:00:00 2001 From: Sam Ravnborg <sam@ravnborg.org> Date: Tue, 26 Dec 2017 16:47:16 +0100 Subject: [PATCH 1/4] build: fix that defaultenv is always rebuilt Using following pattern: target: prerequisite FORCE $(call cmd,foo) is almost always wrong. Due to FORCE target will be rebuilt using cmd_foo no mater the timestamps. The following pattern: target: prerequisite FORCE $(call if_changed,foo) Will call cmd_foo only if: - target is not updated - or command to built target has changed But to make this work target must be added to the list af targets built. This can be done by assigning target to extra-y or targets. Use the latter pattern for defaultenv to avoid rebuilding the environmentt for each build. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv-2: set bootargs correctly for network bootSascha Hauer2017-12-152-12/+2
| | | | | | | | | The defaultenv-2 network boot script uses bootargs-ip which hardcodes eth0 as network device. To make this work with other nwetork devices use the "ip_route_get" command to determine the network device used to reach the server. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv: Add README for new network configSascha Hauer2017-12-151-0/+3
| | | | | | | | Network configuration has changed. In case somebody looks to the old /env/network/ directoy place a README there to add a pointer how the new configuration is done. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: environment: update automountsSascha Hauer2017-12-151-2/+2
| | | | | | | | | | | Instead of using "ifup ethx" use "ifup -a" which works with all network interfaces. Also replace "$ethx.serverip" with "$global.net.server". This makes the automount independent of the actual network interface. Remove all board specific /env/init/automount files which were only there to use eth1 instead of the previously hardcoded eth0. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: environment: remove ethx setup filesSascha Hauer2017-12-141-18/+0
| | | | | | | Network configuration is now done with nvvars, so /env/network/eth* files are no longer needed. Remove them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2016-09-132-3/+6
|\
| * Call boot_board from boot, not from init.grodriguez2016-08-242-3/+6
| | | | | | | | | | | | | | | | | | This ensures that any board-specific code that must be run at boot time will be run both when autobooting and when manually running the 'boot' command from the console. Signed-off-by: Guillermo Rodriguez <guille.rodriguez@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | defaultenv-2: remove unused *-menu-add-entry callsSascha Hauer2016-08-261-5/+0
|/ | | | | | | The *-menu-add-entry functions no longer exist in defaultenv-2, so remove the calls to these functions. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv: Unblank cursor at startupAlexander Shiyan2016-08-032-1/+2
| | | | | | | | | | | In some cases, the user program can disable the cursor, for example, Qt4 library do this, so the cursor remains invisible after the restart. The patch adds a command to activate the cursor, by sending DECTECM command to the terminal. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv-2: add automount for nfsUwe Kleine-König2016-04-081-4/+4
| | | | | | | | Automatically mount the path that is also used for net booting by default to /mnt/nfs. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv2: Add automount for RATPFSSascha Hauer2016-01-181-0/+6
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv: boot/net: Boot initramfs from tftp if presentMarkus Pargmann2015-12-011-1/+7
| | | | | | | | | | Use an 'initramfs' file if it exists instead of nfsroot. This offers the possibility to quickly boot complete filesystems as initramfs without the need to flash an SD-card or similar. If the initramfs does not exist, it uses the default nfsroot mechanism. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* login: rework login mechanismSascha Hauer2015-08-281-18/+0
| | | | | | | | | | | | | | We used to have the login functionality in the /env/bin/init script. This is hard to review and it's too easy to break the login functionality with changes to this script. Move the places to ask for a password to C code where we have only a few places where we have to ask for a password. Mainly these are run_shell() and the menutree command. This patch introduces a login() function which will only return if the correct password has been entered. Following calls will return immediately without asking for a password again. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2015-03-091-2/+5
|\
| * defaultenv-2: init: don't call timeout again if the user intervenedMichael Olbrich2015-02-171-2/+5
| | | | | | | | | | | | | | | | | | With autoboot_timeout=0 the second 'timeout' might not get another character even if the user keeps a key pressed. So just reuse the key from the first call. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | defaultenv-2: mtdparts-add: Use new partition parameterSascha Hauer2015-02-121-5/+4
| | | | | | | | | | | | | | mtd devices now have a partition parameter to create mtd partitions. Use it to simplify the mtdparts-add script. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | defaultenv-2: mtdparts-add: remove unused variableSascha Hauer2015-02-121-3/+0
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand: remove automatically created bb devicesSascha Hauer2015-02-121-3/+0
|/ | | | | | | | the bb devices which are created in add_mtd_device() must be removed in del_mtd_device(). Also remove deletion of the bb devices in the mtdparts-add environment file. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv: ignore barebox_zero_envMasahiro Yamada2015-02-111-0/+1
| | | | | | | | Since commit c4c2317fe8a2 (defaultenv: generate force-built-in (zero) environment file), we have this generated file. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv: generate force-built-in (zero) environment fileJan Luebbe2015-02-041-1/+7
| | | | | Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gitignore: move "barebox_default_env*" to subdirectoryMasahiro Yamada2015-02-021-0/+1
| | | | | | | | | | | | | | | | | "barebox_default_env*" is not "Top-level generic files" because they are generated in the defaultenv/ directory since commit 7fa10256c3f4 (defaultenv: Allow multiple defaultenvironment overlays). The comment block of the top-level .gitignore says as follows: # NOTE! Don't add files that are generated in specific # subdirectories here. Add them in the ".gitignore" file # in that subdirectory instead. Let's follow this rule. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv-2: Make use of nonvolatile variablesSascha Hauer2014-11-065-20/+8
| | | | | | | | | | | | | | This moves the variable assignments previously done in /env/config-board to non volatile variables in /env/nv/. This makes the settings adjustable by the user without editing a file. Most of the changes are simple conversions which for many boards makes /env/config-board unnecessary. Some boards had some logic to assign global.boot.default based on the current bootsource. This has been moved to /env/init/bootsource. An additional check is added to not overwrite a nv.boot.default should it exist. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv: Reorder overlay append orderTeresa Gámez2014-09-111-2/+14
| | | | | | | | | | | | The defaultenv_add_base() functions adds the enviroment coming from CONFIG_DEFAULT_ENVIRONMENT_PATH. But this is not only for traditional enviroments, but also for external enviroments in e.g. build systems. The external enviroment should override the enviroment set in the board file and not the other way around. Made sure that external enviroment is always added last. Signed-off-by: Teresa Gámez <t.gamez@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* remove unused boot-menu-add-entrySascha Hauer2014-06-233-15/+0
| | | | | | | The boot-menu-add-entry script no longer exists. Remove it from boot scripts. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ifup'Sascha Hauer2014-05-051-0/+2
|\
| * default environment: force a specific return valueJuergen Borleis2014-04-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit a162dfe50345d3461010759f8a0e79f7e388c140 the ifup command runs this file as a script. Due to a hush misbehave it could happen it returns an error code by accident. For example if the last instructions in this file are: if [ false ]; then echo "friesel" fi the hush returns 1 after running this script instead of 0 and in this case the ifup command fails. I know, the correct fix would be to fix the hush, because it is a generic issue...but how? Signed-off-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand: create bb devices automaticallySascha Hauer2014-04-282-5/+0
|/ | | | | | | | When a mtd device can have bad blocks we want to create a bb device, so do this automatically. This allows us to drop bb device creation from the environment. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defenv-2: replace menu with menutreeSascha Hauer2014-03-2828-149/+48
| | | | | | This makes the menu easier to extend and to maintain. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/nfs'Sascha Hauer2014-03-071-67/+0
|\ | | | | | | | | Conflicts: defaultenv/defaultenv-2-base/bin/ifup
* | defaultenv: Add boot option for DFUSascha Hauer2014-02-283-0/+42
| | | | | | | | | | | | | | | | | | | | | | DFU is for device firmware upgrade, but for development purposes it's sometmes useful to just start a kernel vie DFU. This adds a boot option for doing this and also the corresponding counterpart on the host. With this it's possible to boot a system with: scripts/dfuboot.sh -k linuximage -d dtb -c "root=ubi0:root ubi.mtd=ubi rootfstype=ubifs ignore_loglevel" Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | defaultenv: Allow multiple defaultenvironment overlaysSascha Hauer2014-02-282-0/+172
| | | | | | | | | | | | | | | | | | | | We can compile barebox for multiple boards at once, but currently they all share a single default environment. This patch adds a defaultenv_append() which boards can call to customize the default environment during runtime. Each board now generate default environment snippets using bbenv-y and add them during runtime with defaultenv_append() Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | move defaultenv-2 to defaultenv/defaultenv-2-*Sascha Hauer2014-02-2121-0/+493
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | move defaultenv-1 to defaultenv/defaultenv-1Sascha Hauer2014-02-217-0/+0
|/ | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* dhcp: switch to global var supportJean-Christophe PLAGNIOL-VILLARD2012-10-022-7/+7
| | | | | | | | | | This way you can specify as previously set the dhcp parameter via global.dhcp.xxx and get the result via global.dhcp.xxx This is need for the defaultenv-2 to add the bootp suppport. Use it on defaultenv too to have only one set of var. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* defaultenv: switch hostname to global.hostnameJean-Christophe PLAGNIOL-VILLARD2012-10-021-8/+8
| | | | | | Udpate dhcp with it too. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* defaultenv: enable glovalvar supportJean-Christophe PLAGNIOL-VILLARD2012-10-021-0/+2
| | | | | | | This will allow to do not have 2 set of var for defaultenv and the new defaultenv-2. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* defaultenv/bin/init: skip autoboot if $autoboot_timeout is unsetJan Luebbe2012-06-301-1/+1
| | | | | Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv: don't overwrite $user in configUwe Kleine-König2012-05-131-1/+3
| | | | | | | | | | | | | | | | | This patch prooved to be useful while working with a colleague on a single machine. It allows to switch the user without editing /env/config by just issuing: export user=me . Note, in bash this construct (i.e. an if without body) bails out with: Syntax error: "fi" unexpected but in hush it seems to do the right thing. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>