diff --git a/Makefile b/Makefile index 09be653..471490b 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ VERSION = 2017 PATCHLEVEL = 05 -SUBLEVEL = 0 +SUBLEVEL = 4 EXTRAVERSION = NAME = None @@ -306,6 +306,9 @@ LDFLAGS_barebox := -Map barebox.map +# Avoid 'Not enough room for program headers' error on binutils 2.28 onwards. +LDFLAGS_barebox += $(call ld-option, --no-dynamic-linker) + # Read KERNELRELEASE from include/config/kernel.release (if it exists) KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) @@ -318,6 +321,7 @@ export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS export CFLAGS CFLAGS_KERNEL export AFLAGS AFLAGS_KERNEL +export LDFLAGS_barebox # Files to ignore in find ... statements diff --git a/common/clock.c b/common/clock.c index 0d581c2..f98176d 100644 --- a/common/clock.c +++ b/common/clock.c @@ -27,7 +27,6 @@ #include #include -static struct clocksource *current_clock; static uint64_t time_ns; /* @@ -53,11 +52,7 @@ .priority = -1, }; -static int dummy_csrc_init(void) -{ - return init_clock(&dummy_cs); -} -pure_initcall(dummy_csrc_init); +static struct clocksource *current_clock = &dummy_cs; static int dummy_csrc_warn(void) { diff --git a/common/globalvar.c b/common/globalvar.c index 1ecf513..fdfaf76 100644 --- a/common/globalvar.c +++ b/common/globalvar.c @@ -99,9 +99,6 @@ const char *val; int ret = 0; - if (!IS_ENABLED(CONFIG_NVVAR)) - return; - if (dev == &nv_device) return; if (dev == &global_device) @@ -168,18 +165,14 @@ static int nv_set(struct device_d *dev, struct param_d *p, const char *val) { - struct param_d *g; int ret; if (!val) val = ""; - g = get_param_by_name(&global_device, p->name); - if (g) { - ret = dev_set_param(&global_device, p->name, val); - if (ret) - return ret; - } + ret = dev_set_param(&global_device, p->name, val); + if (ret) + return ret; free(p->value); p->value = xstrdup(val); @@ -206,6 +199,7 @@ static int __nvvar_add(const char *name, const char *value) { struct param_d *p; + int ret; if (!IS_ENABLED(CONFIG_NVVAR)) return -ENOSYS; @@ -218,6 +212,11 @@ return PTR_ERR(p); } + /* Create corresponding globalvar if it doesn't exist yet */ + ret = globalvar_add_simple(name, value); + if (ret && ret != -EEXIST) + return ret; + if (value) return nv_set(&nv_device, p, value); @@ -394,18 +393,6 @@ return dev_param_set_generic(dev, p, val); } -static void globalvar_nv_sync(const char *name) -{ - const char *val; - - if (!IS_ENABLED(CONFIG_NVVAR)) - return; - - val = dev_get_param(&nv_device, name); - if (val) - dev_set_param(&global_device, name, val); -} - /* * globalvar_add_simple * @@ -416,23 +403,51 @@ struct param_d *param; param = dev_add_param(&global_device, name, globalvar_simple_set, NULL, - 0); + PARAM_GLOBALVAR_UNQUALIFIED); if (IS_ERR(param)) { if (PTR_ERR(param) != -EEXIST) return PTR_ERR(param); } - if (value) - dev_set_param(&global_device, name, value); + if (!value) + return 0; - globalvar_nv_sync(name); + return dev_set_param(&global_device, name, value); +} + +static int globalvar_remove_unqualified(const char *name) +{ + struct param_d *p; + + p = get_param_by_name(&global_device, name); + if (!p) + return 0; + + if (!(p->flags & PARAM_GLOBALVAR_UNQUALIFIED)) + return -EEXIST; + + dev_remove_param(p); return 0; } +static void globalvar_nv_sync(const char *name) +{ + const char *val; + + val = dev_get_param(&nv_device, name); + if (val) + dev_set_param(&global_device, name, val); +} + int globalvar_add_simple_string(const char *name, char **value) { struct param_d *p; + int ret; + + ret = globalvar_remove_unqualified(name); + if (ret) + return ret; p = dev_add_param_string(&global_device, name, NULL, NULL, value, NULL); @@ -449,6 +464,11 @@ const char *format) { struct param_d *p; + int ret; + + ret = globalvar_remove_unqualified(name); + if (ret) + return ret; p = dev_add_param_int(&global_device, name, NULL, NULL, value, format, NULL); @@ -464,6 +484,11 @@ int globalvar_add_simple_bool(const char *name, int *value) { struct param_d *p; + int ret; + + ret = globalvar_remove_unqualified(name); + if (ret) + return ret; p = dev_add_param_bool(&global_device, name, NULL, NULL, value, NULL); @@ -480,6 +505,11 @@ const char * const *names, int max) { struct param_d *p; + int ret; + + ret = globalvar_remove_unqualified(name); + if (ret) + return ret; p = dev_add_param_enum(&global_device, name, NULL, NULL, value, names, max, NULL); @@ -509,6 +539,11 @@ int globalvar_add_simple_ip(const char *name, IPaddr_t *ip) { struct param_d *p; + int ret; + + ret = globalvar_remove_unqualified(name); + if (ret) + return ret; p = dev_add_param_ip(&global_device, name, NULL, NULL, ip, NULL); @@ -548,8 +583,6 @@ const char *env = default_environment_path_get(); int ret; #define TMPDIR "/.env.tmp" - if (!IS_ENABLED(CONFIG_NVVAR)) - return -ENOSYS; if (!nv_dirty || !env) return 0; @@ -610,9 +643,7 @@ int nv_global_complete(struct string_list *sl, char *instr) { nv_global_param_complete(&global_device, sl, instr, 0); - - if (IS_ENABLED(CONFIG_NVVAR)) - nv_global_param_complete(&nv_device, sl, instr, 0); + nv_global_param_complete(&nv_device, sl, instr, 0); return 0; } diff --git a/crypto/digest.c b/crypto/digest.c index 7a8c3c0..bc6de0b 100644 --- a/crypto/digest.c +++ b/crypto/digest.c @@ -272,6 +272,9 @@ goto out_free; size -= now; len += now; + + if (!flags) + buf += now; } if (sig) diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c index 31a9273..51c267e 100644 --- a/drivers/crypto/caam/caamrng.c +++ b/drivers/crypto/caam/caamrng.c @@ -203,8 +203,6 @@ init_job_desc_shared(desc, ctx->sh_desc_dma, sh_len, HDR_SHARE_DEFER | HDR_REVERSE); - bd->addr = (dma_addr_t)bd->buf; - append_seq_out_ptr_intlen(desc, bd->addr, RN_BUF_SIZE, 0); #ifdef DEBUG print_hex_dump(KERN_ERR, "rng job desc@: ", DUMP_PREFIX_OFFSET, 16, 4, @@ -218,7 +216,7 @@ struct buf_data *bd = &ctx->bufs[buf_id]; int err; - bd->buf = dma_alloc(RN_BUF_SIZE); + bd->buf = dma_alloc_coherent(RN_BUF_SIZE, &bd->addr); err = rng_create_job_desc(ctx, buf_id); if (err) diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c index a5886df..334eab8 100644 --- a/drivers/of/of_path.c +++ b/drivers/of/of_path.c @@ -142,7 +142,10 @@ */ if (cdev->master) { is_partition = true; - part_offset = cdev->offset; + if (cdev->mtd) + part_offset = cdev->mtd->master_offset; + else + part_offset = cdev->offset; part_size = cdev->size; pr_debug("%s path %s: is a partition with offset 0x%08llx, size 0x%08llx\n", __func__, path, part_offset, part_size); diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c index 67d01d3..39593c4 100644 --- a/drivers/usb/imx/chipidea-imx.c +++ b/drivers/usb/imx/chipidea-imx.c @@ -276,10 +276,8 @@ * devices which have only one. */ ci->clk = clk_get(dev, NULL); - if (IS_ERR(ci->clk)) - return PTR_ERR(ci->clk); - - clk_enable(ci->clk); + if (!IS_ERR(ci->clk)) + clk_enable(ci->clk); if (of_property_read_bool(dev->device_node, "fsl,usbphy")) { ci->phy = of_phy_get_by_phandle(dev, "fsl,usbphy", 0); diff --git a/images/Makefile b/images/Makefile index adf950a..8818c22 100644 --- a/images/Makefile +++ b/images/Makefile @@ -54,7 +54,7 @@ $(call if_changed_dep,cpp_lds_S) quiet_cmd_elf__ ?= LD $@ - cmd_elf__ ?= $(LD) $(LDFLAGS) --gc-sections -pie \ + cmd_elf__ ?= $(LD) $(LDFLAGS_barebox) --gc-sections -pie \ -e $(2) -Map $@.map $(LDFLAGS_$(@F)) -o $@ \ -T $(pbl-lds) \ --start-group $(barebox-pbl-common) --end-group diff --git a/include/param.h b/include/param.h index 23abb52..91f8aa3 100644 --- a/include/param.h +++ b/include/param.h @@ -6,6 +6,7 @@ #include #define PARAM_FLAG_RO (1 << 0) +#define PARAM_GLOBALVAR_UNQUALIFIED (1 << 1) struct device_d; typedef uint32_t IPaddr_t; @@ -99,8 +100,8 @@ } static inline struct param_d *dev_add_param(struct device_d *dev, const char *name, - int (*set)(struct device_d *dev, struct param_d *p, const char *val), - const char *(*get)(struct device_d *, struct param_d *p), + int (*set)(struct param_d *p, const char *val), + const char *(*get)(struct param_d *p), unsigned long flags) { return ERR_PTR(-ENOSYS); diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index c7faf67..310dcdc 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -148,7 +148,7 @@ # ld-option # Usage: LDFLAGS += $(call ld-option, -X) ld-option = $(call try-run,\ - $(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2)) + $(CC) -x c /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2)) # ar-option # Usage: KBUILD_ARFLAGS := $(call ar-option,D)