统信UOS系统如何在sw6a和sw6b下编译移植runc?

MoMo 2022年5月21日21:35:02
评论
386

环境准备

  • 编译移植需要安装git、go、containerd、docker、libseccomp-dev等工具。

编译runc

1、下载源码到本地目录/home/deepin/go/src/github.com/runc下。

git clone https://gitlabwh.uniontech.com/wuhan/container/runc.git

2、添加对sw64的支持,找到如下代码段,添加sw64字样。

vim runc/Makefile

ifeq ($(shell $(GO) env GOOS),linux)
        ifeq (,$(filter $(shell $(GO) env GOARCH),mips mipsle mips64 mips64le ppc64 sw64))
                GO_BUILDMODE := "-buildmode=pie"
        endif
endif

3、在runc/目录下使用make命令编译runc,正常会在源码目录下生成runc二进制文件。

cd runc/
make

4、安装runc:使用sudo make install安装,会将二进制安装到/usr/local/sbin/目录中,之后需要将runc拷贝到/usr/sbin/目录下。

sudo cp /usr/local/sbin/runc /usr/sbin/runc

测试runc功能

docker pull harbor.sh.deepin.com/nonfree/busybox:uos
mkdir -p /tmp/mycontainer/rootfs
cd /tmp/mycontainer
docker export $(docker create harbor.sh.deepin.com/nonfree/busybox:uos) | tar -C rootfs -xvf -
runc spec
runc list
runc run mybusybox

常见问题及处理办法

1、在使用runc create busybox命令创建容器时,如果出现下面错误信息,修改config.json中的terminal参数值为false即可。

ERROR[0000] cannot allocate tty if runc will detach without setting console socket
cannot allocate tty if runc will detach without setting console socket

2、下图错误是因为部分go文件未添加对申威架构支持。

libcontainer/init_linux.go:319:12: undefined: system.Setgid
libcontainer/init_linux.go:322:12: undefined: system.Setuid
make: *** [Makefile:34:runc] 错误 2

解决办法可使用下列命令检索哪些go文件需要添加对申威的支持,可参考mips架构的字样添加申威支持。

# grep mips64 * -R | grep -v unix
# grep mips64 * -iR | grep -v unix | grep -v test | grep -v ptr_

3、编译前需要安装libseccomp-dev,否则编译会报错Package 'libseccomp',required by 'virtual:world',not found.

sudo apt-get install libseccomp-dev
https://xpanx.com/
MoMo
  • 本文由 发表于 2022年5月21日21:35:02
  • 转载请务必保留本文链接:https://xpanx.com/3940.html
飞书离职了怎么退出 飞书

飞书离职了怎么退出

一、功能简介 如果你是企业成员,当你被误拉入企业,或是从企业离职时,你可选择主动退出企业,也就是注销你在当前企业下的帐号。 注:退出企业后,你在该企业身份下所拥有的云文档等资源将自动流转给直属上级,无...
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: