This commit is contained in:
Jianhui Zhao 2022-03-02 17:55:40 +08:00
commit 2c82bfa7c9
2 changed files with 135 additions and 0 deletions

View File

@ -0,0 +1,56 @@
--- a/drivers/mtd/mtdoops.c
+++ b/drivers/mtd/mtdoops.c
@@ -220,8 +220,26 @@ static void mtdoops_write(struct mtdoops
hdr[1] = MTDOOPS_KERNMSG_MAGIC;
if (panic) {
- ret = mtd_panic_write(mtd, cxt->nextpage * record_size,
- record_size, &retlen, cxt->oops_buf);
+ int count = record_size / 0x800;
+ int i = 0;
+ const u_char * p = cxt->oops_buf;
+ while(count--) {
+ ret = mtd_write(mtd, cxt->nextpage * record_size + i * 0x800,
+ record_size - i * 0x800, &retlen, p);
+ if (ret == 0) {
+ break;
+ }
+ else {
+ if ((p + 0x800) != NULL) {
+ p = p + 0x800;
+ i++;
+ }
+ else {
+ break;
+ }
+ }
+ }
+
if (ret == -EOPNOTSUPP) {
printk(KERN_ERR "mtdoops: Cannot write from panic without panic_write\n");
return;
@@ -230,9 +248,11 @@ static void mtdoops_write(struct mtdoops
ret = mtd_write(mtd, cxt->nextpage * record_size,
record_size, &retlen, cxt->oops_buf);
+#if 0
if (retlen != record_size || ret < 0)
printk(KERN_ERR "mtdoops: write failure at %ld (%td of %ld written), error %d\n",
cxt->nextpage * record_size, retlen, record_size, ret);
+#endif
mark_page_used(cxt, cxt->nextpage);
memset(cxt->oops_buf, 0xff, record_size);
@@ -241,10 +261,12 @@ static void mtdoops_write(struct mtdoops
static void mtdoops_workfunc_write(struct work_struct *work)
{
+#if 0
struct mtdoops_context *cxt =
container_of(work, struct mtdoops_context, work_write);
mtdoops_write(cxt, 0);
+#endif
}
static void find_next_position(struct mtdoops_context *cxt)

View File

@ -0,0 +1,79 @@
From 4e982339ca01702cfe3182e3c67bf0c64f1a3a09 Mon Sep 17 00:00:00 2001
From: "GL.iNet-Hongjian.Zhang" <hongjian.zhang@gl-inet.com>
Date: Tue, 1 Mar 2022 16:47:21 +0800
Subject: [PATCH] add patches for opkg
---
.../system/opkg/patches/001-support-db.patch | 60 +++++++++++++++++++
1 file changed, 60 insertions(+)
create mode 100755 package/system/opkg/patches/001-support-db.patch
diff --git a/package/system/opkg/patches/001-support-db.patch b/package/system/opkg/patches/001-support-db.patch
new file mode 100755
index 0000000000..f5225e2520
--- /dev/null
+++ b/package/system/opkg/patches/001-support-db.patch
@@ -0,0 +1,60 @@
+Index: b/libopkg/opkg_cmd.c
+===================================================================
+--- a/libopkg/opkg_cmd.c 2021-09-15 10:31:09.074170782 +0800
++++ b/libopkg/opkg_cmd.c 2021-09-15 10:36:52.124646257 +0800
+@@ -41,6 +41,29 @@
+ #include "opkg_configure.h"
+ #include "xsystem.h"
+
++int exec_command(const char *command)
++{
++ opkg_msg(NOTICE, "Updating database.\n");
++ remove("/var/lock/opkg.lock");
++
++ FILE *fp;
++
++ fp = popen(command, "r");
++ if (fp == NULL) {
++ return -1;
++ }
++ pclose(fp);
++
++ fp = fopen("/var/lock/opkg.lock", "w+");
++ if (fp != NULL) {
++ fclose(fp);
++ }
++
++ opkg_msg(NOTICE, "Database update completed.\n");
++
++ return 0;
++}
++
+ static void print_pkg(pkg_t * pkg)
+ {
+ char *version = pkg_version_str_alloc(pkg);
+@@ -196,7 +219,7 @@ static int opkg_update_cmd(int argc, cha
+ rmdir(tmp);
+ free(tmp);
+ free(lists_dir);
+-
++ exec_command("update_plugins_db update");
+ return failures;
+ }
+
+@@ -482,7 +505,7 @@ static int opkg_install_cmd(int argc, ch
+ err = -1;
+
+ write_status_files_if_changed();
+-
++ exec_command("update_plugins_db install");
+ return err;
+ }
+
+@@ -900,6 +923,7 @@ static int opkg_remove_cmd(int argc, cha
+ opkg_msg(NOTICE, "No packages removed.\n");
+
+ write_status_files_if_changed();
++ exec_command("update_plugins_db remove");
+ return err;
+ }
+
--
2.17.1