Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
commit
e331e1504f
@ -36,20 +36,6 @@ define Download/tfa-files
|
||||
HASH:=689b097e4531d3eeca0c477675ab3dc3cace6ba4ed8a339116a9ede6537839d7
|
||||
endef
|
||||
|
||||
define Download/mt7622-header-emmc
|
||||
URL:=https://raw.githubusercontent.com/frank-w/BPI-R64-ATF/a36efa5f7435b8079479d13b562fedc0aa0d42f0
|
||||
URL_FILE:=header_emmc.bin
|
||||
FILE:=mt7622-header_emmc.bin
|
||||
HASH:=0a09c55d90c5fc375c59468a4331555f77cbc3e1dd107ca83b5b8c9625f38d8c
|
||||
endef
|
||||
|
||||
define Download/mt7622-header-sdmmc
|
||||
URL:=https://raw.githubusercontent.com/frank-w/BPI-R64-ATF/a36efa5f7435b8079479d13b562fedc0aa0d42f0
|
||||
URL_FILE:=header_sdmmc.bin
|
||||
FILE:=mt7622-header_sdmmc.bin
|
||||
HASH:=242908c04e25289d25ba9fab61a1930425af173051c43d275d1ac9877d6accb1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/Default
|
||||
BUILD_TARGET:=mediatek
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
@ -121,12 +107,6 @@ TFA_MAKE_FLAGS += BOOT_DEVICE=$(BOOT_DEVICE) all
|
||||
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
ifeq ($(BOOT_DEVICE),emmc)
|
||||
$(eval $(call Download,mt7622-header-emmc))
|
||||
endif
|
||||
ifeq ($(BOOT_DEVICE),sdmmc)
|
||||
$(eval $(call Download,mt7622-header-sdmmc))
|
||||
endif
|
||||
$(eval $(call Download,tfa-files))
|
||||
# replace 'bromimage' tool by static version
|
||||
$(TAR) -vxzf $(DL_DIR)/$(BLOBS_TARBALL) --wildcards \
|
||||
|
||||
@ -5,9 +5,9 @@ PKG_RELEASE=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git
|
||||
PKG_MIRROR_HASH:=97dc4eba01cf2c5d6a6d0db3747e0cdc0d95cb87e51b3115272e7d3e69a8b255
|
||||
PKG_SOURCE_DATE:=2020-12-12
|
||||
PKG_SOURCE_VERSION:=357877693ca363b12e6e7e14d345639b2440cd07
|
||||
PKG_MIRROR_HASH:=042398d1295ac892e09c6d2e8f68861c6f859fc6752e809a114f451834e7a05e
|
||||
PKG_SOURCE_DATE:=2021-03-02
|
||||
PKG_SOURCE_VERSION:=2e52c7e9a90ab7ba1cf9d2986d1505ca5d184698
|
||||
PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE))
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
|
||||
@ -12,9 +12,9 @@ PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/fstools.git
|
||||
PKG_MIRROR_HASH:=ce8b2ecff1e4f5e0c45b707a4d34a34f313362edf52327ac255909f709d07182
|
||||
PKG_SOURCE_DATE:=2021-02-27
|
||||
PKG_SOURCE_VERSION:=bad1835f27ec31dbc30060b03cc714212275168a
|
||||
PKG_MIRROR_HASH:=d9b6a24bd8c03b89178141926db17240fe72f52af3d11f70baca352415c7214d
|
||||
PKG_SOURCE_DATE:=2021-03-02
|
||||
PKG_SOURCE_VERSION:=19d7d9313d9e868669ae6cb1bf9e840ba2461b41
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
@ -12,9 +12,9 @@ PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
|
||||
PKG_SOURCE_DATE:=2021-02-23
|
||||
PKG_SOURCE_VERSION:=37eed131e9967a35f47bacb3437a9d3c8a57b3f4
|
||||
PKG_MIRROR_HASH:=2b0131ff9055ccf987cbeb5f36c2c2585dc780999df6be312fbbbcd61ce676d4
|
||||
PKG_SOURCE_DATE:=2021-03-02
|
||||
PKG_SOURCE_VERSION:=64e9f3a4ef61b53f72d0c9cf03da109e43b6700e
|
||||
PKG_MIRROR_HASH:=59e1ea81e16b865c8e1bf16d747fd802285fd6bf8d689065e48dc1dee07447fb
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
@ -1,18 +1,22 @@
|
||||
From cf0d2fbaae9e962d91a321de75e0d4f9f9ccbdfe Mon Sep 17 00:00:00 2001
|
||||
From 095b4dabff2a929cefd330110c5c578956213188 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
|
||||
Date: Thu, 21 Jan 2021 18:17:37 +0100
|
||||
Subject: [PATCH] nand: brcmnand: fix OOB R/W with Hamming ECC
|
||||
Date: Wed, 24 Feb 2021 09:02:10 +0100
|
||||
Subject: [PATCH] mtd: rawnand: brcmnand: fix OOB R/W with Hamming ECC
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Hamming ECC doesn't cover the OOB data, so reading or writing OOB shall
|
||||
always be done without ECC enabled.
|
||||
This is a problem when adding JFFS2 cleanmarkers to erased blocks. When JFFS2
|
||||
This is a problem when adding JFFS2 cleanmarkers to erased blocks. If JFFS2
|
||||
clenmarkers are added to the OOB with ECC enabled, OOB bytes will be changed
|
||||
from ff ff ff to 00 00 00, reporting incorrect ECC errors.
|
||||
|
||||
Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller")
|
||||
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
Acked-by: Brian Norris <computersforpeace@gmail.com>
|
||||
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
Link: https://lore.kernel.org/linux-mtd/20210224080210.23686-1-noltari@gmail.com
|
||||
---
|
||||
drivers/mtd/nand/raw/brcmnand/brcmnand.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
@ -16,21 +16,20 @@ endef
|
||||
|
||||
define Build/mt7622-gpt
|
||||
cp $@ $@.tmp || true
|
||||
ptgen -g -o $@.tmp -h 4 -s 31 -a 1 -l 1024 -g \
|
||||
-t 0xef \
|
||||
ptgen -g -o $@.tmp -a 1 -l 1024 \
|
||||
$(if $(findstring sdmmc,$1), \
|
||||
-N bl2 -r -p 512k@512k \
|
||||
-H \
|
||||
-t 0x83 -N bl2 -r -p 512k@512k \
|
||||
) \
|
||||
-N fip -r -p 1M@2M \
|
||||
-N ubootenv -r -p 1M@4M \
|
||||
-N recovery -r -p 32M@6M \
|
||||
-t 0xef -N fip -r -p 1M@2M \
|
||||
-t 0x83 -N ubootenv -r -p 1M@4M \
|
||||
-N recovery -r -p 32M@6M \
|
||||
$(if $(findstring sdmmc,$1), \
|
||||
-t 0x2e -N production -p 216M@40M \
|
||||
) \
|
||||
$(if $(findstring emmc,$1), \
|
||||
-t 0x2e -N production -p 980M@40M \
|
||||
)
|
||||
dd if=$(STAGING_DIR_IMAGE)/mt7622-header_$1.bin bs=512 count=1 of=$@.tmp conv=notrunc
|
||||
cat $@.tmp >> $@
|
||||
rm $@.tmp
|
||||
endef
|
||||
@ -52,8 +51,8 @@ define Device/bananapi_bpi-r64
|
||||
bl2 emmc-2ddr | pad-to 512k | bl2 sdmmc-2ddr | pad-to 1M | bl31-uboot bananapi_bpi-r64-emmc | pad-to 2M |\
|
||||
bl31-uboot bananapi_bpi-r64-sdmmc | pad-to 6M
|
||||
KERNEL := kernel-bin | gzip
|
||||
KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 128k
|
||||
IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata
|
||||
KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd | pad-to 128k
|
||||
IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata
|
||||
endef
|
||||
TARGET_DEVICES += bananapi_bpi-r64
|
||||
|
||||
|
||||
@ -94,6 +94,7 @@ typedef struct {
|
||||
#define GPT_ENTRY_SIZE 128
|
||||
#define GPT_ENTRY_MAX 128
|
||||
#define GPT_ENTRY_NAME_SIZE 72
|
||||
#define GPT_SIZE GPT_ENTRY_SIZE * GPT_ENTRY_MAX / DISK_SECTOR_SIZE
|
||||
|
||||
#define GPT_ATTR_PLAT_REQUIRED BIT(0)
|
||||
#define GPT_ATTR_EFI_IGNORE BIT(1)
|
||||
@ -120,9 +121,11 @@ struct pte {
|
||||
};
|
||||
|
||||
struct partinfo {
|
||||
unsigned long actual_start;
|
||||
unsigned long start;
|
||||
unsigned long size;
|
||||
int type;
|
||||
int hybrid;
|
||||
char *name;
|
||||
short int required;
|
||||
guid_t guid;
|
||||
@ -311,7 +314,7 @@ static int gen_ptable(uint32_t signature, int nr)
|
||||
if (parts[i].start != 0) {
|
||||
if (parts[i].start * 2 < start) {
|
||||
fprintf(stderr, "Invalid start %ld for partition %d!\n",
|
||||
parts[i].start, i, start);
|
||||
parts[i].start, i);
|
||||
return ret;
|
||||
}
|
||||
start = parts[i].start * 2;
|
||||
@ -369,7 +372,7 @@ fail:
|
||||
/* check the partition sizes and write the guid partition table */
|
||||
static int gen_gptable(uint32_t signature, guid_t guid, unsigned nr)
|
||||
{
|
||||
struct pte pte;
|
||||
struct pte pte[MBR_ENTRY_MAX];
|
||||
struct gpth gpth = {
|
||||
.signature = cpu_to_le64(GPT_SIGNATURE),
|
||||
.revision = cpu_to_le32(GPT_REVISION),
|
||||
@ -382,10 +385,12 @@ static int gen_gptable(uint32_t signature, guid_t guid, unsigned nr)
|
||||
.entry_size = cpu_to_le32(GPT_ENTRY_SIZE),
|
||||
};
|
||||
struct gpte gpte[GPT_ENTRY_MAX];
|
||||
uint64_t start, end, sect = 0;
|
||||
uint64_t start, end;
|
||||
uint64_t sect = GPT_SIZE + GPT_FIRST_ENTRY_SECTOR;
|
||||
int fd, ret = -1;
|
||||
unsigned i;
|
||||
unsigned i, pmbr = 1;
|
||||
|
||||
memset(pte, 0, sizeof(struct pte) * MBR_ENTRY_MAX);
|
||||
memset(gpte, 0, GPT_ENTRY_SIZE * GPT_ENTRY_MAX);
|
||||
for (i = 0; i < nr; i++) {
|
||||
if (!parts[i].size) {
|
||||
@ -394,27 +399,36 @@ static int gen_gptable(uint32_t signature, guid_t guid, unsigned nr)
|
||||
fprintf(stderr, "Invalid size in partition %d!\n", i);
|
||||
return ret;
|
||||
}
|
||||
start = sect + sectors;
|
||||
start = sect;
|
||||
if (parts[i].start != 0) {
|
||||
if (parts[i].start * 2 < start) {
|
||||
fprintf(stderr, "Invalid start %ld for partition %d!\n",
|
||||
parts[i].start, i, start);
|
||||
parts[i].start, i);
|
||||
return ret;
|
||||
}
|
||||
start = parts[i].start * 2;
|
||||
} else if (kb_align != 0) {
|
||||
start = round_to_kb(start);
|
||||
}
|
||||
parts[i].actual_start = start;
|
||||
gpte[i].start = cpu_to_le64(start);
|
||||
|
||||
sect = start + parts[i].size * 2;
|
||||
if (kb_align == 0)
|
||||
sect = round_to_cyl(sect);
|
||||
gpte[i].end = cpu_to_le64(sect -1);
|
||||
gpte[i].guid = guid;
|
||||
gpte[i].guid.b[sizeof(guid_t) -1] += i + 1;
|
||||
gpte[i].type = parts[i].guid;
|
||||
|
||||
if (parts[i].hybrid && pmbr < MBR_ENTRY_MAX) {
|
||||
pte[pmbr].active = ((i + 1) == active) ? 0x80 : 0;
|
||||
pte[pmbr].type = parts[i].type;
|
||||
pte[pmbr].start = cpu_to_le32(start);
|
||||
pte[pmbr].length = cpu_to_le32(sect - start);
|
||||
to_chs(start, pte[1].chs_start);
|
||||
to_chs(sect - 1, pte[1].chs_end);
|
||||
pmbr++;
|
||||
}
|
||||
|
||||
if (parts[i].name)
|
||||
init_utf16(parts[i].name, (uint16_t *)gpte[i].name, GPT_ENTRY_NAME_SIZE / sizeof(uint16_t));
|
||||
|
||||
@ -433,21 +447,23 @@ static int gen_gptable(uint32_t signature, guid_t guid, unsigned nr)
|
||||
printf("%" PRIu64 "\n", (sect - start) * DISK_SECTOR_SIZE);
|
||||
}
|
||||
|
||||
gpte[GPT_ENTRY_MAX - 1].start = cpu_to_le64(GPT_FIRST_ENTRY_SECTOR + GPT_ENTRY_SIZE * GPT_ENTRY_MAX / DISK_SECTOR_SIZE);
|
||||
gpte[GPT_ENTRY_MAX - 1].end = cpu_to_le64((kb_align ? round_to_kb(sectors) : (unsigned long)sectors) - 1);
|
||||
gpte[GPT_ENTRY_MAX - 1].type = GUID_PARTITION_BIOS_BOOT;
|
||||
gpte[GPT_ENTRY_MAX - 1].guid = guid;
|
||||
gpte[GPT_ENTRY_MAX - 1].guid.b[sizeof(guid_t) -1] += GPT_ENTRY_MAX;
|
||||
if (parts[0].actual_start > GPT_FIRST_ENTRY_SECTOR + GPT_SIZE) {
|
||||
gpte[GPT_ENTRY_MAX - 1].start = cpu_to_le64(GPT_FIRST_ENTRY_SECTOR + GPT_SIZE);
|
||||
gpte[GPT_ENTRY_MAX - 1].end = cpu_to_le64(parts[0].actual_start - 1);
|
||||
gpte[GPT_ENTRY_MAX - 1].type = GUID_PARTITION_BIOS_BOOT;
|
||||
gpte[GPT_ENTRY_MAX - 1].guid = guid;
|
||||
gpte[GPT_ENTRY_MAX - 1].guid.b[sizeof(guid_t) -1] += GPT_ENTRY_MAX;
|
||||
}
|
||||
|
||||
end = sect + sectors - 1;
|
||||
end = sect + GPT_SIZE;
|
||||
|
||||
pte.type = 0xEE;
|
||||
pte.start = cpu_to_le32(GPT_HEADER_SECTOR);
|
||||
pte.length = cpu_to_le32(end);
|
||||
to_chs(GPT_HEADER_SECTOR, pte.chs_start);
|
||||
to_chs(end, pte.chs_end);
|
||||
pte[0].type = 0xEE;
|
||||
pte[0].start = cpu_to_le32(GPT_HEADER_SECTOR);
|
||||
pte[0].length = cpu_to_le32(end - GPT_HEADER_SECTOR);
|
||||
to_chs(GPT_HEADER_SECTOR, pte[0].chs_start);
|
||||
to_chs(end, pte[0].chs_end);
|
||||
|
||||
gpth.last_usable = cpu_to_le64(end - GPT_ENTRY_SIZE * GPT_ENTRY_MAX / DISK_SECTOR_SIZE - 1);
|
||||
gpth.last_usable = cpu_to_le64(end - GPT_SIZE - 1);
|
||||
gpth.alternate = cpu_to_le64(end);
|
||||
gpth.entry_crc32 = cpu_to_le32(gpt_crc32(gpte, GPT_ENTRY_SIZE * GPT_ENTRY_MAX));
|
||||
gpth.crc32 = cpu_to_le32(gpt_crc32((char *)&gpth, GPT_HEADER_SIZE));
|
||||
@ -464,7 +480,7 @@ static int gen_gptable(uint32_t signature, guid_t guid, unsigned nr)
|
||||
}
|
||||
|
||||
lseek(fd, MBR_PARTITION_ENTRY_OFFSET, SEEK_SET);
|
||||
if (write(fd, &pte, sizeof(struct pte)) != sizeof(struct pte)) {
|
||||
if (write(fd, pte, sizeof(struct pte) * MBR_ENTRY_MAX) != sizeof(struct pte) * MBR_ENTRY_MAX) {
|
||||
fputs("write failed.\n", stderr);
|
||||
goto fail;
|
||||
}
|
||||
@ -529,7 +545,8 @@ static guid_t type_to_guid_and_name(unsigned char type, char **name)
|
||||
|
||||
switch (type) {
|
||||
case 0xef:
|
||||
*name = "EFI System Partition";
|
||||
if(*name == NULL)
|
||||
*name = "EFI System Partition";
|
||||
guid = GUID_PARTITION_SYSTEM;
|
||||
break;
|
||||
case 0x83:
|
||||
@ -550,13 +567,13 @@ int main (int argc, char **argv)
|
||||
int ch;
|
||||
int part = 0;
|
||||
char *name = NULL;
|
||||
unsigned short int required = 0;
|
||||
unsigned short int hybrid = 0, required = 0;
|
||||
uint32_t signature = 0x5452574F; /* 'OWRT' */
|
||||
guid_t guid = GUID_INIT( signature, 0x2211, 0x4433, \
|
||||
0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0x00);
|
||||
guid_t part_guid = GUID_PARTITION_BASIC_DATA;
|
||||
|
||||
while ((ch = getopt(argc, argv, "h:s:p:a:t:o:vnN:gl:rS:G:")) != -1) {
|
||||
while ((ch = getopt(argc, argv, "h:s:p:a:t:o:vnHN:gl:rS:G:")) != -1) {
|
||||
switch (ch) {
|
||||
case 'o':
|
||||
filename = optarg;
|
||||
@ -570,6 +587,9 @@ int main (int argc, char **argv)
|
||||
case 'g':
|
||||
use_guid_partition_table = 1;
|
||||
break;
|
||||
case 'H':
|
||||
hybrid = 1;
|
||||
break;
|
||||
case 'h':
|
||||
heads = (int)strtoul(optarg, NULL, 0);
|
||||
break;
|
||||
@ -586,19 +606,21 @@ int main (int argc, char **argv)
|
||||
*(p++) = 0;
|
||||
parts[part].start = to_kbytes(p);
|
||||
}
|
||||
part_guid = type_to_guid_and_name(type, &name);
|
||||
parts[part].size = to_kbytes(optarg);
|
||||
parts[part].required = required;
|
||||
parts[part].name = name;
|
||||
parts[part].hybrid = hybrid;
|
||||
parts[part].guid = part_guid;
|
||||
fprintf(stderr, "part %ld %ld\n", parts[part].start, parts[part].size);
|
||||
parts[part++].type = type;
|
||||
/*
|
||||
* reset 'name' and 'required'
|
||||
* reset 'name','required' and 'hybrid'
|
||||
* 'type' is deliberately inherited from the previous delcaration
|
||||
*/
|
||||
name = NULL;
|
||||
required = 0;
|
||||
part_guid = type_to_guid_and_name(type, &name);
|
||||
hybrid = 0;
|
||||
break;
|
||||
case 'N':
|
||||
name = optarg;
|
||||
@ -633,11 +655,14 @@ int main (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
argc -= optind;
|
||||
if (argc || (heads <= 0) || (sectors <= 0) || !filename)
|
||||
if (argc || (!use_guid_partition_table && ((heads <= 0) || (sectors <= 0))) || !filename)
|
||||
usage(argv[0]);
|
||||
|
||||
if (use_guid_partition_table)
|
||||
if (use_guid_partition_table) {
|
||||
heads = 254;
|
||||
sectors = 63;
|
||||
return gen_gptable(signature, guid, part) ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
return gen_ptable(signature, part) ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user