update:add luckfox-pico Ultra support

This commit is contained in:
luckfox-eng29
2024-03-16 17:03:10 +08:00
committed by luckfox-eng33
parent 1e160dee55
commit d3153ac97e
234 changed files with 89019 additions and 2435 deletions

View File

@@ -5,42 +5,37 @@ TARGET_IP="172.32.0.93"
MAX_RETRIES=10
retries=0
usb0_config()
{
current_ip=`ifconfig usb0 | grep -o 'inet addr:[^ ]*' | awk -F ':' '{print $2}'`
usb0_config() {
if [ "$(cat /proc/device-tree/usbdrd/usb@ffb00000/dr_mode)" == "peripheral" ]; then
current_ip=$(ifconfig usb0 | grep -o 'inet addr:[^ ]*' | awk -F ':' '{print $2}')
echo "current_ip = $current_ip"
echo "TARGET_IP = $TARGET_IP"
echo "current_ip = $current_ip"
while [[ "$current_ip" != "$TARGET_IP" && $retries -lt $MAX_RETRIES ]]; do
sleep .5
echo "luckfox : set usb0 ip"
ifconfig usb0 "$TARGET_IP"
current_ip=$(ifconfig usb0 | grep -o 'inet addr:[^ ]*' | awk -F ':' '{print $2}')
echo $current_ip
retries=$((retries + 1))
done
echo "TARGET_IP = $TARGET_IP"
while [[ "$current_ip" != "$TARGET_IP" && $retries -lt $MAX_RETRIES ]]; do
sleep .5
echo "luckfox : set usb0 ip"
ifconfig usb0 "$TARGET_IP"
current_ip=`ifconfig usb0 | grep -o 'inet addr:[^ ]*' | awk -F ':' '{print $2}'`
echo $current_ip
retries=$((retries + 1))
done
if [[ "$current_ip" != "$TARGET_IP" ]]; then
echo "usb0 config error"
else
echo "usb0 config success"
fi
if [[ "$current_ip" != "$TARGET_IP" ]]; then
echo "usb0 config error"
else
echo "usb0 config success"
fi
else
echo "usb0 is using host mode"
fi
}
case $1 in
start)
usb0_config
;;
stop)
;;
*)
exit 1
;;
start)
usb0_config
;;
stop) ;;
*)
exit 1
;;
esac

View File

@@ -0,0 +1,27 @@
#!/bin/sh
check_hciconfig() {
if command -v hciattach &> /dev/null; then
if lsmod | grep -q "aic8800_fdrv"; then
hciattach -s 115200 /dev/ttyS1 any 115200 flow nosleep&
sleep 2
if hciconfig -a | grep -q "hci0"; then
hciconfig hci0 up&
else
echo "hci0 not found or not available."
fi
else
echo "aic8800_fdrv not found."
fi
fi
}
case $1 in
start)
check_hciconfig
;;
*)
exit 1
;;
esac

Binary file not shown.

View File

@@ -0,0 +1,81 @@
From 82ecf5badb818c40fba1e7ada16d53189dfe816b Mon Sep 17 00:00:00 2001
From: eng33 <eng33@luckfox.com>
Date: Tue, 30 Jan 2024 16:25:34 +0800
Subject: [PATCH 1/2] Fixed header file errors
---
client/main.c | 2 +-
client/player.c | 2 +-
src/shared/shell.c | 2 +-
tools/btmgmt.c | 2 +-
tools/obexctl.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/client/main.c b/client/main.c
index 1df94f0..2e19538 100644
--- a/client/main.c
+++ b/client/main.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdbool.h>
-#include <wordexp.h>
+#include <android/compat/wordexp.h>
#include <glib.h>
diff --git a/client/player.c b/client/player.c
index 0c59db6..e807ae0 100644
--- a/client/player.c
+++ b/client/player.c
@@ -23,7 +23,7 @@
#include <string.h>
#include <sys/ioctl.h>
#include <sys/uio.h>
-#include <wordexp.h>
+#include <android/compat/wordexp.h>
#include <glib.h>
diff --git a/src/shared/shell.c b/src/shared/shell.c
index dfda812..86eda9d 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -22,7 +22,7 @@
#include <stdbool.h>
#include <signal.h>
#include <sys/signalfd.h>
-#include <wordexp.h>
+#include <android/compat/wordexp.h>
#include <getopt.h>
#include <readline/readline.h>
diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index ebef388..0cd8700 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -25,7 +25,7 @@
#include <poll.h>
#include <getopt.h>
#include <stdbool.h>
-#include <wordexp.h>
+#include <android/compat/wordexp.h>
#include <ctype.h>
#include "lib/bluetooth.h"
diff --git a/tools/obexctl.c b/tools/obexctl.c
index 56a7691..e8aed6a 100644
--- a/tools/obexctl.c
+++ b/tools/obexctl.c
@@ -20,7 +20,7 @@
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
-#include <wordexp.h>
+#include <android/compat/wordexp.h>
#include <ctype.h>
#include <glib.h>
--
2.34.1

View File

@@ -0,0 +1,424 @@
--- a/src/shared/shell.c 2024-05-13 13:59:50.477347842 +0800
+++ b/src/shared/shell.c 2024-05-13 14:11:43.277134799 +0800
@@ -13,6 +13,9 @@
#endif
#define _GNU_SOURCE
+
+#include <sys/types.h>
+#include <sys/wait.h>
#include <stdio.h>
#include <errno.h>
#include <syslog.h>
@@ -24,6 +27,10 @@
#include <sys/signalfd.h>
#include <android/compat/wordexp.h>
#include <getopt.h>
+#include <stdint.h>
+#include <string.h>
+#include <fcntl.h>
+#include <paths.h>
#include <readline/readline.h>
#include <readline/history.h>
@@ -46,6 +53,11 @@
printf(COLOR_BLUE "%s %-*s " COLOR_OFF "%s\n", \
cmd, (int)(CMD_LENGTH - strlen(cmd)), "", desc)
+/*
+ * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
+ * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
+ */
+#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))
struct bt_shell_env {
char *name;
void *value;
@@ -88,6 +100,20 @@
static void shell_print_menu(void);
static void shell_print_menu_zsh_complete(void);
+static void * _reallocarray(void *optr, size_t nmemb, size_t size)
+{
+
+ if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
+ nmemb > 0 && SIZE_MAX / nmemb < size) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ return (realloc(optr, size * nmemb));
+}
+
+static int we_askshell(const char *, wordexp_t *, int);
+static int we_check(const char *);
+
static void cmd_version(int argc, char *argv[])
{
bt_shell_printf("Version %s\n", VERSION);
@@ -1416,3 +1442,367 @@
return env->value;
}
+
+
+/*
+ * wordexp --
+ * Perform shell word expansion on `words' and place the resulting list
+ * of words in `we'. See wordexp(3).
+ *
+ * Specified by IEEE Std. 1003.1-2001.
+ */
+int
+wordexp(const char * __restrict words, wordexp_t * __restrict we, int flags)
+{
+ int error;
+
+ if (flags & WRDE_REUSE)
+ wordfree(we);
+ if ((flags & WRDE_APPEND) == 0) {
+ we->we_wordc = 0;
+ we->we_wordv = NULL;
+ we->we_strings = NULL;
+ we->we_nbytes = 0;
+ }
+ if ((error = we_check(words)) != 0) {
+ wordfree(we);
+ return (error);
+ }
+ if ((error = we_askshell(words, we, flags)) != 0) {
+ wordfree(we);
+ return (error);
+ }
+ return (0);
+}
+
+static size_t
+weread_fully(int fd, char *buffer, size_t len)
+{
+ size_t done;
+ ssize_t nread;
+
+ done = 0;
+ do {
+ nread = read(fd, buffer + done, len - done);
+ if (nread == -1 && errno == EINTR)
+ continue;
+ if (nread <= 0)
+ break;
+ done += nread;
+ } while (done != len);
+ return done;
+}
+
+static bool
+wewrite_fully(int fd, const char *buffer, size_t len)
+{
+ size_t done;
+ ssize_t nwritten;
+
+ done = 0;
+ do {
+ nwritten = write(fd, buffer + done, len - done);
+ if (nwritten == -1 && errno == EINTR)
+ continue;
+ if (nwritten <= 0)
+ return (false);
+ done += nwritten;
+ } while (done != len);
+ return (true);
+}
+
+/*
+ * we_askshell --
+ * Use the `freebsd_wordexp' /bin/sh builtin function to do most of the
+ * work in expanding the word string. This function is complicated by
+ * memory management.
+ */
+static int
+we_askshell(const char *words, wordexp_t *we, int flags)
+{
+ int pdesw[2]; /* Pipe for writing words */
+ int pdes[2]; /* Pipe for reading output */
+ char wfdstr[sizeof(int) * 3 + 1];
+ char buf[35]; /* Buffer for byte and word count */
+ size_t nwords, nbytes; /* Number of words, bytes from child */
+ size_t i; /* Handy integer */
+ size_t sofs; /* Offset into we->we_strings */
+ size_t vofs; /* Offset into we->we_wordv */
+ pid_t pid; /* Process ID of child */
+ pid_t wpid; /* waitpid return value */
+ int status; /* Child exit status */
+ int error; /* Our return value */
+ int serrno; /* errno to return */
+ char *np, *p; /* Handy pointers */
+ char *nstrings; /* Temporary for realloc() */
+ char **nwv; /* Temporary for realloc() */
+ sigset_t newsigblock, oldsigblock;
+ const char *ifs;
+
+ serrno = errno;
+ ifs = getenv("IFS");
+
+ if (pipe2(pdesw, O_CLOEXEC) < 0)
+ return (WRDE_NOSPACE); /* XXX */
+ snprintf(wfdstr, sizeof(wfdstr), "%d", pdesw[0]);
+ if (pipe2(pdes, O_CLOEXEC) < 0) {
+ close(pdesw[0]);
+ close(pdesw[1]);
+ return (WRDE_NOSPACE); /* XXX */
+ }
+ (void)sigemptyset(&newsigblock);
+ (void)sigaddset(&newsigblock, SIGCHLD);
+ (void)sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock);
+ if ((pid = fork()) < 0) {
+ serrno = errno;
+ close(pdesw[0]);
+ close(pdesw[1]);
+ close(pdes[0]);
+ close(pdes[1]);
+ (void)sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
+ errno = serrno;
+ return (WRDE_NOSPACE); /* XXX */
+ }
+ else if (pid == 0) {
+ /*
+ * We are the child; make /bin/sh expand `words'.
+ */
+ (void)sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
+ if ((pdes[1] != STDOUT_FILENO ?
+ dup2(pdes[1], STDOUT_FILENO) :
+ fcntl(pdes[1], F_SETFD, 0)) < 0)
+ _exit(1);
+ if (fcntl(pdesw[0], F_SETFD, 0) < 0)
+ _exit(1);
+ execl(_PATH_BSHELL, "sh", flags & WRDE_UNDEF ? "-u" : "+u",
+ "-c", "IFS=$1;eval \"$2\";"
+ "freebsd_wordexp -f \"$3\" ${4:+\"$4\"}",
+ "",
+ ifs != NULL ? ifs : " \t\n",
+ flags & WRDE_SHOWERR ? "" : "exec 2>/dev/null",
+ wfdstr,
+ flags & WRDE_NOCMD ? "-p" : "",
+ (char *)NULL);
+ _exit(1);
+ }
+
+ /*
+ * We are the parent; write the words.
+ */
+ close(pdes[1]);
+ close(pdesw[0]);
+ if (!wewrite_fully(pdesw[1], words, strlen(words))) {
+ close(pdesw[1]);
+ error = WRDE_SYNTAX;
+ goto cleanup;
+ }
+ close(pdesw[1]);
+ /*
+ * Read the output of the shell wordexp function,
+ * which is a byte indicating that the words were parsed successfully,
+ * a 64-bit hexadecimal word count, a dummy byte, a 64-bit hexadecimal
+ * byte count (not including terminating null bytes), followed by the
+ * expanded words separated by nulls.
+ */
+ switch (weread_fully(pdes[0], buf, 34)) {
+ case 1:
+ error = buf[0] == 'C' ? WRDE_CMDSUB : WRDE_BADVAL;
+ serrno = errno;
+ goto cleanup;
+ case 34:
+ break;
+ default:
+ error = WRDE_SYNTAX;
+ serrno = errno;
+ goto cleanup;
+ }
+ buf[17] = '\0';
+ nwords = strtol(buf + 1, NULL, 16);
+ buf[34] = '\0';
+ nbytes = strtol(buf + 18, NULL, 16) + nwords;
+
+ /*
+ * Allocate or reallocate (when flags & WRDE_APPEND) the word vector
+ * and string storage buffers for the expanded words we're about to
+ * read from the child.
+ */
+ sofs = we->we_nbytes;
+ vofs = we->we_wordc;
+ if ((flags & (WRDE_DOOFFS|WRDE_APPEND)) == (WRDE_DOOFFS|WRDE_APPEND))
+ vofs += we->we_offs;
+ we->we_wordc += nwords;
+ we->we_nbytes += nbytes;
+ if ((nwv = _reallocarray(we->we_wordv, (we->we_wordc + 1 +
+ (flags & WRDE_DOOFFS ? we->we_offs : 0)),
+ sizeof(char *))) == NULL) {
+ error = WRDE_NOSPACE;
+ goto cleanup;
+ }
+ we->we_wordv = nwv;
+ if ((nstrings = realloc(we->we_strings, we->we_nbytes)) == NULL) {
+ error = WRDE_NOSPACE;
+ goto cleanup;
+ }
+ for (i = 0; i < vofs; i++)
+ if (we->we_wordv[i] != NULL)
+ we->we_wordv[i] += nstrings - we->we_strings;
+ we->we_strings = nstrings;
+
+ if (weread_fully(pdes[0], we->we_strings + sofs, nbytes) != nbytes) {
+ error = WRDE_NOSPACE; /* abort for unknown reason */
+ serrno = errno;
+ goto cleanup;
+ }
+
+ error = 0;
+cleanup:
+ close(pdes[0]);
+ do
+ wpid = waitpid(pid, &status, 0);
+ while (wpid < 0 && errno == EINTR);
+ (void)sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
+ if (error != 0) {
+ errno = serrno;
+ return (error);
+ }
+ if (wpid < 0 || !WIFEXITED(status) || WEXITSTATUS(status) != 0)
+ return (WRDE_NOSPACE); /* abort for unknown reason */
+
+ /*
+ * Break the null-terminated expanded word strings out into
+ * the vector.
+ */
+ if (vofs == 0 && flags & WRDE_DOOFFS)
+ while (vofs < we->we_offs)
+ we->we_wordv[vofs++] = NULL;
+ p = we->we_strings + sofs;
+ while (nwords-- != 0) {
+ we->we_wordv[vofs++] = p;
+ if ((np = memchr(p, '\0', nbytes)) == NULL)
+ return (WRDE_NOSPACE); /* XXX */
+ nbytes -= np - p + 1;
+ p = np + 1;
+ }
+ we->we_wordv[vofs] = NULL;
+
+ return (0);
+}
+
+/*
+ * we_check --
+ * Check that the string contains none of the following unquoted
+ * special characters: <newline> |&;<>(){}
+ * This mainly serves for {} which are normally legal in sh.
+ * It deliberately does not attempt to model full sh syntax.
+ */
+static int
+we_check(const char *words)
+{
+ char c;
+ /* Saw \ or $, possibly not special: */
+ bool quote = false, dollar = false;
+ /* Saw ', ", ${, ` or $(, possibly not special: */
+ bool have_sq = false, have_dq = false, have_par_begin = false;
+ bool have_cmd = false;
+ /* Definitely saw a ', ", ${, ` or $(, need a closing character: */
+ bool need_sq = false, need_dq = false, need_par_end = false;
+ bool need_cmd_old = false, need_cmd_new = false;
+
+ while ((c = *words++) != '\0') {
+ switch (c) {
+ case '\\':
+ quote = !quote;
+ continue;
+ case '$':
+ if (quote)
+ quote = false;
+ else
+ dollar = !dollar;
+ continue;
+ case '\'':
+ if (!quote && !have_sq && !have_dq)
+ need_sq = true;
+ else
+ need_sq = false;
+ have_sq = true;
+ break;
+ case '"':
+ if (!quote && !have_sq && !have_dq)
+ need_dq = true;
+ else
+ need_dq = false;
+ have_dq = true;
+ break;
+ case '`':
+ if (!quote && !have_sq && !have_cmd)
+ need_cmd_old = true;
+ else
+ need_cmd_old = false;
+ have_cmd = true;
+ break;
+ case '{':
+ if (!quote && !dollar && !have_sq && !have_dq &&
+ !have_cmd)
+ return (WRDE_BADCHAR);
+ if (dollar) {
+ if (!quote && !have_sq)
+ need_par_end = true;
+ have_par_begin = true;
+ }
+ break;
+ case '}':
+ if (!quote && !have_sq && !have_dq && !have_par_begin &&
+ !have_cmd)
+ return (WRDE_BADCHAR);
+ need_par_end = false;
+ break;
+ case '(':
+ if (!quote && !dollar && !have_sq && !have_dq &&
+ !have_cmd)
+ return (WRDE_BADCHAR);
+ if (dollar) {
+ if (!quote && !have_sq)
+ need_cmd_new = true;
+ have_cmd = true;
+ }
+ break;
+ case ')':
+ if (!quote && !have_sq && !have_dq && !have_cmd)
+ return (WRDE_BADCHAR);
+ need_cmd_new = false;
+ break;
+ case '|': case '&': case ';': case '<': case '>': case '\n':
+ if (!quote && !have_sq && !have_dq && !have_cmd)
+ return (WRDE_BADCHAR);
+ break;
+ default:
+ break;
+ }
+ quote = dollar = false;
+ }
+ if (quote || dollar || need_sq || need_dq || need_par_end ||
+ need_cmd_old || need_cmd_new)
+ return (WRDE_SYNTAX);
+
+ return (0);
+}
+
+/*
+ * wordfree --
+ * Free the result of wordexp(). See wordexp(3).
+ *
+ * Specified by IEEE Std. 1003.1-2001.
+ */
+void
+wordfree(wordexp_t *we)
+{
+
+ if (we == NULL)
+ return;
+ free(we->we_wordv);
+ free(we->we_strings);
+ we->we_wordv = NULL;
+ we->we_strings = NULL;
+ we->we_nbytes = 0;
+ we->we_wordc = 0;
+}

View File

@@ -0,0 +1,97 @@
--- a/android/compat/wordexp.h 2024-05-13 13:59:50.667347786 +0800
+++ b/android/compat/wordexp.h 2024-05-13 14:11:43.377135089 +0800
@@ -1,31 +1,78 @@
-/* SPDX-License-Identifier: LGPL-2.1-or-later */
-/*
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
- * BlueZ - Bluetooth protocol stack for Linux
+ * Copyright (c) 2002 Tim J. Robbins.
+ * All rights reserved.
*
- * Copyright (C) 1991-2013 Free Software Foundation, Inc.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
*
+ * $FreeBSD$
*/
#ifndef _WORDEXP_H_
-#define _WORDEXP_H_
+#define _WORDEXP_H_
-#define WRDE_NOCMD 0
+#include <sys/types.h>
+#include <stdlib.h>
typedef struct {
- size_t we_wordc;
- char **we_wordv;
- size_t we_offs;
+ size_t we_wordc; /* count of words matched */
+ char **we_wordv; /* pointer to list of words */
+ size_t we_offs; /* slots to reserve in we_wordv */
+ char *we_strings; /* storage for wordv strings */
+ size_t we_nbytes; /* size of we_strings */
} wordexp_t;
-static inline int wordexp(const char *c, wordexp_t *w, int _i)
-{
- return -1;
-}
+/*
+ * Flags for wordexp().
+ */
+#define WRDE_APPEND 0x1 /* append to previously generated */
+#define WRDE_DOOFFS 0x2 /* we_offs member is valid */
+#define WRDE_NOCMD 0x4 /* disallow command substitution */
+#define WRDE_REUSE 0x8 /* reuse wordexp_t */
+#define WRDE_SHOWERR 0x10 /* don't redirect stderr to /dev/null */
+#define WRDE_UNDEF 0x20 /* disallow undefined shell vars */
-static inline void wordfree(wordexp_t *__wordexp)
-{
-}
+/*
+ * Return values from wordexp().
+ */
+#define WRDE_BADCHAR 1 /* unquoted special character */
+#define WRDE_BADVAL 2 /* undefined variable */
+#define WRDE_CMDSUB 3 /* command substitution not allowed */
+#define WRDE_NOSPACE 4 /* no memory for result */
+#if __XSI_VISIBLE
+#define WRDE_NOSYS 5 /* obsolete, reserved */
+#endif
+#define WRDE_SYNTAX 6 /* shell syntax error */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+int wordexp(const char * __restrict, wordexp_t * __restrict, int);
+void wordfree(wordexp_t *);
+
+#ifdef __cplusplus
+}
#endif
+
+#endif /* !_WORDEXP_H_ */

Binary file not shown.

View File

@@ -10,7 +10,6 @@ BR2_TOOLCHAIN_EXTERNAL_WCHAR=y
BR2_TOOLCHAIN_EXTERNAL_HAS_SSP=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_PRIMARY_SITE="http://sources.buildroot.net"
BR2_PRIMARY_SITE_ONLY=y
BR2_OPTIMIZE_3=y
BR2_TARGET_GENERIC_HOSTNAME="luckfox pico"
BR2_TARGET_GENERIC_ISSUE="Welcome to luckfox pico"
@@ -30,8 +29,18 @@ BR2_PACKAGE_PYTHON_SETUPTOOLS=y
BR2_PACKAGE_PYTHON_SMBUS_CFFI=y
BR2_PACKAGE_PYTHON_SPIDEV=y
BR2_PACKAGE_PYTHON_WERKZEUG=y
BR2_PACKAGE_DTC=y
BR2_PACKAGE_DTC_PROGRAMS=y
BR2_PACKAGE_LIBV4L=y
BR2_PACKAGE_LIBV4L_UTILS=y
BR2_PACKAGE_LRZSZ=y
BR2_PACKAGE_NTP=y
BR2_PACKAGE_OPENSSH=y
BR2_PACKAGE_SAMBA4=y
BR2_PACKAGE_BASH=y
BR2_PACKAGE_BASH_LOADABLE_EXAMPLES=y
BR2_PACKAGE_DIALOG=y
BR2_PACKAGE_TIME=y
BR2_PACKAGE_HTOP=y
BR2_PACKAGE_NANO=y
BR2_PACKAGE_HOST_DTC=y

View File

@@ -0,0 +1,87 @@
BR2_arm=y
BR2_cortex_a7=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_PATH="../../../../tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf"
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="arm-rockchip830-linux-uclibcgnueabihf"
BR2_TOOLCHAIN_EXTERNAL_GCC_8=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_10=y
BR2_TOOLCHAIN_EXTERNAL_WCHAR=y
BR2_TOOLCHAIN_EXTERNAL_HAS_SSP=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_PRIMARY_SITE="http://sources.buildroot.net"
BR2_OPTIMIZE_3=y
BR2_TARGET_GENERIC_HOSTNAME="luckfox pico"
BR2_TARGET_GENERIC_ISSUE="Welcome to luckfox pico"
BR2_TARGET_GENERIC_ROOT_PASSWD="luckfox"
BR2_SYSTEM_ENABLE_NLS=y
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
BR2_PACKAGE_ALSA_UTILS=y
BR2_PACKAGE_ALSA_UTILS_ALSACONF=y
BR2_PACKAGE_ALSA_UTILS_ACONNECT=y
BR2_PACKAGE_ALSA_UTILS_AMIXER=y
BR2_PACKAGE_ALSA_UTILS_APLAY=y
BR2_PACKAGE_ALSA_UTILS_SPEAKER_TEST=y
BR2_PACKAGE_BLUEZ_ALSA=y
BR2_PACKAGE_BLUEZ_ALSA_HCITOP=y
BR2_PACKAGE_BLUEZ_ALSA_RFCOMM=y
BR2_PACKAGE_FFMPEG_FFPLAY=y
BR2_PACKAGE_FFMPEG_FFPROBE=y
BR2_PACKAGE_FFMPEG_AVRESAMPLE=y
BR2_PACKAGE_JACK2=y
BR2_PACKAGE_JACK2_LEGACY=y
BR2_PACKAGE_JACK2_DBUS=y
BR2_PACKAGE_MADPLAY=y
BR2_PACKAGE_MPV=y
BR2_PACKAGE_PULSEAUDIO=y
BR2_PACKAGE_SOX=y
BR2_PACKAGE_E2FSPROGS_RESIZE2FS=y
BR2_PACKAGE_SDL2_GFX=y
BR2_PACKAGE_SDL2_IMAGE=y
BR2_PACKAGE_SDL2_MIXER=y
BR2_PACKAGE_SDL2_NET=y
BR2_PACKAGE_SDL2_TTF=y
BR2_PACKAGE_VULKAN_HEADERS=y
BR2_PACKAGE_DBUS_CPP=y
BR2_PACKAGE_DBUS_TRIGGERD=y
BR2_PACKAGE_PYTHON3_SSL=y
BR2_PACKAGE_PYTHON_AIOHTTP=y
BR2_PACKAGE_PYTHON_CLICK=y
BR2_PACKAGE_PYTHON_ITSDANGEROUS=y
BR2_PACKAGE_PYTHON_JINJA2=y
BR2_PACKAGE_PYTHON_PERIPHERY=y
BR2_PACKAGE_PYTHON_PILLOW=y
BR2_PACKAGE_PYTHON_SERIAL=y
BR2_PACKAGE_PYTHON_SETUPTOOLS=y
BR2_PACKAGE_PYTHON_SMBUS_CFFI=y
BR2_PACKAGE_PYTHON_SPIDEV=y
BR2_PACKAGE_PYTHON_WERKZEUG=y
BR2_PACKAGE_LIBAO=y
BR2_PACKAGE_PORTAUDIO=y
BR2_PACKAGE_DTC=y
BR2_PACKAGE_DTC_PROGRAMS=y
BR2_PACKAGE_LIBV4L=y
BR2_PACKAGE_LIBV4L_UTILS=y
BR2_PACKAGE_CJSON=y
BR2_PACKAGE_CJSON_UTILS=y
BR2_PACKAGE_BLUEZ_TOOLS=y
BR2_PACKAGE_BLUEZ5_UTILS_CLIENT=y
BR2_PACKAGE_BLUEZ5_UTILS_TOOLS=y
BR2_PACKAGE_BLUEZ5_UTILS_DEPRECATED=y
BR2_PACKAGE_BLUEZ5_UTILS_EXPERIMENTAL=y
BR2_PACKAGE_IPERF=y
BR2_PACKAGE_IPERF3=y
BR2_PACKAGE_IW=y
BR2_PACKAGE_LRZSZ=y
BR2_PACKAGE_NTP=y
BR2_PACKAGE_OPENSSH=y
BR2_PACKAGE_SAMBA4=y
BR2_PACKAGE_SOCAT=y
BR2_PACKAGE_BASH=y
BR2_PACKAGE_BASH_LOADABLE_EXAMPLES=y
BR2_PACKAGE_DIALOG=y
BR2_PACKAGE_TIME=y
BR2_PACKAGE_HTOP=y
BR2_PACKAGE_UTIL_LINUX_LIBMOUNT=y
BR2_PACKAGE_NANO=y
BR2_PACKAGE_HOST_DTC=y

View File

@@ -0,0 +1,43 @@
--- a/video/out/filter_kernels.c 2024-04-26 11:14:00.377199103 +0800
+++ b/video/out/filter_kernels.c 2024-04-26 11:13:50.217202856 +0800
@@ -32,6 +32,31 @@
// NOTE: all filters are designed for discrete convolution
+double factorial(int n) {
+ if (n == 0)
+ return 1;
+ else
+ return n * factorial(n - 1);
+}
+
+double power(double base, int exponent) {
+ double result = 1.0;
+ for (int i = 0; i < exponent; i++) {
+ result *= base;
+ }
+ return result;
+}
+
+double BesselJ1(double x) {
+ double result = 0.0;
+ for (int n = 0; n <= 10; n++) {
+ result += power(-1, n) * power(x / 2.0, 2 * n + 1) / (factorial(n) * factorial(n + 1));
+ }
+ return result;
+}
+
+
+
const struct filter_window *mp_find_filter_window(const char *name)
{
if (!name)
@@ -324,7 +349,7 @@
if (fabs(x) < 1e-8)
return 1.0;
x *= M_PI;
- return 2.0 * j1(x) / x;
+ return 2.0 * BesselJ1(x) / x;
}
static double sphinx(params *p, double x)

View File

@@ -0,0 +1,15 @@
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
export EDITOR='/bin/vi'
export PS1='[\u@\h \W]$ '
# Source configuration files from /etc/profile.d
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
unset i

View File

@@ -0,0 +1,25 @@
#!/bin/bash
# Check if the filesystem has been resized previously
if [ ! -f /etc/.filesystem_resized ]; then
# Perform filesystem resize
sudo resize2fs /dev/mmcblk0p5
sudo resize2fs /dev/mmcblk0p6
sudo resize2fs /dev/mmcblk0p7
# Create a marker file indicating filesystem resize has been done
sudo touch /etc/.filesystem_resized
echo "Filesystem resized successfully."
fi
if [ ! -f /etc/.filesystem_swap ]; then
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile >/dev/null
sudo swapon /swapfile >/dev/null
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab >/dev/null
sudo touch /etc/.filesystem_swap
echo "Swap successfully."
fi

View File

@@ -0,0 +1,4 @@
# UNCONFIGURED FSTAB FOR BASE SYSTEM
/dev/mmcblk0p7 / ext4 rw 0 0
/dev/mmcblk0p5 /oem ext4 defaults 0 0
/dev/mmcblk0p6 /userdata ext4 defaults 0 0

View File

@@ -0,0 +1,29 @@
#!/bin/bash
/usr/bin/filesystem_resize.sh
/etc/init.d/S50usbdevice start
# WIFI/BT
if [ -f /oem/usr/ko/install_wifi.sh ]; then
#wifi
cd /oem/usr/ko
sh insmod_wifi.sh
cd -
#BT
if command -v hciattach &>/dev/null; then
if lsmod | grep -q "aic8800_fdrv"; then
hciattach -s 115200 /dev/ttyS1 any 115200 flow nosleep &
sleep 2
if hciconfig -a | grep -q "hci0"; then
hciconfig hci0 up &
else
echo "hci0 not found or not available."
fi
else
echo "aic8800_fdrv not found."
fi
else
echo "You need install hci tools"
fi
fi

View File

@@ -0,0 +1,16 @@
#!/bin/sh
load_luckfoxconfig() {
if [ -f /etc/luckfox.cfg ] && [ -f /usr/bin/luckfox-config ] ;then
luckfox-config load
fi
}
case $1 in
start)
load_luckfoxconfig
;;
*)
exit 1
;;
esac

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,67 @@
#!/bin/bash
BACKUP_MIRROR_SITE="http://sources.buildroot.net"
PRIMARY_MIRROR_SITES=("http://sources.buildroot.net" "https://mirrors.lzu.edu.cn/buildroot")
# Uncomment and use other mirror sites if needed
# KERNEL_MIRROR_SITES=(
# "https://cdn.kernel.org/pub"
# "https://mirror.bjtu.edu.cn/kernel/"
# )
#
# GNU_MIRROR_SITES=(
# "http://ftpmirror.gnu.org"
# "http://mirrors.nju.edu.cn/gnu/"
# )
#
# LUAROCKS_MIRROR_SITES=(
# "http://rocks.moonscript.org"
# "https://luarocks.cn"
# )
#
# CPAN_MIRROR_SITES=(
# "https://cpan.metacpan.org"
# "http://mirrors.nju.edu.cn/CPAN/"
# )
function get_fastest_mirror() {
local MIRROR_SITES=("${!1}")
declare -A CONNECT_TIMES
for site in "${MIRROR_SITES[@]}"; do
time=$(timeout 1.5 curl -s -w "%{time_connect}\n" -o /dev/null "$site")
if [ $? -eq 0 ]; then
CONNECT_TIMES["$site"]=$time
else
CONNECT_TIMES["$site"]=10 # Assign a high value if timeout occurs
fi
done
if [ ${#CONNECT_TIMES[@]} -eq 0 ]; then
fastest_site="${MIRROR_SITES[0]}"
echo "$fastest_site"
return 1
fi
fastest_site=""
min_time=10
for site in "${!CONNECT_TIMES[@]}"; do
time="${CONNECT_TIMES[$site]}"
if awk "BEGIN {exit !($time < $min_time)}"; then
min_time="$time"
fastest_site="$site"
fi
done
echo "$fastest_site"
}
PRIMARY_FAST_MIRROR=$(get_fastest_mirror PRIMARY_MIRROR_SITES[@])
echo "Fast mirror is $PRIMARY_FAST_MIRROR"
PRIMARY_MIRROR_STRING='BR2_PRIMARY_SITE='
BACKUP_MIRROR_STRING='BR2_BACKUP_SITE='
CONFIG_PATH="$1"
sed -i "/$PRIMARY_MIRROR_STRING/c\BR2_PRIMARY_SITE=\"$PRIMARY_FAST_MIRROR\"" "$CONFIG_PATH"
sed -i "/$BACKUP_MIRROR_STRING/c\BR2_BACKUP_SITE=\"$BACKUP_MIRROR_SITE\"" "$CONFIG_PATH"