一些环境配置

基本没问题,如果repo失败,记得生成ssh公钥并绑定到你的gitee账户:ssh-keygen -t rsa -C "[email protected]"

虚拟机开始安装:https://bbs.csdn.net/topics/605399144

ubuntu20换源
ls -l /bin/sh
sudo dpkg-reconfigure dash
sudo ln -s /usr/bin/python3 /usr/bin/python
sudo apt install python3-pip
pip install -i https://mirrors.ustc.edu.cn/pypi/web/simple pip -U
pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/web/simple
sudo apt-get install build-essential gcc g++ make zlib* libffi-dev e2fsprogs pkg-config flex bison perl bc openssl libssl-dev libelf-dev libc6-dev binutils binutils-dev libdwarf-dev u-boot-tools mtd-utils gcc-arm-linux-gnueabi cpio device-tree-compiler git git-lfs ruby ccache curl
sudo apt-get install openjdk-8-jdk
sudo apt-get install libtinfo5 libmecab2 libaio1
sudo apt install genext2fs
安装DevEco Device Tool 3.0 ReleaseLinux版本
下载源码,并进入源码目录:
https://gitee.com/openharmony/docs/blob/master/zh-cn/release-notes/OpenHarmony-v3.1-release.md
https://docs.openharmony.cn/pages/v3.1/zh-cn/device-dev/quick-start/quickstart-standard-env-setup.md/#%E8%8E%B7%E5%8F%96%E6%BA%90%E7%A0%81
https://docs.openharmony.cn/pages/v3.1/zh-cn/release-notes/Readme.md/
python3 -m pip install --user ohos-build
vim ~/.bashrc
export PATH=~/.local/bin:$PATH
source ~/.bashrc
hb -h
hb set
hb build -f

linux5.10.79 给aarch64 arm架构添加系统调用

参考博文:

  • Linux-5.10.2常规架构添加系统调用
  • ARM64内核系统调用添加方法(基于kernel-4.9) https://blog.csdn.net/rikeyone/article/details/79929032
  • 这个其实和上面是一样的 linux arch/arm64 添加系统调用
  • arm linux 添加系统调用
  • Linux内核编译及添加系统调用(arm架构华为云)

按照常规架构添加系统调用的写法,在加上在arm64目录下的unistd32.h和unistd.h中随便添加了几句声明就行了。如果不添加,在调用syscall()报错 38

kernel/linux/linux-5.10/arch/x86/entry/syscalls/syscall_64.tbl
	441	common	get_multi_tasks		sys_get_multi_tasks
	442	common	get_multi_tasks_tv		sys_get_multi_tasks_tv
kernel/linux/linux-5.10/include/linux/syscalls.h
	asmlinkage long sys_get_multi_tasks(int __user *taskpids, int llen);
	asmlinkage long sys_get_multi_tasks_tv(int __user *taskpids, int llen);
kernel/linux/linux-5.10/include/uapi/asm-generic/unistd.h
	#define __NR_get_multi_tasks 441
	__SYSCALL(__NR_get_multi_tasks, sys_get_multi_tasks)
	#define __NR_get_multi_tasks_tv 442
	__SYSCALL(__NR_get_multi_tasks_tv, sys_get_multi_tasks_tv)
	#define __NR_syscalls 443
kernel/linux/linux-5.10/arch/arm64/include/asm/unistd32.h
	#define __NR_get_multi_tasks 441
	__SYSCALL(__NR_get_multi_tasks, sys_get_multi_tasks)
	#define __NR_get_multi_tasks_tv 442
	__SYSCALL(__NR_get_multi_tasks_tv, sys_get_multi_tasks_tv)
kernel/linux/linux-5.10/arch/arm64/include/asm/unistd.h
	#define __NR_compat_get_multi_tasks 441
	#define __NR_compat_get_multi_tasks_tv 442
	#define __NR_compat_syscalls		443
实现部分写在编译进内核的任意文件中皆可,写进内核模块中会报错,怎么可以解决:
	arch/arm64/kernel/sys.o:(.rodata+0xdd0): undefined reference to `__arm64_sys_get_multi_tasks_tv'
	arch/arm64/kernel/sys32.o:(.rodata+0xdd0): undefined reference to `__arm64_sys_get_multi_tasks_tv'
	make[1]: *** [Makefile:1179: vmlinux] Error 1
	make: *** [arch/arm64/Makefile:206: rk3568-toybrick-x0-linux.img] Error 2

等等,原来我编译的是基于32位linux的ohos。那为啥uname -a输出Linux localhost 5.10.79 #1 SMP Mon Nov 14 15:02:16 CST 2022 aarch64
查看linux是32位还是64位:
getconf LONG_BITfile /sbin/init or file /lib/systemd/systemd or file /bin/init

你可能感兴趣的:(linux,linux,openharmony)