mirror of
https://github.com/LuckfoxTECH/luckfox-pico.git
synced 2026-01-19 09:52:31 +01:00
project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp: Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem. sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately. sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades. sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for fastboot. Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
This commit is contained in:
@@ -192,3 +192,8 @@ config UML_TIME_TRAVEL_SUPPORT
|
||||
endmenu
|
||||
|
||||
source "arch/um/drivers/Kconfig"
|
||||
|
||||
config ARCH_SUSPEND_POSSIBLE
|
||||
def_bool y
|
||||
|
||||
source "kernel/power/Kconfig"
|
||||
|
||||
@@ -131,10 +131,18 @@ export LDS_ELF_FORMAT := $(ELF_FORMAT)
|
||||
# The wrappers will select whether using "malloc" or the kernel allocator.
|
||||
LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
|
||||
|
||||
# Avoid binutils 2.39+ warnings by marking the stack non-executable and
|
||||
# ignorning warnings for the kallsyms sections.
|
||||
LDFLAGS_EXECSTACK = -z noexecstack
|
||||
ifeq ($(CONFIG_LD_IS_BFD),y)
|
||||
LDFLAGS_EXECSTACK += $(call ld-option,--no-warn-rwx-segments)
|
||||
endif
|
||||
|
||||
LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS),-Wl,$(opt))
|
||||
|
||||
# Used by link-vmlinux.sh which has special support for um link
|
||||
export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)
|
||||
export LDFLAGS_vmlinux := $(LDFLAGS_EXECSTACK)
|
||||
|
||||
# When cleaning we don't include .config, so we don't include
|
||||
# TT or skas makefiles and don't clean skas_ptregs.h.
|
||||
|
||||
@@ -220,7 +220,7 @@ static int winch_tramp(int fd, struct tty_port *port, int *fd_out,
|
||||
unsigned long *stack_out)
|
||||
{
|
||||
struct winch_data data;
|
||||
int fds[2], n, err;
|
||||
int fds[2], n, err, pid;
|
||||
char c;
|
||||
|
||||
err = os_pipe(fds, 1, 1);
|
||||
@@ -238,8 +238,9 @@ static int winch_tramp(int fd, struct tty_port *port, int *fd_out,
|
||||
* problem with /dev/net/tun, which if held open by this
|
||||
* thread, prevents the TUN/TAP device from being reused.
|
||||
*/
|
||||
err = run_helper_thread(winch_thread, &data, CLONE_FILES, stack_out);
|
||||
if (err < 0) {
|
||||
pid = run_helper_thread(winch_thread, &data, CLONE_FILES, stack_out);
|
||||
if (pid < 0) {
|
||||
err = pid;
|
||||
printk(UM_KERN_ERR "fork of winch_thread failed - errno = %d\n",
|
||||
-err);
|
||||
goto out_close;
|
||||
@@ -263,7 +264,7 @@ static int winch_tramp(int fd, struct tty_port *port, int *fd_out,
|
||||
goto out_close;
|
||||
}
|
||||
|
||||
return err;
|
||||
return pid;
|
||||
|
||||
out_close:
|
||||
close(fds[1]);
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
* protects against a module being loaded twice at the same time.
|
||||
*/
|
||||
static int random_fd = -1;
|
||||
static struct hwrng hwrng = { 0, };
|
||||
static struct hwrng hwrng;
|
||||
static DECLARE_COMPLETION(have_data);
|
||||
|
||||
static int rng_dev_read(struct hwrng *rng, void *buf, size_t max, bool block)
|
||||
|
||||
@@ -57,18 +57,22 @@ static inline struct thread_info *current_thread_info(void)
|
||||
#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
|
||||
#define TIF_SIGPENDING 1 /* signal pending */
|
||||
#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
|
||||
#define TIF_NOTIFY_SIGNAL 3 /* signal notifications exist */
|
||||
#define TIF_RESTART_BLOCK 4
|
||||
#define TIF_MEMDIE 5 /* is terminating due to OOM killer */
|
||||
#define TIF_SYSCALL_AUDIT 6
|
||||
#define TIF_RESTORE_SIGMASK 7
|
||||
#define TIF_NOTIFY_RESUME 8
|
||||
#define TIF_SECCOMP 9 /* secure computing */
|
||||
#define TIF_SINGLESTEP 10 /* single stepping userspace */
|
||||
|
||||
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
|
||||
#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
|
||||
#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
|
||||
#define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL)
|
||||
#define _TIF_MEMDIE (1 << TIF_MEMDIE)
|
||||
#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
|
||||
#define _TIF_SECCOMP (1 << TIF_SECCOMP)
|
||||
#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,13 +2,8 @@
|
||||
#ifndef __UM_TIMEX_H
|
||||
#define __UM_TIMEX_H
|
||||
|
||||
typedef unsigned long cycles_t;
|
||||
|
||||
static inline cycles_t get_cycles (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define CLOCK_TICK_RATE (HZ)
|
||||
|
||||
#include <asm-generic/timex.h>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -39,6 +39,8 @@ extern int is_syscall(unsigned long addr);
|
||||
|
||||
extern void timer_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs);
|
||||
|
||||
extern void uml_pm_wake(void);
|
||||
|
||||
extern int start_uml(void);
|
||||
extern void paging_init(void);
|
||||
|
||||
|
||||
@@ -241,6 +241,7 @@ extern int set_signals(int enable);
|
||||
extern int set_signals_trace(int enable);
|
||||
extern int os_is_signal_stack(void);
|
||||
extern void deliver_alarm(void);
|
||||
extern void register_pm_wake_signal(void);
|
||||
|
||||
/* util.c */
|
||||
extern void stack_protections(unsigned long address);
|
||||
|
||||
@@ -44,7 +44,7 @@ void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
|
||||
{
|
||||
PT_REGS_IP(regs) = eip;
|
||||
PT_REGS_SP(regs) = esp;
|
||||
current->ptrace &= ~PT_DTRACE;
|
||||
clear_thread_flag(TIF_SINGLESTEP);
|
||||
#ifdef SUBARCH_EXECVE1
|
||||
SUBARCH_EXECVE1(regs->regs);
|
||||
#endif
|
||||
|
||||
@@ -99,7 +99,8 @@ void interrupt_end(void)
|
||||
|
||||
if (need_resched())
|
||||
schedule();
|
||||
if (test_thread_flag(TIF_SIGPENDING))
|
||||
if (test_thread_flag(TIF_SIGPENDING) ||
|
||||
test_thread_flag(TIF_NOTIFY_SIGNAL))
|
||||
do_signal(regs);
|
||||
if (test_thread_flag(TIF_NOTIFY_RESUME))
|
||||
tracehook_notify_resume(regs);
|
||||
@@ -156,7 +157,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
|
||||
unsigned long arg, struct task_struct * p, unsigned long tls)
|
||||
{
|
||||
void (*handler)(void);
|
||||
int kthread = current->flags & PF_KTHREAD;
|
||||
int kthread = current->flags & (PF_KTHREAD | PF_IO_WORKER);
|
||||
int ret = 0;
|
||||
|
||||
p->thread = (struct thread_struct) INIT_THREAD;
|
||||
@@ -341,7 +342,7 @@ int singlestepping(void * t)
|
||||
{
|
||||
struct task_struct *task = t ? t : current;
|
||||
|
||||
if (!(task->ptrace & PT_DTRACE))
|
||||
if (!test_thread_flag(TIF_SINGLESTEP))
|
||||
return 0;
|
||||
|
||||
if (task->thread.singlestep_syscall)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
void user_enable_single_step(struct task_struct *child)
|
||||
{
|
||||
child->ptrace |= PT_DTRACE;
|
||||
set_tsk_thread_flag(child, TIF_SINGLESTEP);
|
||||
child->thread.singlestep_syscall = 0;
|
||||
|
||||
#ifdef SUBARCH_SET_SINGLESTEPPING
|
||||
@@ -22,7 +22,7 @@ void user_enable_single_step(struct task_struct *child)
|
||||
|
||||
void user_disable_single_step(struct task_struct *child)
|
||||
{
|
||||
child->ptrace &= ~PT_DTRACE;
|
||||
clear_tsk_thread_flag(child, TIF_SINGLESTEP);
|
||||
child->thread.singlestep_syscall = 0;
|
||||
|
||||
#ifdef SUBARCH_SET_SINGLESTEPPING
|
||||
@@ -121,7 +121,7 @@ static void send_sigtrap(struct uml_pt_regs *regs, int error_code)
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX Check PT_DTRACE vs TIF_SINGLESTEP for singlestepping check and
|
||||
* XXX Check TIF_SINGLESTEP for singlestepping check and
|
||||
* PT_PTRACED vs TIF_SYSCALL_TRACE for syscall tracing check
|
||||
*/
|
||||
int syscall_trace_enter(struct pt_regs *regs)
|
||||
@@ -145,7 +145,7 @@ void syscall_trace_leave(struct pt_regs *regs)
|
||||
audit_syscall_exit(regs);
|
||||
|
||||
/* Fake a debug trap */
|
||||
if (ptraced & PT_DTRACE)
|
||||
if (test_thread_flag(TIF_SINGLESTEP))
|
||||
send_sigtrap(®s->regs, 0);
|
||||
|
||||
if (!test_thread_flag(TIF_SYSCALL_TRACE))
|
||||
|
||||
@@ -53,7 +53,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
|
||||
unsigned long sp;
|
||||
int err;
|
||||
|
||||
if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED))
|
||||
if (test_thread_flag(TIF_SINGLESTEP) && (current->ptrace & PT_PTRACED))
|
||||
singlestep = 1;
|
||||
|
||||
/* Did we come from a system call? */
|
||||
@@ -128,7 +128,7 @@ void do_signal(struct pt_regs *regs)
|
||||
* on the host. The tracing thread will check this flag and
|
||||
* PTRACE_SYSCALL if necessary.
|
||||
*/
|
||||
if (current->ptrace & PT_DTRACE)
|
||||
if (test_thread_flag(TIF_SINGLESTEP))
|
||||
current->thread.singlestep_syscall =
|
||||
is_syscall(PT_REGS_IP(¤t->thread.regs));
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <linux/sched.h>
|
||||
#include <linux/sched/task.h>
|
||||
#include <linux/kmsg_dump.h>
|
||||
#include <linux/suspend.h>
|
||||
|
||||
#include <asm/processor.h>
|
||||
#include <asm/sections.h>
|
||||
@@ -76,7 +77,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
|
||||
|
||||
static void *c_start(struct seq_file *m, loff_t *pos)
|
||||
{
|
||||
return *pos < NR_CPUS ? cpu_data + *pos : NULL;
|
||||
return *pos < nr_cpu_ids ? cpu_data + *pos : NULL;
|
||||
}
|
||||
|
||||
static void *c_next(struct seq_file *m, void *v, loff_t *pos)
|
||||
@@ -358,6 +359,14 @@ void __init check_bugs(void)
|
||||
os_check_bugs();
|
||||
}
|
||||
|
||||
void apply_retpolines(s32 *start, s32 *end)
|
||||
{
|
||||
}
|
||||
|
||||
void apply_returns(s32 *start, s32 *end)
|
||||
{
|
||||
}
|
||||
|
||||
void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
|
||||
{
|
||||
}
|
||||
@@ -377,3 +386,27 @@ void *text_poke(void *addr, const void *opcode, size_t len)
|
||||
void text_poke_sync(void)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
void uml_pm_wake(void)
|
||||
{
|
||||
pm_system_wakeup();
|
||||
}
|
||||
|
||||
static int init_pm_wake_signal(void)
|
||||
{
|
||||
/*
|
||||
* In external time-travel mode we can't use signals to wake up
|
||||
* since that would mess with the scheduling. We'll have to do
|
||||
* some additional work to support wakeup on virtio devices or
|
||||
* similar, perhaps implementing a fake RTC controller that can
|
||||
* trigger wakeup (and request the appropriate scheduling from
|
||||
* the external scheduler when going to suspend.)
|
||||
*/
|
||||
if (time_travel_mode != TT_MODE_EXTERNAL)
|
||||
register_pm_wake_signal();
|
||||
return 0;
|
||||
}
|
||||
|
||||
late_initcall(init_pm_wake_signal);
|
||||
#endif
|
||||
|
||||
@@ -136,6 +136,16 @@ void set_sigstack(void *sig_stack, int size)
|
||||
panic("enabling signal stack failed, errno = %d\n", errno);
|
||||
}
|
||||
|
||||
static void sigusr1_handler(int sig, struct siginfo *unused_si, mcontext_t *mc)
|
||||
{
|
||||
uml_pm_wake();
|
||||
}
|
||||
|
||||
void register_pm_wake_signal(void)
|
||||
{
|
||||
set_handler(SIGUSR1);
|
||||
}
|
||||
|
||||
static void (*handlers[_NSIG])(int sig, struct siginfo *si, mcontext_t *mc) = {
|
||||
[SIGSEGV] = sig_handler,
|
||||
[SIGBUS] = sig_handler,
|
||||
@@ -145,7 +155,9 @@ static void (*handlers[_NSIG])(int sig, struct siginfo *si, mcontext_t *mc) = {
|
||||
|
||||
[SIGIO] = sig_handler,
|
||||
[SIGWINCH] = sig_handler,
|
||||
[SIGALRM] = timer_alarm_handler
|
||||
[SIGALRM] = timer_alarm_handler,
|
||||
|
||||
[SIGUSR1] = sigusr1_handler,
|
||||
};
|
||||
|
||||
static void hard_handler(int sig, siginfo_t *si, void *p)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
@@ -644,10 +645,24 @@ void halt_skas(void)
|
||||
UML_LONGJMP(&initial_jmpbuf, INIT_JMP_HALT);
|
||||
}
|
||||
|
||||
static bool noreboot;
|
||||
|
||||
static int __init noreboot_cmd_param(char *str, int *add)
|
||||
{
|
||||
noreboot = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
__uml_setup("noreboot", noreboot_cmd_param,
|
||||
"noreboot\n"
|
||||
" Rather than rebooting, exit always, akin to QEMU's -no-reboot option.\n"
|
||||
" This is useful if you're using CONFIG_PANIC_TIMEOUT in order to catch\n"
|
||||
" crashes in CI\n");
|
||||
|
||||
void reboot_skas(void)
|
||||
{
|
||||
block_signals_trace();
|
||||
UML_LONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT);
|
||||
UML_LONGJMP(&initial_jmpbuf, noreboot ? INIT_JMP_HALT : INIT_JMP_REBOOT);
|
||||
}
|
||||
|
||||
void __switch_mm(struct mm_id *mm_idp)
|
||||
|
||||
Reference in New Issue
Block a user