9
0
Fork 0
Commit Graph

455 Commits

Author SHA1 Message Date
Sascha Hauer e0093dcf23 Merge branch 'for-next/misc' 2017-03-13 08:16:44 +01:00
Uwe Kleine-König ce0cc7fee6 tftp: implement forward seeking
Just abuse tftp_read to step forward.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-03-03 11:51:38 +01:00
Uwe Kleine-König 74f750fe65 tftp: trivial code simplification
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-03-03 07:15:14 +01:00
Uwe Kleine-König 2eacc573df lseek: tighten error checking and allow negative offsets for SEEK_END
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-03-03 07:08:40 +01:00
Uwe Kleine-König 711bb18961 lseek: ensure errno is set on failure and return -1
All error paths before calling the driver's lseek callback return -1 and
set errno. Do the same if the callback returns an error.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-03-02 08:38:29 +01:00
Jean-Christophe PLAGNIOL-VILLARD 4c29a9511b efi: move x86 efi boot support to x86 arch
prepare to drop the efi arch as efi boot up is not arch sepecific

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-02-27 08:33:14 +01:00
Jean-Christophe PLAGNIOL-VILLARD 3858b78c1b efi: move bus driver to driver/efi
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-02-24 08:21:33 +01:00
Teresa Remmet 9bdd6c98eb fs: Remove O_TRUNC check for devices when open files
Don't check for the file type here. Devices may have truncate
callbacks. Otherwise the caller should check if O_TRUNC is possible.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-11 08:06:48 +01:00
Teresa Remmet a6785bae3b devfs: Add optional truncate callback for device files
Not all device files have trivial fix device sizes like static
ubi volumes. Here the device file size equals the image size it contains.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-11 08:06:48 +01:00
Lucas Stach 1d117c4888 fs: squashfs: don't reference UBI symbols if UBI isn't compiled in
There is no point in trying to append a UBI root option, if there is
no UBI support in barebox.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-09 13:41:12 +01:00
Renaud Barbier ad43a6de3d ubifs: restore symlink support
In commit a63059d7 of the latest u-boot port, the function that
returns the inode number also resolves symlink. This prevents the
readlink entry point from doing its job and breaks the user command
readlink and the display of symlink with the ls command.
Remove the code following the link to restore original functionality.

Signed-off-by: Renaud Barbier <renaud.barbier@abaco.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-09 13:41:12 +01:00
Sascha Hauer 8129a0a972 fs: squashfs: Enable squashfs XZ support when XZ is enabled
XZ support itself is much more expensive than the squashfs XZ wrapper,
so it makes sense to just compile XZ support into barebox when XZ
support is available. No need to ask the user for it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-10-24 08:21:45 +02:00
Enrico Jorns 8a0fb01161 fs: squashfs: append linux rootarg for ubi volume
If squashfs runs from an ubi volume, append appropriate root kernel
options.

Note that ubiblock support is required in the kernel for that.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-10-24 08:14:41 +02:00
Enrico Jorns 9bcbb51263 Add filetype and detection for squashfs images
This adds `filetype_squashfs` to the list of known filetypes and adds a
detection for squashfs files to file_detect_type(). This currently
matches on the `hsqs` start sequence of an image file.

Additionally, the newly introduced filetype is registered as the type of
the squashfs_driver which allows, for example, to mount squashfs without
the need to specify a type parameter.

This changes enable booting a squashfs with the simple `boot` command
pointing to the location (device) that holds the squashfs.

Note that booting with blspec is limited as the current squashfs driver
is not capable of handling symbolic links.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-10-24 08:14:41 +02:00
Enrico Jorns 6feed0b491 fs: squashfs: port zlib compression support from kernel
As this is the default compression method for squashfs, make this the
default in kconfig selection, too

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-10-24 08:14:40 +02:00
Enrico Jorns c699e731ae fs: squashfs: port lz4 compression support from kernel
Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-10-24 08:14:40 +02:00
Enrico Jorns 38bc0d55cf fs: squashfs: port lzo compression support from kernel
This ports lzo_wrapper from kernel code and adds some minimal adaptions
to make squashfs lzo compression work in barebox.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Tested-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-10-24 08:14:40 +02:00
Enrico Jorns b6ca0241b0 fs: nfs: pick up network interface bootargs parameter
This adds the linux.bootarg device parameter from the network device of
the current nfs connection and adds it to the nfs bootargs line.

This allows booting from nfs without manually setting a ip=dhcp or
ip=<ipaddr> option.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-22 11:30:38 +02:00
Sascha Hauer d60230bded convert users to %pI4
Convert users of ip_to_string() and print_IPaddr() to %pI4 and
remove the now unused functions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-22 11:30:38 +02:00
Sascha Hauer facda5a9cb fs: Check for correct open mode
Check that readonly openen files is not written to and writeonly
files is not read from.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-22 11:59:49 +02:00
Lucas Stach 01cbfdfb3f ubifs: check return pointer properly
ubifs_iget() returns error codes encoded in the pointer,
so the NULL check will never be true.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-07 09:45:35 +02:00
Ronald Zachariah 3dc604d636 fs: ext4: fix symlink read function
From U-Boot commit:

| commit 37f23885e4905ff500a8524328aa3084ac11cdb4
| Author: Ronald Zachariah <rozachar@cisco.com>
| Date:   Thu Apr 28 07:08:34 2016 +0200
|
|     fs: ext4: fix symlink read function
|
|     The function ext4fs_read_symlink was unable to handle a symlink
|     which had target name of exactly 60 characters.
|
|     Signed-off-by: Ronald Zachariah <rozachar@cisco.com>
|     Signed-off-by: Stefan Roese <sr@denx.de>
|     Reviewed-by: Stephen Warren <swarren@nvidia.com>
|     Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-07 09:18:28 +02:00
Lucas Stach ad741d94b3 fs: squashfs: use correct format specifier
Fixes:
fs/squashfs/inode.c: warning: format '%d' expects argument
of type 'int', but argument 3 has type 'long long int'

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-07 08:10:09 +02:00
Sascha Hauer 4cb8e17aa3 Merge branch 'for-next/misc' 2016-05-09 08:49:43 +02:00
Sascha Hauer 55aca0a48c Merge branch 'for-next/include-cleanup' 2016-05-09 08:49:42 +02:00
Du Huanpeng fe03b34fbe whole tree: remove trailing whitespaces
Signed-off-by: Du Huanpeng <u74147@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-21 15:17:52 +02:00
Sascha Hauer cb8cf33ce8 fix erasing/protecting flashes with unspecified size
fixes: 81737c1 mtd: Fix erasing of devices >4GiB

Several places erased a complete flash partition passing ~0 as count to
erase(). With the above commit count to erase was changed from an unsigned
type to a signed type, so the (count > f->size - offset) check in
erase() no longer triggers and the ~0 count is no longer adjusted to the whole
device size. Among other things this results in saveenv failures on NOR
flashes.
This patch fixes this by introducing an explicit macro for erasing the
whole device which is tested for in erase(). All other negative values
are rejected.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Giorgio <giorgio.nicole@arcor.de>
2016-04-19 08:26:51 +02:00
Sascha Hauer 69858c74b2 move make_directory declaration to libfile.h
As a utility function for file handling make_directory() is well
suited for libfile. Move it there.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-15 12:21:45 +02:00
Sascha Hauer 947fb5adf8 string: Fix (v)asprintf prototypes
Our asprintf and vasprintf have different prototypes than the glibc
functions. This causes trouble when we want to share barebox code
with userspace code. Change the prototypes for (v)asprintf to match
the glibc prototypes. Since the current (v)asprintf are convenient
to use change the existing functions to b(v)asprintf.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-15 12:21:45 +02:00
Sascha Hauer db33f32842 include: move crc specific stuff to crc.h
We have a crc.h, so move our crc function prototypes there to further
cleanup common.h.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-15 12:21:44 +02:00
Sascha Hauer ea5aeb986c include: move run_command prototype to command.h
run_command fits much better into command.h, move it there.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-15 12:21:44 +02:00
Du Huanpeng 556459f022 wchar_t: wchar_t should go to stddef.h
according to C99 standard, the definition of wchar_t
should go stddef.h
this patch also remove wchar_t local definition and
use stddef.h instead.

Signed-off-by: Du Huanpeng <u74147@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-14 08:07:13 +02:00
Sascha Hauer 45ad47a301 Merge branch 'for-next/ubifs' 2016-04-08 13:37:28 +02:00
Markus Pargmann 38eae8b2ca fs: umount based on device path and mount path
umount on Linux can be used on a mount pathes and device pathes. This
patch adds this functionality to barebox.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
2016-04-08 13:34:45 +02:00
Alexander Stein a63059d753 ubifs: update implementation from u-boot v2016.03
This updated code supports recovering from unclean unmounts when write
buffer size is larger than 8. Linux uses takes information into
consideration when checking for writes.
The following list shows the changes for each file done compared to
u-boot v2016.03 code.

Makefile
* Add gc.o, do not include header as in u-boot

budget.c:
* Replace __UBOOT__ with __BAREBOX__

debug.c:
* Replace __UBOOT__ with __BAREBOX__
* Remove #include <linux/compat.h>
* Replace current->pid with 0

debug.h
* Replace __UBOOT__ with __BAREBOX__
* Add "0 &&" to ubifs_assert condition check
  U-Boot essentially disabled pr_crit output and dump_stack() is defined
  to do { } while (0), so ubifs_assert does nothing despite condition.

gc.c:
* Replace __UBOOT__ with __BAREBOX__

io.c:
* Replace __UBOOT__ with __BAREBOX__
* Remove #include <linux/compat.h>

key.h:
* No changes

log.c:
* No changes

lprops.c:
* Replace __UBOOT__ with __BAREBOX__

lpt.c
* Replace __UBOOT__ with __BAREBOX__
* Remove #include <linux/compat.h>
* Remove #include <ubi_uboot.h>

lpt_commit.c
* Replace __UBOOT__ with __BAREBOX__
* Remove #include <linux/compat.h>

master.c
* Replace __UBOOT__ with __BAREBOX__
* Remove #include <linux/compat.h>
* Remove #include <ubi_uboot.h>

misc.h
* Replace __UBOOT__ with __BAREBOX__
* Add #ifndef __BAREBOX__ around unneeded ubifs_current_time

orphan.c
* No changes

recovery.c
* Replace __UBOOT__ with __BAREBOX__

replay.c
* Replace __UBOOT__ with __BAREBOX__
* Remove #include <linux/compat.h>

sb.c
* Replace __UBOOT__ with __BAREBOX__
* Remove #include <linux/compat.h>
* Remove #include <ubi_uboot.h>
* rp_uid and rp_gid are still uid_t, not kuid_t, so remove .val

scan.c
* Replace __UBOOT__ with __BAREBOX__

super.c:
* Replaced current->pid with 0
* Replaced __UBOOT__ with __BAREBOX__
* Removed #include <ubi_uboot.h>
* Removed #include <memalign.h>
* Added #include <init.h>
* Replaced malloc_cache_aligned with kzalloc
* Replaced I_LOCK with I_SYNC
* i_uid and i_gid are still uid_t, not kuid_t, so remove .val
* Replaced string "U-Boot" with "Barebox"
* Add #ifndef __BAREBOX__ around open_ubi, sb_test, sb_set, ubifs_mount,
  kill_ubifs_super, ubifs_fs_type
* Do not call ubi_open_volume or ubi_close_volume in ubifs_fill_super
  Those will already be handled in ubifs_probe
* Replaced uboot_ubifs_mount with new ubifs_get_super implementation using
  existing functions alloc_super, alloc_ubifs_info

tnc.c
* Replace __UBOOT__ with __BAREBOX__
* Remove #include <linux/compat.h>

tnc_misc.c
* Replace __UBOOT__ with __BAREBOX__

ubifs-media.h
* Replace __UBOOT__ with __BAREBOX__

ubifs.c:
* Replaced __UBOOT__ with __BAREBOX__
* Adjusted header includes
* Removed DECLARE_GLOBAL_DATA_PTR
* Add static struct z_stream_s variable
* Add struct ubifs_priv delcaration
* Replaced zunzip with deflate_decompress call
* Add ifdef for disabling ZLIB and/or LZO support
* Replaced malloc_cache_aligned with kzalloc
* Added #ifndef __BAREBOX__ around filldir, ubifs_printdir,
  ubifs_set_blk_dev, ubifs_ls, ubifs_exists, ubifs_size, do_readpage,
  ubifs_read, ubifs_close, ubifs_load
* Make parameter filename const char* in ubifs_findfile
* Add UBIFS fs_driver_d implementation
* Add zlib_decomp_init, ubifs_init

ubifs.h:
* Replaced __UBOOT__ with __BAREBOX__
* Adjusted header includes
* Added old #define crc32
* Added helper around kmem*
* Added XATTR_LIST_MAX define
* Added #ifndef __BAREBOX__ around current_fs_time struct inode,
  struct super_block, file_system_type, dentry and friends which barebox
  already has
* Added #ifndef __BAREBOX__ around write_inode in super_operations to avoid
  declaration of writeback_control
* Change rp_uid and rp_gid to uid_t and gui_t
* Added struct device_d to struct ubifs_info
* Added forward declaration of ubifs_get_super

linux/fs.h:
* Make struct inode's i_nlink a union containing a non-const int __i_nlink
  while making i_nlink a const int

linux/fs.h:
* Add s_remove_count

linux/fs.h:
* Convert struct super_block.s_instances and
  struct file_system_type.fs_supers to hlist_head

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-08 13:33:18 +02:00
Sascha Hauer 172af2a30c mtd: Add support for marking blocks as good
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-03-15 08:56:53 +01:00
Sascha Hauer a0fa6e1d2b Merge branch 'for-next/squashfs' 2016-03-11 10:49:50 +01:00
Sascha Hauer 251ae23e9f Merge branch 'for-next/mtd' 2016-03-11 10:49:50 +01:00
Sascha Hauer 034d4ddcb6 Merge branch 'for-next/misc' 2016-03-11 10:49:50 +01:00
Lucas Stach cd0966b813 fs: efi: avoid comparison with uninitialized variable
volume will only be initialized when efi_loaded_image is
set.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-03-04 07:54:58 +01:00
Yegor Yefremov 9eeaa7cce8 fs: add support for SquashFS 4.0
The driver was imported from Linux 4.4.

Current implementation supports only XZ decompressor.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Tested-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-03-02 19:51:48 +01:00
Antony Pavlov b4d8ee6876 fs: fat: fix copy-paste typo
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-23 08:35:35 +01:00
Antony Pavlov 66770e6a02 fs: ext4: make locally used ext4fs_get_indir_block() static
The patch fixes this compiler's warning:

      CC      fs/ext4/ext4_common.o
    fs/ext4/ext4_common.c:130:5: warning: no previous prototype for
    'ext4fs_get_indir_block' [-Wmissing-prototypes]
     int ext4fs_get_indir_block(struct ext2fs_node *node, struct
    ext4fs_indir_block *indir, int blkno)
         ^

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-17 13:50:50 +01:00
Lucas Stach 9a8563b94f ramoops: allow to build without OFTREE support
Ramoops may be useful even without oftree support, as kernels
booted without a DT may have other means to reserve the
ramoops memory.

Fixes:
In function `ramoops_probe':
undefined reference to `of_add_reserve_entry'

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-11 13:56:00 +01:00
Sascha Hauer 81737c1d43 mtd: Fix erasing of devices >4GiB
When a device >4GiB is erased, not only the offset can be bigger
than 4GiB, but also the size. This happens with the simplest command
to erase a device: erase /dev/nand0. Make the size argument a 64bit
type to make this work.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-09 09:32:29 +01:00
Sascha Hauer c073534880 Merge branch 'for-next/ratp' 2016-02-08 08:27:01 +01:00
Sascha Hauer a22f59c178 Merge branch 'for-next/net' 2016-02-08 08:26:45 +01:00
Sascha Hauer 79606b51ed Merge branch 'for-next/linux-headers' 2016-02-08 08:26:36 +01:00
Juergen Borleis b5778f9773 nfs: forward filesystem options to the kernel command line
Using NFS in conjunction with boot spec and the feature to let Barebox
auto generate a kernel command line must keep the options the NFS filesystem
was mounted in Barebox. This patch extends the kernel command line parameter
on demand if something different than the defaults are used.

The command:

barebox:/ boot nfs://myhost//root

expands to the kernel command line:

nfsroot=myhost:/root,v3,tcp

while the command:

barebox:/ boot nfs://myhost:2049//root

expands now to the kernel command line:

nfsroot=myhost:/root,v3,tcp,mountport=2049,port=2049

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-08 08:02:33 +01:00
Sascha Hauer 6c57aca60d ubifs: Fix reading holes in files
When a whole block of 4KiB in an ubifs file is zero then the block is
not stored in the filesystem. read_block() returns -ENOENT in this case,
so this return value must be treated as success.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-04 12:22:41 +01:00