9
0
Fork 0

Merge branch 'for-next/misc'

Conflicts:
	arch/arm/boards/chumby_falconwing/falconwing.c
	arch/arm/boards/imx233-olinuxino/imx23-olinuxino.c
	arch/x86/mach-x86.dox
	scripts/setupmbr/setupmbr.c
This commit is contained in:
Sascha Hauer 2014-07-04 17:27:06 +02:00
commit efa4d684d8
61 changed files with 128 additions and 314 deletions

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "Android from SD card"
exit
fi
path=/mnt/sd
global.bootm.image=${path}/android
global.bootm.initrd=${path}/initramfs.cpio.lzo

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "Linux from SD card"
exit
fi
path=/mnt/sd
global.bootm.image=${path}/zImage
initrd=${path}/initrd

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "Android over usb"
exit
fi
path=/mnt/usb
global.bootm.image=${path}/android
global.bootm.initrd=${path}/initramfs.cpio.lzo

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "Linux over usb"
exit
fi
path=/mnt/usb
global.bootm.image=${path}/zImage
initrd=${path}/initrd

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "android (nand)"
exit
fi
global.bootm.image="/dev/nand0.kernel.bb"
global.linux.bootargs.dyn.root="root=/dev/mtdblock1 rootfstype=jffs2 rw init=/init rootdelay=1"
# clean the mtdparts otherwise android does not boot

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "MMC slot"
exit
fi
path="/mnt/mmc"
global.bootm.image="${path}/zimage"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "network (tftp, nfs) (macb)"
exit
fi
ethact eth0
path="/mnt/tftp"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "network (tftp, nfs) (usb ethernet)"
exit
fi
usb -f
ethact eth1

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "MMC (ext3)"
exit
fi
global.bootm.image="/boot/zImage"
#global.bootm.oftree="/boot/oftree"
global.linux.bootargs.dyn.root="root=mmcblk0p2 rootfstype=ext3 rootwait"

View File

@ -1,9 +1,4 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "nand (UBI)"
exit
fi
global.bootm.image="/dev/nand0.kernel.bb"
global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rootfstype=ubifs"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "nand (UBI)"
exit
fi
global.bootm.image="/dev/nand0.kernel.bb"
global.bootm.oftree="/dev/nand0.oftree.bb"
global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rootfstype=ubifs"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "kernel & rootfs on SD card"
exit
fi
global.bootm.image=/boot/uImage
global.bootm.oftree=/boot/oftree
#global.bootm.initrd=<path to initrd>

View File

@ -1,19 +0,0 @@
#!/bin/sh
# change network settings in /env/network/eth0
# change mtd partition settings and automountpoints in /env/init/*
# set to false if you do not want to have colors
global.allow_color=true
# user (used for network filenames)
global.user=none
# timeout in seconds before the default boot entry is started
global.autoboot_timeout=3
# default boot entry (one of /env/boot/*)
global.boot.default=sd
# base bootargs
global.linux.bootargs.base="console=ttyO0,115200n8"

View File

@ -0,0 +1,5 @@
#!/bin/sh
echo -n "changing USB current limit to 1300 mA... "
i2c_write -b 0 -a 0x24 -r 0x01 0x3e
echo "done"

View File

@ -1,9 +1,4 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "NAND Flash"
exit
fi
global.bootm.image="/dev/kernel"
global.linux.bootargs.dyn.root="root=/dev/mtdblock3 ro"

View File

@ -1,9 +1,4 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "NOR Flash"
exit
fi
global.bootm.image="/dev/kernel"
global.linux.bootargs.dyn.root="root=/dev/mtdblock3 ro"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "MMC (ext)"
exit
fi
global.bootm.image="/mnt/disk0.2/boot/zImage-${global.hostname}"
global.bootm.oftree="/mnt/disk0.2/boot/oftree-${global.board.variant}"
global.linux.bootargs.dyn.root="root=/dev/mmcblk0p3 rootfstype=ext3 rootwait"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "MMC"
exit
fi
global.bootm.image="/mnt/mmc/zImage"
global.bootm.oftree="/mnt/mmc/oftree"
global.linux.bootargs.dyn.root="root=mmcblk0p2 rootfstype=ext3 rootwait"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "MMC"
exit
fi
global.bootm.image="/mnt/mmc/zImage"
global.bootm.oftree="/mnt/mmc/oftree"
global.linux.bootargs.dyn.root="root=mmcblk0p2 rootfstype=ext3 rootwait"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "internal harddisk"
exit
fi
path="/mnt/internal-hd0.0"
global.bootm.image="${path}/linuximage"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "left MMC slot"
exit
fi
path="/mnt/mmc-left.0"
global.bootm.image="${path}/linuximage"

View File

@ -70,7 +70,7 @@ mem_initcall(mx23_evk_mem_init);
* If this SD card is also the boot media, we can use the second partition
* for our environment purpose (if present!).
*/
static int register_persistant_environment(void)
static int register_persistent_environment(void)
{
struct cdev *cdev;
@ -116,9 +116,9 @@ static int mx23_evk_devices_init(void)
add_generic_device("mxs_mci", DEVICE_ID_DYNAMIC, NULL, IMX_SSP1_BASE,
0x8000, IORESOURCE_MEM, &mci_pdata);
rc = register_persistant_environment();
rc = register_persistent_environment();
if (rc != 0)
printf("Cannot create the 'env0' persistant "
printf("Cannot create the 'env0' persistent "
"environment storage (%d)\n", rc);
#ifdef CONFIG_USB_GADGET_DRIVER_ARC

View File

@ -1,9 +1,4 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "nand (UBI)"
exit
fi
global.bootm.image="/dev/nand0.kernel.bb"
global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rootfstype=ubifs"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "nand (UBI)"
exit
fi
global.bootm.image="/dev/nand0.kernel.bb"
#global.bootm.oftree="/env/oftree"
bootargs-root-ubi -r root -m nand0.root

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "AHCI"
exit
fi
path="/mnt/ahci"
global.bootm.image="${path}/zImage"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "AHCI (UEFI boot partiton)"
exit
fi
path="/mnt/ahci-boot"
global.bootm.image="${path}/zImage"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "MMC slot"
exit
fi
path="/mnt/mmc"
global.bootm.image="${path}/zimage"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "MMC slot (UEFI boot partiton)"
exit
fi
path="/mnt/mmc-boot"
global.bootm.image="${path}/zimage"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "network (tftp, nfs) (eth0)"
exit
fi
ethact eth0
path="/mnt/tftp"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "network (tftp, nfs) (eth1)"
exit
fi
ethact eth1
path="/mnt/tftp"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "nand (UBI)"
exit
fi
global.bootm.image="/dev/nand0.kernel.bb"
#global.bootm.oftree="/env/oftree"
global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rootfstype=ubifs"

View File

@ -1,9 +1,4 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "NOR Flash"
exit
fi
global.bootm.image="/dev/nor0.kernel"
global.linux.bootargs.dyn.root="root=/dev/mtdblock3 ro"

View File

@ -1,8 +1,3 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "SD Boot"
exit
fi
boot mci0

View File

@ -1,8 +1,3 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "USB Boot"
exit
fi
boot ehci0

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "MMC (ext3)"
exit
fi
global.bootm.image="/boot/zImage"
#global.bootm.oftree="/boot/oftree"
global.linux.bootargs.dyn.root="root=mmcblk0p2 rootfstype=ext3 rootwait"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "Kernel:nand;rootfs:nand"
exit
fi
global.bootm.image="/dev/nand0.kernel.bb"
#global.bootm.oftree="/env/oftree"
bootargs-ip

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "MMC (ext3)"
exit
fi
global.bootm.image="/mnt/kernel/linuximage"
#global.bootm.oftree="/boot/oftree"
bootargs-ip

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "kernel & rootfs on SD card"
exit
fi
global.bootm.image=/boot/uImage
#global.bootm.oftree=/boot/oftree
global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootfstype=ext3 rootwait"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "nand (UBI)"
exit
fi
global.bootm.image="/dev/nand0.kernel.bb"
#global.bootm.oftree="/env/oftree"
global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root,2048 rootfstype=ubifs"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "SPI NOR Flash"
exit
fi
global.bootm.image="/dev/m25p0.kernel"
# Use rootfs form NAND for now as rootfs partition < 4MB

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "nand (UBI)"
exit
fi
global.bootm.image="/dev/nand0.kernel.bb"
#global.bootm.oftree="/env/oftree"
global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rootfstype=ubifs"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "nand (UBI)"
exit
fi
global.bootm.image="/dev/nand0.kernel.bb"
#global.bootm.oftree="/env/oftree"
global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rootfstype=ubifs"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "nand (UBI)"
exit
fi
global.bootm.image="/dev/nand0.kernel.bb"
#global.bootm.oftree="/env/oftree"
global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rootfstype=ubifs"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "nand (UBI)"
exit
fi
global.bootm.image="/dev/nand0.kernel.bb"
#global.bootm.oftree="/env/oftree"
global.linux.bootargs.dyn.root="root=ubi0:rootfs ubi.mtd=nand0.rootfs rootfstype=ubifs"

View File

@ -82,11 +82,11 @@ ALL PARAMETERS ARE ALL LONGWORDS (FOUR BYTES EACH).
sdma->IntPend = (1 << tasknum); \
}
/* get interupt pending bit of a task */
/* get interrupt pending bit of a task */
#define SDMA_GET_PENDINGBIT(tasknum) \
((*(vu_long *)(MPC5XXX_SDMA + 0x14)) & (1<<(tasknum)))
/* get interupt mask bit of a task */
/* get interrupt mask bit of a task */
#define SDMA_GET_MASKBIT(tasknum) \
((*(vu_long *)(MPC5XXX_SDMA + 0x18)) & (1<<(tasknum)))

View File

@ -12,4 +12,11 @@
#include <asm-generic/bitops/hweight.h>
#include <asm-generic/bitops/ops.h>
#define set_bit(x, y) __set_bit(x, y)
#define clear_bit(x, y) __clear_bit(x, y)
#define change_bit(x, y) __change_bit(x, y)
#define test_and_set_bit(x, y) __test_and_set_bit(x, y)
#define test_and_clear_bit(x, y) __test_and_clear_bit(x, y)
#define test_and_change_bit(x, y) __test_and_change_bit(x, y)
#endif

View File

@ -85,7 +85,7 @@ SECTIONS
boot_disk = .;
BYTE(0x00); /* boot disk number (provided by the BIOS)
/* information about the persistant environment storage */
/* information about the persistent environment storage */
. = PATCH_AREA + PATCH_AREA_PERS_START;
pers_env_storage = .;
LONG(0x00000000); /* LBA start lower */

View File

@ -31,27 +31,27 @@
#define PATCH_AREA_BOOT_DEV 16
/**
* Offset where to store information about the persistant environment storage
* Offset where to store information about the persistent environment storage
* It points to an LBA number (8 bytes) and defines the first sector of this
* storage on disk.
*/
#define PATCH_AREA_PERS_START 20
/**
* Offset where to store information about the persistant environment storage
* Offset where to store information about the persistent environment storage
* It points to a short number (2 bytes) and defines the sector count of this
* storage on disk.
*/
#define PATCH_AREA_PERS_SIZE 28
/**
* Offset where to store information about the persistant environment storage
* Offset where to store information about the persistent environment storage
* drive number (BIOS number, 1 byte)
*/
#define PATCH_AREA_PERS_DRIVE 30
/**
* Mark the persistant environment as not used
* Mark the persistent environment as not used
*/
#define PATCH_AREA_PERS_SIZE_UNUSED 0x000

View File

@ -151,7 +151,7 @@ static int bootscript_scan_path(struct blspec *blspec, const char *path)
glob(files, 0, NULL, &globb);
for (i = 0; i < globb.gl_pathc; i++) {
char *bootscript_path = globb.gl_pathv[i];;
char *bootscript_path = globb.gl_pathv[i];
if (*basename(bootscript_path) == '.')
continue;

View File

@ -53,6 +53,8 @@ int ls(const char *path, ulong flags)
char tmp[PATH_MAX];
struct stat s;
struct string_list sl;
struct string_list *entry;
int ret;
string_list_init(&sl);
@ -71,51 +73,51 @@ int ls(const char *path, ulong flags)
if (!dir)
return -errno;
while ((d = readdir(dir))) {
sprintf(tmp, "%s/%s", path, d->d_name);
if (flags & LS_COLUMN) {
string_list_add_sorted(&sl, d->d_name);
} else {
if (lstat(tmp, &s))
goto out;
ls_one(d->d_name, tmp, &s);
}
}
while ((d = readdir(dir)))
string_list_add_sorted(&sl, d->d_name);
closedir(dir);
if (flags & LS_COLUMN) {
string_list_print_by_column(&sl);
string_list_free(&sl);
} else {
string_list_for_each_entry(entry, &sl) {
sprintf(tmp, "%s/%s", path, entry->str);
ret = lstat(tmp, &s);
if (ret) {
printf("%s: %s\n", tmp, strerror(-ret));
continue;
}
ls_one(entry->str, tmp, &s);
}
}
if (!(flags & LS_RECURSIVE))
return 0;
goto out;
dir = opendir(path);
if (!dir) {
errno = ENOENT;
return -ENOENT;
}
while ((d = readdir(dir))) {
if (!strcmp(d->d_name, "."))
string_list_for_each_entry(entry, &sl) {
if (!strcmp(entry->str, "."))
continue;
if (!strcmp(d->d_name, ".."))
if (!strcmp(entry->str, ".."))
continue;
sprintf(tmp, "%s/%s", path, d->d_name);
sprintf(tmp, "%s/%s", path, entry->str);
ret = lstat(tmp, &s);
if (ret) {
printf("%s: %s\n", tmp, strerror(-ret));
continue;
}
if (lstat(tmp, &s))
goto out;
if (s.st_mode & S_IFDIR) {
char *norm = normalise_path(tmp);
ls(norm, flags);
free(norm);
}
}
out:
closedir(dir);
string_list_free(&sl);
return 0;
}
@ -127,6 +129,9 @@ static int do_ls(int argc, char *argv[])
ulong flags = LS_COLUMN;
struct string_list sl;
if (!strcmp(argv[0], "ll"))
flags &= ~LS_COLUMN;
while((opt = getopt(argc, argv, "RCl")) > 0) {
switch(opt) {
case 'R':
@ -219,3 +224,11 @@ BAREBOX_CMD_START(ls)
BAREBOX_CMD_GROUP(CMD_GRP_FILE)
BAREBOX_CMD_HELP(cmd_ls_help)
BAREBOX_CMD_END
BAREBOX_CMD_START(ll)
.cmd = do_ls,
BAREBOX_CMD_DESC("list a file or directory with details")
BAREBOX_CMD_OPTS("[-lCR] [FILEDIR...]")
BAREBOX_CMD_GROUP(CMD_GRP_FILE)
BAREBOX_CMD_HELP(cmd_ls_help)
BAREBOX_CMD_END

View File

@ -115,14 +115,14 @@ static int show_basic_mii(struct mii_bus *mii, struct phy_device *phydev,
for (i = 0; i < 32; i++)
mii_val[i] = mii->read(mii, phydev->addr, i);
printf("%s: %s%d: ", phydev->cdev.name,
mii->parent->name, mii->parent->id);
if (mii_val[MII_BMCR] == 0xffff || mii_val[MII_BMSR] == 0x0000) {
fprintf(stderr, " No MII transceiver present!.\n");
return -1;
}
printf("%s: %s%d: ", phydev->cdev.name,
mii->parent->name, mii->parent->id);
/* Descriptive rename. */
bmcr = mii_val[MII_BMCR];
bmsr = mii_val[MII_BMSR];

View File

@ -71,7 +71,7 @@ struct resource *__request_region(struct resource *parent,
goto ok;
if (start > r->end)
continue;
debug("%s: 0x%08llx:0x%08llx conflicts with 0x%08llx:0x%08llx\n",
pr_warn("%s: 0x%08llx:0x%08llx conflicts with 0x%08llx:0x%08llx\n",
__func__,
(unsigned long long)start,
(unsigned long long)end,

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "network (tftp, nfs)"
exit
fi
path="/mnt/tftp"
global.bootm.image="${path}/${global.user}-linux-${global.hostname}"

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "<menu text here>"
exit
fi
global.bootm.image=<path to image>
#global.bootm.oftree=<path to oftree>
#global.bootm.initrd=<path to initrd>

View File

@ -1,10 +1,5 @@
#!/bin/sh
if [ "$1" = menu ]; then
boot-menu-add-entry "$0" "Device Firmware upgrade (DFU)"
exit
fi
if [ -d /dfutmp ]; then
rm -r /dfutmp
fi

View File

@ -29,4 +29,7 @@ static inline void string_list_free(struct string_list *sl)
}
}
#define string_list_for_each_entry(entry, sl) \
list_for_each_entry(entry, &(sl)->list, list)
#endif /* __STRINGLIST_H */

View File

@ -73,6 +73,8 @@ static int lz4_uncompress(const char *source, char *dest, int osize)
len = *ip++;
for (; len == 255; length += 255)
len = *ip++;
if (unlikely(length > (size_t)(length + len)))
goto _output_error;
length += len;
}
@ -107,6 +109,8 @@ static int lz4_uncompress(const char *source, char *dest, int osize)
if (length == ML_MASK) {
for (; *ip == 255; length += 255)
ip++;
if (unlikely(length > (size_t)(length + *ip)))
goto _output_error;
length += *ip++;
}
@ -156,7 +160,7 @@ static int lz4_uncompress(const char *source, char *dest, int osize)
/* write overflow error detected */
_output_error:
return (int) (-(((char *)ip) - source));
return -1;
}
static int lz4_uncompress_unknownoutputsize(const char *source, char *dest,

View File

@ -16,14 +16,34 @@
#include <lzo.h>
#include "lzodefs.h"
#define HAVE_IP(x) ((size_t)(ip_end - ip) >= (size_t)(x))
#define HAVE_OP(x) ((size_t)(op_end - op) >= (size_t)(x))
#define NEED_IP(x) if (!HAVE_IP(x)) goto input_overrun
#define NEED_OP(x) if (!HAVE_OP(x)) goto output_overrun
#define TEST_LB(m_pos) if ((m_pos) < out) goto lookbehind_overrun
#define HAVE_IP(t, x) \
(((size_t)(ip_end - ip) >= (size_t)(t + x)) && \
(((t + x) >= t) && ((t + x) >= x)))
#define HAVE_OP(t, x) \
(((size_t)(op_end - op) >= (size_t)(t + x)) && \
(((t + x) >= t) && ((t + x) >= x)))
#define NEED_IP(t, x) \
do { \
if (!HAVE_IP(t, x)) \
goto input_overrun; \
} while (0)
#define NEED_OP(t, x) \
do { \
if (!HAVE_OP(t, x)) \
goto output_overrun; \
} while (0)
#define TEST_LB(m_pos) \
do { \
if ((m_pos) < out) \
goto lookbehind_overrun; \
} while (0)
int lzo1x_decompress_safe(const unsigned char *in, size_t in_len,
unsigned char *out, size_t *out_len)
unsigned char *out, size_t *out_len)
{
unsigned char *op;
const unsigned char *ip;
@ -55,14 +75,14 @@ int lzo1x_decompress_safe(const unsigned char *in, size_t in_len,
while (unlikely(*ip == 0)) {
t += 255;
ip++;
NEED_IP(1);
NEED_IP(1, 0);
}
t += 15 + *ip++;
}
t += 3;
copy_literal_run:
#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
if (likely(HAVE_IP(t + 15) && HAVE_OP(t + 15))) {
if (likely(HAVE_IP(t, 15) && HAVE_OP(t, 15))) {
const unsigned char *ie = ip + t;
unsigned char *oe = op + t;
do {
@ -78,8 +98,8 @@ copy_literal_run:
} else
#endif
{
NEED_OP(t);
NEED_IP(t + 3);
NEED_OP(t, 0);
NEED_IP(t, 3);
do {
*op++ = *ip++;
} while (--t > 0);
@ -92,7 +112,7 @@ copy_literal_run:
m_pos -= t >> 2;
m_pos -= *ip++ << 2;
TEST_LB(m_pos);
NEED_OP(2);
NEED_OP(2, 0);
op[0] = m_pos[0];
op[1] = m_pos[1];
op += 2;
@ -116,10 +136,10 @@ copy_literal_run:
while (unlikely(*ip == 0)) {
t += 255;
ip++;
NEED_IP(1);
NEED_IP(1, 0);
}
t += 31 + *ip++;
NEED_IP(2);
NEED_IP(2, 0);
}
m_pos = op - 1;
next = get_unaligned_le16(ip);
@ -134,10 +154,10 @@ copy_literal_run:
while (unlikely(*ip == 0)) {
t += 255;
ip++;
NEED_IP(1);
NEED_IP(1, 0);
}
t += 7 + *ip++;
NEED_IP(2);
NEED_IP(2, 0);
}
next = get_unaligned_le16(ip);
ip += 2;
@ -151,7 +171,7 @@ copy_literal_run:
#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
if (op - m_pos >= 8) {
unsigned char *oe = op + t;
if (likely(HAVE_OP(t + 15))) {
if (likely(HAVE_OP(t, 15))) {
do {
COPY8(op, m_pos);
op += 8;
@ -161,7 +181,7 @@ copy_literal_run:
m_pos += 8;
} while (op < oe);
op = oe;
if (HAVE_IP(6)) {
if (HAVE_IP(6, 0)) {
state = next;
COPY4(op, ip);
op += next;
@ -169,7 +189,7 @@ copy_literal_run:
continue;
}
} else {
NEED_OP(t);
NEED_OP(t, 0);
do {
*op++ = *m_pos++;
} while (op < oe);
@ -178,7 +198,7 @@ copy_literal_run:
#endif
{
unsigned char *oe = op + t;
NEED_OP(t);
NEED_OP(t, 0);
op[0] = m_pos[0];
op[1] = m_pos[1];
op += 2;
@ -191,15 +211,15 @@ match_next:
state = next;
t = next;
#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
if (likely(HAVE_IP(6) && HAVE_OP(4))) {
if (likely(HAVE_IP(6, 0) && HAVE_OP(4, 0))) {
COPY4(op, ip);
op += t;
ip += t;
} else
#endif
{
NEED_IP(t + 3);
NEED_OP(t);
NEED_IP(t, 3);
NEED_OP(t, 0);
while (t > 0) {
*op++ = *ip++;
t--;

View File

@ -64,7 +64,7 @@ int string_list_contains(struct string_list *sl, char *str)
{
struct string_list *entry;
list_for_each_entry(entry, &sl->list, list) {
string_list_for_each_entry(entry, sl) {
if (!strcmp(str, entry->str))
return 1;
}
@ -77,7 +77,7 @@ void string_list_print_by_column(struct string_list *sl)
int len = 0, num, i;
struct string_list *entry;
list_for_each_entry(entry, &sl->list, list) {
string_list_for_each_entry(entry, sl) {
int l = strlen(entry->str) + 4;
if (l > len)
len = l;
@ -91,7 +91,7 @@ void string_list_print_by_column(struct string_list *sl)
num = 1;
i = 0;
list_for_each_entry(entry, &sl->list, list) {
string_list_for_each_entry(entry, sl) {
if (!(++i % num))
printf("%s\n", entry->str);
else

View File

@ -140,7 +140,7 @@ static void invalidate_daps(struct DAPS *sector)
* Create the indirect sector with the DAPS entries
* @param daps_table Where to store the entries
* @param size Size of the whole image in bytes
* @param pers_sector_count Count of sectors to skip after MBR for the persistant environment storage
* @param pers_sector_count Count of sectors to skip after MBR for the persistent environment storage
* @return 0 on success
*
* This routine calculates the DAPS entries for the case the whole
@ -326,10 +326,10 @@ static int check_for_space(const void *hd_image, off_t size)
}
/**
* Setup the persistant environment storage information
* Setup the persistent environment storage information
* @param patch_area Where to patch
* @param pers_sector_start Start sector of the persistant environment storage
* @param pers_sector_count Count of sectors for the persistant environment storage
* @param pers_sector_start Start sector of the persistent environment storage
* @param pers_sector_count Count of sectors for the persistent environment storage
* @return 0 on success
*/
static int store_pers_env_info(void *patch_area, uint64_t pers_sector_start, long pers_sector_count)
@ -355,7 +355,7 @@ static int store_pers_env_info(void *patch_area, uint64_t pers_sector_start, lon
* Prepare the MBR and indirect sector for runtime
* @param fd_barebox barebox image to use
* @param fd_hd Hard disk image to prepare
* @param pers_sector_count Count of sectors to skip after MBR for the persistant environment storage
* @param pers_sector_count Count of sectors to skip after MBR for the persistent environment storage
* @return 0 on success
*
* This routine expects a prepared hard disk image file with a partition table
@ -390,7 +390,7 @@ static int barebox_overlay_mbr(int fd_barebox, int fd_hd, long pers_sector_count
}
/*
* the persistant environment storage is in front of the main
* the persistent environment storage is in front of the main
* barebox image. To handle both, we need more space in front of the
* the first partition.
*/
@ -415,7 +415,7 @@ static int barebox_overlay_mbr(int fd_barebox, int fd_hd, long pers_sector_count
/*
* embed the barebox main image into the disk drive image,
* but keep the persistant environment storage untouched
* but keep the persistent environment storage untouched
* (if defined), e.g. store the main image behind this special area.
*/
memcpy(hd_image + ((pers_sector_count + 1) * SECTOR_SIZE),
@ -471,7 +471,7 @@ static void print_usage(const char *pname)
{
printf("%s: Preparing a hard disk image for boot with barebox on x86.\n", pname);
printf("Usage is\n %s [options] -m <barebox image> -d <hd image>\n", pname);
printf(" [options] are:\n -s <count> sector count of the persistant environment storage\n");
printf(" [options] are:\n -s <count> sector count of the persistent environment storage\n");
printf(" <barebox image> barebox's boot image file\n");
printf(" <hd image> HD image to store the barebox image\n");
printf(" If no '-s <x>' was given, barebox occupies sectors 0 to n, else sector 0 and x+1 to n\n");

1
scripts/tegra/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
cbootimage