add:buildroot

This commit is contained in:
eng33 2023-11-10 19:30:33 +08:00 committed by luckfox-eng33
parent f840ab9fe6
commit 3958ea65e5
32 changed files with 324 additions and 4054 deletions

View File

@ -33,7 +33,7 @@ GLOBAL_INITRAMFS_BOOT_NAME=""
GLOBAL_PARTITIONS="" GLOBAL_PARTITIONS=""
GLOBAL_SDK_VERSION="" GLOBAL_SDK_VERSION=""
export RK_JOBS=$((`getconf _NPROCESSORS_ONLN` / 2 + 1 )) export RK_JOBS=$((`getconf _NPROCESSORS_ONLN` - 1 ))
export RK_BUILD_VERSION_TYPE=RELEASE export RK_BUILD_VERSION_TYPE=RELEASE
export SDK_ROOT_DIR=$SDK_ROOT_DIR export SDK_ROOT_DIR=$SDK_ROOT_DIR

View File

@ -24,6 +24,9 @@ export RK_KERNEL_DEFCONFIG=luckfox_rv1106_linux_defconfig
# Kernel dts # Kernel dts
export RK_KERNEL_DTS=rv1103g-luckfox-pico.dts export RK_KERNEL_DTS=rv1103g-luckfox-pico.dts
# Buildroot defconfig
export RK_BUILDROOT_DEFCONFIG=luckfox_pico_defconfig
#misc image #misc image
export RK_MISC=wipe_all-misc.img export RK_MISC=wipe_all-misc.img
@ -45,7 +48,7 @@ export RK_BOOTARGS_CMA_SIZE="24M"
# <partdef> := <size>[@<offset>](part-name) # <partdef> := <size>[@<offset>](part-name)
# Note: # Note:
# If the first partition offset is not 0x0, it must be added. Otherwise, it needn't adding. # If the first partition offset is not 0x0, it must be added. Otherwise, it needn't adding.
export RK_PARTITION_CMD_IN_ENV="32K(env),512K@32K(idblock),256K(uboot),32M(boot),2G(rootfs),1G(oem),2G(userdata),-(media)" export RK_PARTITION_CMD_IN_ENV="32K(env),512K@32K(idblock),256K(uboot),32M(boot),2G(rootfs),1G(oem),1G(userdata),-(media)"
# config partition's filesystem type (squashfs is readonly) # config partition's filesystem type (squashfs is readonly)
# emmc: squashfs/ext4 # emmc: squashfs/ext4
@ -56,7 +59,7 @@ export RK_PARTITION_CMD_IN_ENV="32K(env),512K@32K(idblock),256K(uboot),32M(boot)
# AAAA ----------> partition name # AAAA ----------> partition name
# /BBBB/CCCC ----> partition mount point # /BBBB/CCCC ----> partition mount point
# ext4 ----------> partition filesystem type # ext4 ----------> partition filesystem type
export RK_PARTITION_FS_TYPE_CFG=rootfs@IGNORE@ext4,userdata@/userdata@ext4,oem@/oem@ext4 export RK_PARTITION_FS_TYPE_CFG=rootfs@/@ext4,userdata@/userdata@ext4,oem@/oem@ext4
# config filesystem compress (Just for squashfs or ubifs) # config filesystem compress (Just for squashfs or ubifs)
# squashfs: lz4/lzo/lzma/xz/gzip, default xz # squashfs: lz4/lzo/lzma/xz/gzip, default xz
@ -67,6 +70,9 @@ export RK_PARTITION_FS_TYPE_CFG=rootfs@IGNORE@ext4,userdata@/userdata@ext4,oem@/
# app config # app config
export RK_APP_TYPE=RKIPC_RV1103 export RK_APP_TYPE=RKIPC_RV1103
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_OEM_SCRIPT=rv1103-spi_nor-post.sh
# build ipc web backend # build ipc web backend
# export RK_APP_IPCWEB_BACKEND=y # export RK_APP_IPCWEB_BACKEND=y

View File

@ -22,7 +22,10 @@ export RK_UBOOT_DEFCONFIG_FRAGMENT=rk-emmc.config
export RK_KERNEL_DEFCONFIG=luckfox_rv1106_linux_defconfig export RK_KERNEL_DEFCONFIG=luckfox_rv1106_linux_defconfig
# Kernel dts # Kernel dts
export RK_KERNEL_DTS=rv1103g-luckfox-pico-mini-b.dts export RK_KERNEL_DTS=rv1103g-luckfox-pico-mini-a.dts
# Buildroot defconfig
export RK_BUILDROOT_DEFCONFIG=luckfox_pico_defconfig
#misc image #misc image
export RK_MISC=wipe_all-misc.img export RK_MISC=wipe_all-misc.img

View File

@ -24,6 +24,9 @@ export RK_KERNEL_DEFCONFIG=luckfox_rv1106_linux_defconfig
# Kernel dts # Kernel dts
export RK_KERNEL_DTS=rv1103g-luckfox-pico-mini-b.dts export RK_KERNEL_DTS=rv1103g-luckfox-pico-mini-b.dts
# Buildroot defconfig
export RK_BUILDROOT_DEFCONFIG=luckfox_pico_defconfig
#misc image #misc image
export RK_MISC=wipe_all-misc.img export RK_MISC=wipe_all-misc.img
@ -32,15 +35,12 @@ export RK_MISC=wipe_all-misc.img
# "iqfile1 iqfile2 iqfile3 ..." # "iqfile1 iqfile2 iqfile3 ..."
# ./build.sh media and copy <SDK root dir>/output/out/media_out/isp_iqfiles/$RK_CAMERA_SENSOR_IQFILES # ./build.sh media and copy <SDK root dir>/output/out/media_out/isp_iqfiles/$RK_CAMERA_SENSOR_IQFILES
export RK_CAMERA_SENSOR_IQFILES="sc4336_OT01_40IRC_F16.json sc3336_CMK-OT2119-PC1_30IRC-F16.json" export RK_CAMERA_SENSOR_IQFILES="sc4336_OT01_40IRC_F16.json sc3336_CMK-OT2119-PC1_30IRC-F16.json"
#export RK_CAMERA_SENSOR_IQFILES="sc4336_OT01_40IRC_F16.json sc3336_CMK-OT2119-PC1_30IRC-F16.json sc530ai_CMK-OT2115-PC1_30IRC-F16.json"
# Config sensor lens CAC calibrattion bin files # Config sensor lens CAC calibrattion bin files
export RK_CAMERA_SENSOR_CAC_BIN="CAC_sc4336_OT01_40IRC_F16" export RK_CAMERA_SENSOR_CAC_BIN="CAC_sc4336_OT01_40IRC_F16"
#export RK_CAMERA_SENSOR_CAC_BIN="CAC_sc4336_OT01_40IRC_F16 CAC_sc530ai_CMK-OT2115-PC1_30IRC-F16"
# Config CMA size in environment # Config CMA size in environment
export RK_BOOTARGS_CMA_SIZE="24M" export RK_BOOTARGS_CMA_SIZE="24M"
#export RK_BOOTARGS_CMA_SIZE="66M"
# config partition in environment # config partition in environment
# RK_PARTITION_CMD_IN_ENV format: # RK_PARTITION_CMD_IN_ENV format:
@ -48,8 +48,7 @@ export RK_BOOTARGS_CMA_SIZE="24M"
# <partdef> := <size>[@<offset>](part-name) # <partdef> := <size>[@<offset>](part-name)
# Note: # Note:
# If the first partition offset is not 0x0, it must be added. Otherwise, it needn't adding. # If the first partition offset is not 0x0, it must be added. Otherwise, it needn't adding.
export RK_PARTITION_CMD_IN_ENV="256K(env),256K@256K(idblock),512K(uboot),4M(boot),32M(rootfs),48M(oem),32M(userdata)" export RK_PARTITION_CMD_IN_ENV="256K(env),256K@256K(idblock),512K(uboot),4M(boot),80M(rootfs),30M(oem),10M(userdata)"
#export RK_PARTITION_CMD_IN_ENV="256K(env),256K@256K(idblock),256K(uboot),8M(boot),32M(rootfs),48M(oem),32M(userdata),-(media)"
# config partition's filesystem type (squashfs is readonly) # config partition's filesystem type (squashfs is readonly)
# emmc: squashfs/ext4 # emmc: squashfs/ext4

View File

@ -24,6 +24,9 @@ export RK_KERNEL_DEFCONFIG=luckfox_rv1106_linux_defconfig
# Kernel dts # Kernel dts
export RK_KERNEL_DTS=rv1103g-luckfox-pico-plus.dts export RK_KERNEL_DTS=rv1103g-luckfox-pico-plus.dts
# Buildroot defconfig
export RK_BUILDROOT_DEFCONFIG=luckfox_pico_defconfig
#misc image #misc image
export RK_MISC=wipe_all-misc.img export RK_MISC=wipe_all-misc.img
@ -48,7 +51,7 @@ export RK_BOOTARGS_CMA_SIZE="24M"
# <partdef> := <size>[@<offset>](part-name) # <partdef> := <size>[@<offset>](part-name)
# Note: # Note:
# If the first partition offset is not 0x0, it must be added. Otherwise, it needn't adding. # If the first partition offset is not 0x0, it must be added. Otherwise, it needn't adding.
export RK_PARTITION_CMD_IN_ENV="256K(env),256K@256K(idblock),512K(uboot),4M(boot),32M(rootfs),48M(oem),32M(userdata)" export RK_PARTITION_CMD_IN_ENV="256K(env),256K@256K(idblock),512K(uboot),4M(boot),80M(rootfs),30M(oem),10M(userdata)"
#export RK_PARTITION_CMD_IN_ENV="256K(env),256K@256K(idblock),256K(uboot),8M(boot),32M(rootfs),48M(oem),32M(userdata),-(media)" #export RK_PARTITION_CMD_IN_ENV="256K(env),256K@256K(idblock),256K(uboot),8M(boot),32M(rootfs),48M(oem),32M(userdata),-(media)"
# config partition's filesystem type (squashfs is readonly) # config partition's filesystem type (squashfs is readonly)
@ -73,6 +76,9 @@ export RK_PARTITION_FS_TYPE_CFG=rootfs@IGNORE@ubifs,oem@/oem@ubifs,userdata@/use
export RK_APP_TYPE=RKIPC_RV1103 export RK_APP_TYPE=RKIPC_RV1103
# export RK_APP_TYPE=RKIPC_RV1106 # export RK_APP_TYPE=RKIPC_RV1106
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_OEM_SCRIPT=rv1103-spi_nor-post.sh
# build ipc web backend # build ipc web backend
# export RK_APP_IPCWEB_BACKEND=y # export RK_APP_IPCWEB_BACKEND=y

View File

@ -24,6 +24,9 @@ export RK_KERNEL_DEFCONFIG=luckfox_rv1106_linux_defconfig
# Kernel dts # Kernel dts
export RK_KERNEL_DTS=rv1106g-luckfox-pico-pro-max.dts export RK_KERNEL_DTS=rv1106g-luckfox-pico-pro-max.dts
# Buildroot defconfig
export RK_BUILDROOT_DEFCONFIG=luckfox_pico_defconfig
#misc image #misc image
export RK_MISC=wipe_all-misc.img export RK_MISC=wipe_all-misc.img
@ -32,11 +35,9 @@ export RK_MISC=wipe_all-misc.img
# "iqfile1 iqfile2 iqfile3 ..." # "iqfile1 iqfile2 iqfile3 ..."
# ./build.sh media and copy <SDK root dir>/output/out/media_out/isp_iqfiles/$RK_CAMERA_SENSOR_IQFILES # ./build.sh media and copy <SDK root dir>/output/out/media_out/isp_iqfiles/$RK_CAMERA_SENSOR_IQFILES
export RK_CAMERA_SENSOR_IQFILES="sc4336_OT01_40IRC_F16.json sc3336_CMK-OT2119-PC1_30IRC-F16.json" export RK_CAMERA_SENSOR_IQFILES="sc4336_OT01_40IRC_F16.json sc3336_CMK-OT2119-PC1_30IRC-F16.json"
#export RK_CAMERA_SENSOR_IQFILES="sc4336_OT01_40IRC_F16.json sc3336_CMK-OT2119-PC1_30IRC-F16.json sc530ai_CMK-OT2115-PC1_30IRC-F16.json"
# Config sensor lens CAC calibrattion bin files # Config sensor lens CAC calibrattion bin files
export RK_CAMERA_SENSOR_CAC_BIN="CAC_sc4336_OT01_40IRC_F16" export RK_CAMERA_SENSOR_CAC_BIN="CAC_sc4336_OT01_40IRC_F16"
#export RK_CAMERA_SENSOR_CAC_BIN="CAC_sc4336_OT01_40IRC_F16 CAC_sc530ai_CMK-OT2115-PC1_30IRC-F16"
# Config CMA size in environment # Config CMA size in environment
# export RK_BOOTARGS_CMA_SIZE="24M" # export RK_BOOTARGS_CMA_SIZE="24M"
@ -48,8 +49,8 @@ export RK_BOOTARGS_CMA_SIZE="66M"
# <partdef> := <size>[@<offset>](part-name) # <partdef> := <size>[@<offset>](part-name)
# Note: # Note:
# If the first partition offset is not 0x0, it must be added. Otherwise, it needn't adding. # If the first partition offset is not 0x0, it must be added. Otherwise, it needn't adding.
export RK_PARTITION_CMD_IN_ENV="256K(env),256K@256K(idblock),512K(uboot),4M(boot),32M(rootfs),48M(oem),160M(userdata)" export RK_PARTITION_CMD_IN_ENV="256K(env),256K@256K(idblock),512K(uboot),4M(boot),210M(rootfs),30M(oem),10M(userdata)"
#export RK_PARTITION_CMD_IN_ENV="256K(env),256K@256K(idblock),256K(uboot),8M(boot),32M(rootfs),48M(oem),32M(userdata),-(media)"
# config partition's filesystem type (squashfs is readonly) # config partition's filesystem type (squashfs is readonly)
# emmc: squashfs/ext4 # emmc: squashfs/ext4

1
sysdrv/.gitignore vendored
View File

@ -6,6 +6,7 @@ kmod-29
out out
# source # source
source/busybox source/busybox
source/buildroot
# source/kernel # source/kernel
# source/uboot # source/uboot
tools/board/android-tools/android-tools/ tools/board/android-tools/android-tools/

View File

@ -28,6 +28,10 @@ else
SYSDRV_LIB_TYPE ?= glibc SYSDRV_LIB_TYPE ?= glibc
endif endif
ifneq ($(RK_BUILDROOT_DEFCONFIG),)
BUILDROOT_DEFCONFIG := $(RK_BUILDROOT_DEFCONFIG)
endif
SYSDRV_ROOTFS_FS_TYPE ?= $(fs_type) SYSDRV_ROOTFS_FS_TYPE ?= $(fs_type)
ifneq ($(RK_ROOTFS_FS_TPYE),) ifneq ($(RK_ROOTFS_FS_TPYE),)
SYSDRV_ROOTFS_FS_TYPE := $(RK_ROOTFS_FS_TPYE) SYSDRV_ROOTFS_FS_TYPE := $(RK_ROOTFS_FS_TPYE)
@ -221,8 +225,10 @@ $(error Please config TINY_ROOTFS_BUSYBOX_CFG on cfg/cfg.mk)
endif endif
endif endif
BUSYBOX_CFG ?= config_normal BUSYBOX_CFG ?= config_normal
BUSYBOX_VER ?= busybox-1.27.2
BUSYBOX_DIR := $(SYSDRV_DIR)/source/busybox BUILDROOT_CFG ?= config_normal
BUILDROOT_VER ?= buildroot-2023.02.6
BUILDROOT_DIR := $(SYSDRV_DIR)/source/buildroot
TOOLCHAIN_RUNTIME_LIB_C:=lib.tar.bz2 TOOLCHAIN_RUNTIME_LIB_C:=lib.tar.bz2
@ -265,7 +271,7 @@ endif
################################################################################ ################################################################################
all: uboot kernel rootfs env all: uboot kernel rootfs env
clean: uboot_clean kernel_clean busybox_clean pctools_clean boardtools_clean rootfs_clean drv_clean clean: uboot_clean kernel_clean buildroot_clean pctools_clean boardtools_clean rootfs_clean drv_clean
distclean: clean out_clean distclean: clean out_clean
@ -318,13 +324,13 @@ help:
@echo -e "$(C_YELLOW) make uboot [BOOT_MEDIUM=...] # build uboot $(C_NORMAL)" @echo -e "$(C_YELLOW) make uboot [BOOT_MEDIUM=...] # build uboot $(C_NORMAL)"
@echo -e "$(C_YELLOW) make kernel [BOOT_MEDIUM=...] # build kernel $(C_NORMAL)" @echo -e "$(C_YELLOW) make kernel [BOOT_MEDIUM=...] # build kernel $(C_NORMAL)"
@echo -e "$(C_YELLOW) make rootfs [BOOT_MEDIUM=...] # build rootfs $(C_NORMAL)" @echo -e "$(C_YELLOW) make rootfs [BOOT_MEDIUM=...] # build rootfs $(C_NORMAL)"
@echo -e "$(C_YELLOW) make rootfs_ubi # force package ubi rootfs image$(C_NORMAL)" @echo -e "$(C_YELLOW) make rootfs_ubi # force package ubi rootfs image$(C_NORMAL)"
@echo -e "$(C_YELLOW) make rootfs_ext4 # force package ext4 rootfs image$(C_NORMAL)" @echo -e "$(C_YELLOW) make rootfs_ext4 # force package ext4 rootfs image$(C_NORMAL)"
@echo -e "$(C_YELLOW) make rootfs_jffs2 # force package jffs2 rootfs image$(C_NORMAL)" @echo -e "$(C_YELLOW) make rootfs_jffs2 # force package jffs2 rootfs image$(C_NORMAL)"
@echo -e "$(C_YELLOW) make rootfs_squashfs # force package squashfs rootfs image$(C_NORMAL)" @echo -e "$(C_YELLOW) make rootfs_squashfs # force package squashfs rootfs image$(C_NORMAL)"
@echo -e "$(C_YELLOW) make rootfs_erofs # force package erofs rootfs image$(C_NORMAL)" @echo -e "$(C_YELLOW) make rootfs_erofs # force package erofs rootfs image$(C_NORMAL)"
@echo -e "$(C_YELLOW) make rootfs_initramfs # force package initramfs rootfs image$(C_NORMAL)" @echo -e "$(C_YELLOW) make rootfs_initramfs # force package initramfs rootfs image$(C_NORMAL)"
@echo -e "$(C_YELLOW) make busybox_menuconfig # config busybox $(C_NORMAL)" @echo -e "$(C_YELLOW) make buildroot_menuconfig # config buildroot $(C_NORMAL)"
@echo -e "$(C_YELLOW)------------------------------------------------------------------------- $(C_NORMAL)" @echo -e "$(C_YELLOW)------------------------------------------------------------------------- $(C_NORMAL)"
################################################################################ ################################################################################
@ -425,46 +431,49 @@ rootfs_prepare: prepare
popd popd
########################################################################################## ##########################################################################################
# build busybox # build buildroot
########################################################################################## ##########################################################################################
busybox_menuconfig: buildroot_menuconfig:
@$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) menuconfig \ $(MAKE) menuconfig -C $(BUILDROOT_DIR)/$(BUILDROOT_VER)
-C $(BUSYBOX_DIR)/$(BUSYBOX_VER)/ $(MAKE) source -C $(BUILDROOT_DIR)/$(BUILDROOT_VER)
@cp -f $(BUSYBOX_DIR)/$(BUSYBOX_VER)/.config \
$(SYSDRV_DIR)/tools/board/busybox/$(BUSYBOX_CFG);
busybox: prepare
@echo -e "$(C_GREEN) ==sysdrv== build busybox $(C_NORMAL)" buildroot: prepare
test -f $(BUSYBOX_DIR)/$(BUSYBOX_VER)/_install/bin/busybox || (\ @echo -e "$(C_GREEN) ==sysdrv== build buildroot $(C_NORMAL)"
rm $(BUSYBOX_DIR)/$(BUSYBOX_VER) -rf ;\ test -f $(BUILDROOT_DIR)/$(BUILDROOT_VER)/output/target/bin/busybox || (\
mkdir -p $(BUSYBOX_DIR) ;\ rm $(BUILDROOT_DIR)/$(BUILDROOT_VER) -rf ;\
tar xjf $(SYSDRV_DIR)/tools/board/busybox/$(BUSYBOX_VER).tar.bz2 -C $(BUSYBOX_DIR) ;\ mkdir -p $(BUILDROOT_DIR) ;\
cp $(SYSDRV_DIR)/tools/board/busybox/$(BUSYBOX_CFG) $(BUSYBOX_DIR)/$(BUSYBOX_VER)/.config ;\ tar xzf $(SYSDRV_DIR)/tools/board/buildroot/$(BUILDROOT_VER).tar.gz -C $(BUILDROOT_DIR) ;\
cp -fv $(SYSDRV_DIR)/tools/board/busybox/*.patch $(SYSDRV_DIR)/tools/board/busybox/busybox.patch.sh $(BUSYBOX_DIR)/$(BUSYBOX_VER)/ ;\
pushd $(BUSYBOX_DIR)/$(BUSYBOX_VER)/;$(SHELL) ./busybox.patch.sh ; $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -j$(SYSDRV_JOBS) ; popd ;\
$(MAKE) CROSS_COMPILE=$(CROSS_COMPILE) -C $(BUSYBOX_DIR)/$(BUSYBOX_VER) install ;\
); );
$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) $(BUILDROOT_DEFCONFIG) -C $(BUILDROOT_DIR)/$(BUILDROOT_VER)
$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) source -C $(BUILDROOT_DIR)/$(BUILDROOT_VER)
$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -j$(SYSDRV_JOBS) -C $(BUILDROOT_DIR)/$(BUILDROOT_VER)
ifeq ($(SYSDRV_BUILD_RAMDISK_FLAG),YES) ifeq ($(SYSDRV_BUILD_RAMDISK_FLAG),YES)
tar xf $(SYSDRV_DIR)/tools/board/rootfs_script.tar -C $(BUSYBOX_DIR)/$(BUSYBOX_VER)/_install tar xf $(SYSDRV_DIR)/tools/board/rootfs_script.tar -C $(BUILDROOT_DIR)/$(BUILDROOT_VER)/output/target
ifneq ($(OUTPUT_SYSDRV_RAMDISK_TINY_ROOTFS_DIR),) ifneq ($(OUTPUT_SYSDRV_RAMDISK_TINY_ROOTFS_DIR),)
$(call MAROC_COPY_PKG_TO_SYSDRV_OUTPUT, $(OUTPUT_SYSDRV_RAMDISK_TINY_ROOTFS_DIR), \ $(call MAROC_COPY_PKG_TO_SYSDRV_OUTPUT, $(OUTPUT_SYSDRV_RAMDISK_TINY_ROOTFS_DIR), \
$(SYSDRV_DIR)/tools/board/busybox/init \ $(SYSDRV_DIR)/tools/board/buildroot/busybox/init \
$(BUSYBOX_DIR)/$(BUSYBOX_VER)/_install) $(BUILDROOT_DIR)/$(BUILDROOT_VER)/output/target)
else
$(call MAROC_COPY_PKG_TO_SYSDRV_OUTPUT, $(SYSDRV_DIR_OUT_ROOTFS), \
$(SYSDRV_DIR)/tools/board/buildroot/busybox/init \
$(BUILDROOT_DIR)/$(BUILDROOT_VER)/output/target)
endif
else else
$(call MAROC_COPY_PKG_TO_SYSDRV_OUTPUT, $(SYSDRV_DIR_OUT_ROOTFS), \ tar xf $(BUILDROOT_DIR)/$(BUILDROOT_VER)/output/images/rootfs.tar -C $(SYSDRV_DIR_OUT_ROOTFS)
$(SYSDRV_DIR)/tools/board/busybox/init \ cp $(SYSDRV_DIR)/tools/board/buildroot/shadow_defconfig $(SYSDRV_DIR_OUT_ROOTFS)/etc/shadow
$(BUSYBOX_DIR)/$(BUSYBOX_VER)/_install) cp $(SYSDRV_DIR)/tools/board/buildroot/sshd_defconfig $(SYSDRV_DIR_OUT_ROOTFS)/etc/ssh/sshd_config
endif cp $(SYSDRV_DIR)/tools/board/buildroot/samba_defconfig $(SYSDRV_DIR_OUT_ROOTFS)/etc/samba/smb.conf
else cp $(SYSDRV_DIR)/tools/board/buildroot/smbpasswd_defconfig $(SYSDRV_DIR_OUT_ROOTFS)/etc/samba/smbpasswd
cp -af $(BUSYBOX_DIR)/$(BUSYBOX_VER)/_install/* $(SYSDRV_DIR_OUT_ROOTFS) cp $(SYSDRV_DIR)/tools/board/buildroot/S50sshd $(SYSDRV_DIR_OUT_ROOTFS)/etc/init.d/
cp $(SYSDRV_DIR)/tools/board/buildroot/S99python $(SYSDRV_DIR_OUT_ROOTFS)/etc/init.d/
# luckfox cp $(SYSDRV_DIR)/tools/board/android-tools/S90usb0config $(SYSDRV_DIR_OUT_ROOTFS)/etc/init.d/
cp $(SYSDRV_DIR)/tools/board/android-tools/S99usb0config $(SYSDRV_DIR_OUT_ROOTFS)/etc/init.d
endif endif
busybox_clean: buildroot_clean:
$(AT)rm -rf $(BUSYBOX_DIR)/$(BUSYBOX_VER) $(AT)rm -rf $(BUILDROOT_DIR)/$(BUILDROOT_VER)
########################################################################################## ##########################################################################################
# build pc tools # build pc tools
@ -511,7 +520,7 @@ drv_clean:
########################################################################################## ##########################################################################################
# build rootfs # build rootfs
########################################################################################## ##########################################################################################
rootfs: rootfs_prepare pctools busybox boardtools drv rootfs: rootfs_prepare pctools buildroot boardtools drv
@echo -e "$(C_GREEN) ==sysdrv== build rootfs $(C_NORMAL)" @echo -e "$(C_GREEN) ==sysdrv== build rootfs $(C_NORMAL)"
make -C $(SYSDRV_DIR) strip make -C $(SYSDRV_DIR) strip
pushd $(SYSDRV_DIR)/out;tar cf $(OUT_ROOTFS).tar $(OUT_ROOTFS);popd pushd $(SYSDRV_DIR)/out;tar cf $(OUT_ROOTFS).tar $(OUT_ROOTFS);popd

View File

@ -0,0 +1,48 @@
#!/bin/sh
#
# sshd Starts sshd.
#
# Make sure the ssh-keygen progam exists
[ -f /usr/bin/ssh-keygen ] || exit 0
umask 077
start() {
chown root:root /var/empty/
# Create any missing keys
/usr/bin/ssh-keygen -A
printf "Starting sshd: "
/usr/sbin/sshd
touch /var/lock/sshd
echo "OK"
}
stop() {
printf "Stopping sshd: "
killall sshd
rm -f /var/lock/sshd
echo "OK"
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?

View File

@ -0,0 +1,55 @@
#!/bin/sh
#
# python Starts python code.
#
# Make sure the python progam exists
[ -f /usr/bin/python ] || exit 0
umask 077
main_path="/root/main.py"
boot_path="/root/boot.py"
start() {
# Run python progam
if [ -f $main_path ]; then
echo "running $main_path..."
python $main_path
else
if [ -f $boot_path ]; then
echo "running $boot_path..."
python $boot_path
else
echo "$main_path and $boot_path not exist ,pass..."
fi
fi
echo "OK"
}
stop() {
printf "Stopping python: "
killall python
echo "OK"
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?

View File

@ -0,0 +1,13 @@
[global]
workgroup = WORKGROUP
server string = luckfox samba server
security = user
passdb backend = smbpasswd
smb passwd file = /etc/samba/smbpasswd
[public]
comment = public share
path = /
read only = no
user = root
create mask = 0755
directory mask = 0755

View File

@ -0,0 +1,9 @@
root:$1$dXmV8ZLO$eNAQzSYOgRkYMJRdsHwLS1:19664::::::
daemon:*:::::::
bin:*:::::::
sys:*:::::::
sync:*:::::::
mail:*:::::::
www-data:*:::::::
operator:*:::::::
nobody:*:::::::

View File

@ -0,0 +1 @@
root:0:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:EF8BDD6C516032CDB7C15080FFE1B2D5:[U ]:LCT-5FEF3549:

View File

@ -0,0 +1,116 @@
# $OpenBSD: sshd_config,v 1.104 2021/07/02 05:11:21 dtucker Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/bin:/sbin:/usr/bin:/usr/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value.
#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key
# Ciphers and keying
#RekeyLimit default none
# Logging
#SyslogFacility AUTH
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
#PubkeyAuthentication yes
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile .ssh/authorized_keys
#AuthorizedPrincipalsFile none
#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes
# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
# Change to no to disable s/key passwords
#KbdInteractiveAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the KbdInteractiveAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via KbdInteractiveAuthentication may bypass
# the setting of "PermitRootLogin prohibit-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and KbdInteractiveAuthentication to 'no'.
#UsePAM no
#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none
# no default banner path
#Banner none
# override default of no subsystems
Subsystem sftp /usr/libexec/sftp-server
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server

View File

@ -1,29 +0,0 @@
From d4fec31889ad660a58dab633c511221feb66e817 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Sat, 5 Oct 2013 15:55:06 +0200
Subject: [PATCH] networking/libiproute: use <linux/if_packet.h> instead of
<net/if_packet.h>
The musl C library doesn't provide the <net/if_packet.h> since the
corresponding kernel headers <linux/if_packet.h> already provides the
necessary definitions. Replacing <net/if_packet.h> by
<linux/if_packet.h> also removes the need to include
<netpacket/packet.h>
This commit fixes the build of iplink with the musl C library.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[Gustavo: update for busybox 1.22.0]
diff -Nura busybox-1.22.0.orig/networking/libiproute/iplink.c busybox-1.22.0/networking/libiproute/iplink.c
--- busybox-1.22.0.orig/networking/libiproute/iplink.c 2014-01-01 09:42:40.301137882 -0300
+++ busybox-1.22.0/networking/libiproute/iplink.c 2014-01-01 09:43:01.282827700 -0300
@@ -7,7 +7,7 @@
*/
#include <net/if.h>
/*#include <net/if_packet.h> - not needed? */
-#include <netpacket/packet.h>
+#include <linux/if_packet.h>
#include <netinet/if_ether.h>
#include <linux/if_vlan.h>

View File

@ -1,28 +0,0 @@
From 67eb23d2be8aba3c474dac81a15b0fa11e5847b7 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Mon, 25 Nov 2013 22:51:53 +0100
Subject: [PATCH] Makefile.flags: strip non -l arguments returned by pkg-config
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile.flags | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Makefile.flags b/Makefile.flags
index 307afa7..885e323 100644
--- a/Makefile.flags
+++ b/Makefile.flags
@@ -141,7 +141,9 @@ ifeq ($(CONFIG_SELINUX),y)
SELINUX_PC_MODULES = libselinux libsepol
$(eval $(call pkg_check_modules,SELINUX,$(SELINUX_PC_MODULES)))
CPPFLAGS += $(SELINUX_CFLAGS)
-LDLIBS += $(if $(SELINUX_LIBS),$(SELINUX_LIBS:-l%=%),$(SELINUX_PC_MODULES:lib%=%))
+LDLIBS += $(if $(SELINUX_LIBS),\
+ $(patsubst -l%,%,$(filter -l%,$(SELINUX_LIBS))),\
+ $(SELINUX_PC_MODULES:lib%=%))
endif
ifeq ($(CONFIG_EFENCE),y)
--
1.8.1.2

View File

@ -1,46 +0,0 @@
From 2c240f131ae5cc981702b45397be3b311c67a9ee Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Fri, 14 Jul 2017 22:23:46 +0200
Subject: [PATCH] Makefile: include per-arch Makefile before Makefile.flags
Makefile.flags contains:
ARCH_FPIC ?= -fpic
ARCH_FPIE ?= -fpie
However, arch/$(ARCH)/Makefile gets included *after* Makefile.flags,
and therefore doesn't get the chance to provide its own value.
Fix this by including arch/$(ARCH)/Makefile *before* Makefile.flags.
[Submitted upstream: http://lists.busybox.net/pipermail/busybox/2017-July/085632.html]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 971e68e..fe85070 100644
--- a/Makefile
+++ b/Makefile
@@ -508,6 +508,8 @@ ifeq ($(dot-config),1)
# To avoid any implicit rule to kick in, define an empty command
.config .kconfig.d: ;
+-include $(srctree)/arch/$(ARCH)/Makefile
+
# Now we can define CFLAGS etc according to .config
include $(srctree)/Makefile.flags
@@ -531,8 +533,6 @@ endif
# Defaults busybox but it is usually overridden in the arch makefile
all: busybox doc
--include $(srctree)/arch/$(ARCH)/Makefile
-
# arch Makefile may override CC so keep this after arch Makefile is included
#bbox# NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
CHECKFLAGS += $(NOSTDINC_FLAGS)
--
2.9.4

View File

@ -1,79 +0,0 @@
From 43593d65827f4e7f848fc410321b0b2deed986fc Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Fri, 14 Jul 2017 21:54:37 +0200
Subject: [PATCH] arch/{sparc,sparc64}/Makefile: define ARCH_FPIC
Building Busybox on SPARC or SPARC64 with CONFIG_BUILD_LIBBUSYBOX=y
currently fails with:
miscutils/lib.a(i2c_tools.o): In function `i2c_dev_open':
i2c_tools.c:(.text.i2c_dev_open+0x14): relocation truncated to fit: R_SPARC_GOT13 against `.LC0'
i2c_tools.c:(.text.i2c_dev_open+0x38): relocation truncated to fit: R_SPARC_GOT13 against symbol `bb_errno' defined in COMMON section in libbb/lib.a(ptr_to_globals.o)
i2c_tools.c:(.text.i2c_dev_open+0x6c): relocation truncated to fit: R_SPARC_GOT13 against `.LC1'
miscutils/lib.a(i2c_tools.o): In function `check_funcs_test_end':
i2c_tools.c:(.text.check_funcs_test_end+0x24): relocation truncated to fit: R_SPARC_GOT13 against `.LC2'
i2c_tools.c:(.text.check_funcs_test_end+0x2c): relocation truncated to fit: R_SPARC_GOT13 against `.LC3'
miscutils/lib.a(i2c_tools.o): In function `check_read_funcs':
i2c_tools.c:(.text.check_read_funcs+0x30): relocation truncated to fit: R_SPARC_GOT13 against `.LC10'
i2c_tools.c:(.text.check_read_funcs+0x80): relocation truncated to fit: R_SPARC_GOT13 against `.LC4'
i2c_tools.c:(.text.check_read_funcs+0x98): relocation truncated to fit: R_SPARC_GOT13 against `.LC5'
i2c_tools.c:(.text.check_read_funcs+0xc0): relocation truncated to fit: R_SPARC_GOT13 against `.LC6'
i2c_tools.c:(.text.check_read_funcs+0xe0): relocation truncated to fit: R_SPARC_GOT13 against `.LC7'
i2c_tools.c:(.text.check_read_funcs+0xf8): additional relocation overflows omitted from the output
As stated by the gcc documentation, the SPARC architecture has a
limited GOT size, which prevents moderately large binaries to be built
with -fpic, and -fPIC is necessary. From gcc's documentation:
'-fpic'
Generate position-independent code (PIC) suitable for use in a
shared library, if supported for the target machine. Such code
accesses all constant addresses through a global offset table
(GOT). The dynamic loader resolves the GOT entries when the
program starts (the dynamic loader is not part of GCC; it is part
of the operating system). If the GOT size for the linked
executable exceeds a machine-specific maximum size, you get an
error message from the linker indicating that '-fpic' does not
work; in that case, recompile with '-fPIC' instead. (These
maximums are 8k on the SPARC, 28k on AArch64 and 32k on the m68k
and RS/6000. The x86 has no such limit.)
'-fPIC'
If supported for the target machine, emit position-independent
code, suitable for dynamic linking and avoiding any limit on the
size of the global offset table. This option makes a difference on
AArch64, m68k, PowerPC and SPARC.
With a limit of 8KB on SPARC, we quickly reach this limit, and we hit
it when building Busybox on SPARC/SPARC64 with the
CONFIG_BUILD_LIBBUSYBOX=y option enabled.
Therefore, this commit redefines ARCH_FPIC as -fPIC on sparc and
sparc64 to solve this issue.
[Submitted upstream: http://lists.busybox.net/pipermail/busybox/2017-July/085633.html]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
arch/sparc/Makefile | 1 +
arch/sparc64/Makefile | 1 +
2 files changed, 2 insertions(+)
create mode 100644 arch/sparc/Makefile
create mode 100644 arch/sparc64/Makefile
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
new file mode 100644
index 0000000..4d6c5fb
--- /dev/null
+++ b/arch/sparc/Makefile
@@ -0,0 +1 @@
+ARCH_FPIC = -fPIC
diff --git a/arch/sparc64/Makefile b/arch/sparc64/Makefile
new file mode 100644
index 0000000..4d6c5fb
--- /dev/null
+++ b/arch/sparc64/Makefile
@@ -0,0 +1 @@
+ARCH_FPIC = -fPIC
--
2.9.4

View File

@ -1,27 +0,0 @@
From 2b400d9b2b7309d6e479102fc3ce646e893058a5 Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <vda.linux@googlemail.com>
Date: Mon, 18 Sep 2017 13:09:11 +0200
Subject: [PATCH] httpd: fix handling of range requests
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
networking/httpd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/networking/httpd.c b/networking/httpd.c
index e072f23c7..5e32fc936 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -2337,7 +2337,7 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
if (STRNCASECMP(iobuf, "Range:") == 0) {
/* We know only bytes=NNN-[MMM] */
char *s = skip_whitespace(iobuf + sizeof("Range:")-1);
- if (is_prefixed_with(s, "bytes=") == 0) {
+ if (is_prefixed_with(s, "bytes=")) {
s += sizeof("bytes=")-1;
range_start = BB_STRTOOFF(s, &s, 10);
if (s[0] != '-' || range_start < 0) {
--
2.11.0

View File

@ -1,101 +0,0 @@
From 0402cb32df015d9372578e3db27db47b33d5c7b0 Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <vda.linux@googlemail.com>
Date: Sun, 22 Oct 2017 18:23:23 +0200
Subject: [PATCH] bunzip2: fix runCnt overflow from bug 10431
This particular corrupted file can be dealth with by using "unsigned".
If there will be cases where it genuinely overflows, there is a disabled
code to deal with that too.
function old new delta
get_next_block 1678 1667 -11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
Patch status: upstream commit 0402cb32df0
archival/libarchive/decompress_bunzip2.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/archival/libarchive/decompress_bunzip2.c b/archival/libarchive/decompress_bunzip2.c
index 7cd18f5ed4cf..bec89edd3a4d 100644
--- a/archival/libarchive/decompress_bunzip2.c
+++ b/archival/libarchive/decompress_bunzip2.c
@@ -156,15 +156,15 @@ static unsigned get_bits(bunzip_data *bd, int bits_wanted)
static int get_next_block(bunzip_data *bd)
{
struct group_data *hufGroup;
- int dbufCount, dbufSize, groupCount, *base, *limit, selector,
- i, j, runPos, symCount, symTotal, nSelectors, byteCount[256];
- int runCnt = runCnt; /* for compiler */
+ int groupCount, *base, *limit, selector,
+ i, j, symCount, symTotal, nSelectors, byteCount[256];
uint8_t uc, symToByte[256], mtfSymbol[256], *selectors;
uint32_t *dbuf;
unsigned origPtr, t;
+ unsigned dbufCount, runPos;
+ unsigned runCnt = runCnt; /* for compiler */
dbuf = bd->dbuf;
- dbufSize = bd->dbufSize;
selectors = bd->selectors;
/* In bbox, we are ok with aborting through setjmp which is set up in start_bunzip */
@@ -187,7 +187,7 @@ static int get_next_block(bunzip_data *bd)
it didn't actually work. */
if (get_bits(bd, 1)) return RETVAL_OBSOLETE_INPUT;
origPtr = get_bits(bd, 24);
- if ((int)origPtr > dbufSize) return RETVAL_DATA_ERROR;
+ if (origPtr > bd->dbufSize) return RETVAL_DATA_ERROR;
/* mapping table: if some byte values are never used (encoding things
like ascii text), the compression code removes the gaps to have fewer
@@ -435,7 +435,14 @@ static int get_next_block(bunzip_data *bd)
symbols, but a run of length 0 doesn't mean anything in this
context). Thus space is saved. */
runCnt += (runPos << nextSym); /* +runPos if RUNA; +2*runPos if RUNB */
- if (runPos < dbufSize) runPos <<= 1;
+//The 32-bit overflow of runCnt wasn't yet seen, but probably can happen.
+//This would be the fix (catches too large count way before it can overflow):
+// if (runCnt > bd->dbufSize) {
+// dbg("runCnt:%u > dbufSize:%u RETVAL_DATA_ERROR",
+// runCnt, bd->dbufSize);
+// return RETVAL_DATA_ERROR;
+// }
+ if (runPos < bd->dbufSize) runPos <<= 1;
goto end_of_huffman_loop;
}
@@ -445,14 +452,15 @@ static int get_next_block(bunzip_data *bd)
literal used is the one at the head of the mtfSymbol array.) */
if (runPos != 0) {
uint8_t tmp_byte;
- if (dbufCount + runCnt > dbufSize) {
- dbg("dbufCount:%d+runCnt:%d %d > dbufSize:%d RETVAL_DATA_ERROR",
- dbufCount, runCnt, dbufCount + runCnt, dbufSize);
+ if (dbufCount + runCnt > bd->dbufSize) {
+ dbg("dbufCount:%u+runCnt:%u %u > dbufSize:%u RETVAL_DATA_ERROR",
+ dbufCount, runCnt, dbufCount + runCnt, bd->dbufSize);
return RETVAL_DATA_ERROR;
}
tmp_byte = symToByte[mtfSymbol[0]];
byteCount[tmp_byte] += runCnt;
- while (--runCnt >= 0) dbuf[dbufCount++] = (uint32_t)tmp_byte;
+ while ((int)--runCnt >= 0)
+ dbuf[dbufCount++] = (uint32_t)tmp_byte;
runPos = 0;
}
@@ -466,7 +474,7 @@ static int get_next_block(bunzip_data *bd)
first symbol in the mtf array, position 0, would have been handled
as part of a run above. Therefore 1 unused mtf position minus
2 non-literal nextSym values equals -1.) */
- if (dbufCount >= dbufSize) return RETVAL_DATA_ERROR;
+ if (dbufCount >= bd->dbufSize) return RETVAL_DATA_ERROR;
i = nextSym - 1;
uc = mtfSymbol[i];
--
2.15.1

View File

@ -1,34 +0,0 @@
From 9ac42c500586fa5f10a1f6d22c3f797df11b1f6b Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <vda.linux@googlemail.com>
Date: Fri, 27 Oct 2017 15:37:03 +0200
Subject: [PATCH] unlzma: fix SEGV, closes 10436
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
Patch status: upstream commit 9ac42c500586f
archival/libarchive/decompress_unlzma.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/archival/libarchive/decompress_unlzma.c b/archival/libarchive/decompress_unlzma.c
index a9040877efa0..be4342414435 100644
--- a/archival/libarchive/decompress_unlzma.c
+++ b/archival/libarchive/decompress_unlzma.c
@@ -450,8 +450,12 @@ unpack_lzma_stream(transformer_state_t *xstate)
IF_NOT_FEATURE_LZMA_FAST(string:)
do {
uint32_t pos = buffer_pos - rep0;
- if ((int32_t)pos < 0)
+ if ((int32_t)pos < 0) {
pos += header.dict_size;
+ /* bug 10436 has an example file where this triggers: */
+ if ((int32_t)pos < 0)
+ goto bad;
+ }
previous_byte = buffer[pos];
IF_NOT_FEATURE_LZMA_FAST(one_byte2:)
buffer[buffer_pos++] = previous_byte;
--
2.15.1

View File

@ -1,58 +0,0 @@
From 095248c1d232c147f53d4c8666b80b4c1cbb2d2a Mon Sep 17 00:00:00 2001
From: "hero.huang" <hero.huang@rock-chips.com>
Date: Wed, 23 Aug 2017 11:33:47 +0800
Subject: [PATCH] busybox: support chinese display in terminal
Signed-off-by: hero.huang <hero.huang@rock-chips.com>
---
libbb/printable_string.c | 4 +---
libbb/unicode.c | 4 ++--
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/libbb/printable_string.c b/libbb/printable_string.c
index 077d58d..e7399ae 100644
--- a/libbb/printable_string.c
+++ b/libbb/printable_string.c
@@ -28,8 +28,6 @@ const char* FAST_FUNC printable_string(uni_stat_t *stats, const char *str)
}
if (c < ' ')
break;
- if (c >= 0x7f)
- break;
s++;
}
@@ -42,7 +40,7 @@ const char* FAST_FUNC printable_string(uni_stat_t *stats, const char *str)
unsigned char c = *d;
if (c == '\0')
break;
- if (c < ' ' || c >= 0x7f)
+ if (c < ' ')
*d = '?';
d++;
}
diff --git a/libbb/unicode.c b/libbb/unicode.c
index 9c4da50..c7eba06 100644
--- a/libbb/unicode.c
+++ b/libbb/unicode.c
@@ -1019,7 +1019,7 @@ static char* FAST_FUNC unicode_conv_to_printable2(uni_stat_t *stats, const char
while ((int)--width >= 0);
break;
}
- *d++ = (c >= ' ' && c < 0x7f) ? c : '?';
+ *d++ = (c >= ' ') ? c : '?';
src++;
}
*d = '\0';
@@ -1027,7 +1027,7 @@ static char* FAST_FUNC unicode_conv_to_printable2(uni_stat_t *stats, const char
d = dst = xstrndup(src, width);
while (*d) {
unsigned char c = *d;
- if (c < ' ' || c >= 0x7f)
+ if (c < ' ')
*d = '?';
d++;
}
--
1.9.1

View File

@ -1,88 +0,0 @@
From e9e7cce0cdbd50afa6db7748546d76f0280c1756 Mon Sep 17 00:00:00 2001
From: Jeffy Chen <jeffy.chen@rock-chips.com>
Date: Tue, 18 Sep 2018 11:32:04 +0800
Subject: [PATCH] halt: Support rebooting with arg
Support passing reboot arg(e.g. loader, fastboot, etc.) to kernel.
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
init/halt.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/init/halt.c b/init/halt.c
index f69b897..523c925 100644
--- a/init/halt.c
+++ b/init/halt.c
@@ -83,6 +83,8 @@
#include "libbb.h"
#include "reboot.h"
+#include <linux/reboot.h>
+#include <sys/syscall.h>
#if ENABLE_FEATURE_WTMP
#include <sys/utsname.h>
@@ -109,6 +111,47 @@ static void write_wtmp(void)
#define write_wtmp() ((void)0)
#endif
+static volatile int caught_sigterm = FALSE;
+static void signal_handler(int sig)
+{
+ bb_error_msg("Caught signal %d", sig);
+
+ if (sig == SIGTERM)
+ caught_sigterm = TRUE;
+}
+
+static int reboot_with_arg(const char *arg)
+{
+ struct sigaction sa;
+ int pid;
+
+ /* Fork new thread to handle reboot */
+ if ((pid = fork()))
+ return pid < 0 ? pid : 0;
+
+ /* Handle signal and reboot in child thread */
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sa.sa_handler = signal_handler;
+ sigaction_set(SIGTERM, &sa);
+
+ bb_error_msg("Waiting for SIGTERM");
+
+ /* The init will send SIGTERM to us after SHUTDOWN actions */
+ while (!caught_sigterm)
+ usleep(50000);
+
+ bb_error_msg("Ready to reboot");
+
+ /* Wait 200ms for other processes to exit */
+ usleep(200000);
+ sync();
+
+ bb_error_msg("Rebooting with arg(%s)", arg);
+ return syscall(__NR_reboot, LINUX_REBOOT_MAGIC1,
+ LINUX_REBOOT_MAGIC2,
+ LINUX_REBOOT_CMD_RESTART2, arg);
+}
int halt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int halt_main(int argc UNUSED_PARAM, char **argv)
@@ -186,6 +229,11 @@ int halt_main(int argc UNUSED_PARAM, char **argv)
CONFIG_TELINIT_PATH);
}
}
+
+ /* Handle rebooting with arg */
+ if (signals[which] == SIGTERM && argc > 1 && argv[1][0] != '-')
+ rc = reboot_with_arg(argv[1]);
+
} else {
rc = reboot(magic[which]);
}
--
2.11.0

View File

@ -1,103 +0,0 @@
From 29b6a7aa491115ef64ecd506a2945e48f09f8a56 Mon Sep 17 00:00:00 2001
From: Alistair Francis <alistair.francis@wdc.com>
Date: Tue, 19 Nov 2019 13:06:40 +0100
Subject: [PATCH] Remove stime() function calls
stime() has been deprecated in glibc 2.31 and replaced with
clock_settime(). Let's replace the stime() function calls with
clock_settime() in preperation.
function old new delta
rdate_main 197 224 +27
clock_settime - 27 +27
date_main 926 941 +15
stime 37 - -37
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 2/0 up/down: 69/-37) Total: 32 bytes
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
(cherry picked from commit d3539be8f27b8cbfdfee460fe08299158f08bcd9)
Conflicts:
coreutils/date.c
libbb/missing_syscalls.c
util-linux/rdate.c
Signed-off-by: Weiwen Chen <cww@rock-chips.com>
---
coreutils/date.c | 6 +++++-
libbb/missing_syscalls.c | 8 --------
util-linux/rdate.c | 8 ++++++--
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/coreutils/date.c b/coreutils/date.c
index 9d4a7df..0ad3a07 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -267,6 +267,9 @@ int date_main(int argc UNUSED_PARAM, char **argv)
time(&ts.tv_sec);
#endif
}
+#if !ENABLE_FEATURE_DATE_NANO
+ ts.tv_nsec = 0;
+#endif
localtime_r(&ts.tv_sec, &tm_time);
/* If date string is given, update tm_time, and maybe set date */
@@ -289,11 +292,12 @@ int date_main(int argc UNUSED_PARAM, char **argv)
if (date_str[0] != '@')
tm_time.tm_isdst = -1;
ts.tv_sec = validate_tm_time(date_str, &tm_time);
+ ts.tv_nsec = 0;
maybe_set_utc(opt);
/* if setting time, set it */
- if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) {
+ if ((opt & OPT_SET) && clock_settime(CLOCK_REALTIME, &ts) < 0) {
bb_perror_msg("can't set date");
}
}
diff --git a/libbb/missing_syscalls.c b/libbb/missing_syscalls.c
index 0934128..65709ed 100644
--- a/libbb/missing_syscalls.c
+++ b/libbb/missing_syscalls.c
@@ -16,14 +16,6 @@ pid_t getsid(pid_t pid)
return syscall(__NR_getsid, pid);
}
-int stime(const time_t *t)
-{
- struct timeval tv;
- tv.tv_sec = *t;
- tv.tv_usec = 0;
- return settimeofday(&tv, NULL);
-}
-
int sethostname(const char *name, size_t len)
{
return syscall(__NR_sethostname, name, len);
diff --git a/util-linux/rdate.c b/util-linux/rdate.c
index 960df25..b13f81d 100644
--- a/util-linux/rdate.c
+++ b/util-linux/rdate.c
@@ -97,9 +97,13 @@ int rdate_main(int argc UNUSED_PARAM, char **argv)
if (!(flags & 2)) { /* no -p (-s may be present) */
if (time(NULL) == remote_time)
bb_error_msg("current time matches remote time");
- else
- if (stime(&remote_time) < 0)
+ else {
+ struct timespec ts;
+ ts.tv_sec = remote_time;
+ ts.tv_nsec = 0;
+ if (clock_settime(CLOCK_REALTIME, &ts) < 0)
bb_perror_msg_and_die("can't set time of day");
+ }
}
if (flags != 1) /* not lone -s */
--
2.17.1

View File

@ -1,12 +0,0 @@
#!/bin/bash
patch -p1 < 0001-networking-libiproute-use-linux-if_packet.h-instead-.patch
patch -p1 < 0002-Makefile.flags-strip-non-l-arguments-returned-by-pkg.patch
patch -p1 < 0003-Makefile-include-per-arch-Makefile-before-Makefile.f.patch
patch -p1 < 0004-arch-sparc-sparc64-Makefile-define-ARCH_FPIC.patch
patch -p1 < 0005-httpd-fix-handling-of-range-requests.patch
patch -p1 < 0006-bunzip2-fix-runCnt-overflow-from-bug-10431.patch
patch -p1 < 0007-unlzma-fix-SEGV-closes-10436.patch
patch -p1 < 0008-busybox-support-chinese-display-in-terminal.patch
patch -p1 < 0009-halt-Support-rebooting-with-arg.patch
patch -p1 < 0010-Remove-stime-function-calls.patch

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +0,0 @@
#!/bin/sh
# devtmpfs does not get automounted for initramfs
/bin/mount -t devtmpfs devtmpfs /dev
exec 0</dev/console
exec 1>/dev/console
exec 2>/dev/console
exec /sbin/init "$@"