CN108376074B - RancherOS ros core module transplanting method based on embedded system - Google Patents

RancherOS ros core module transplanting method based on embedded system Download PDF

Info

Publication number
CN108376074B
CN108376074B CN201611069177.2A CN201611069177A CN108376074B CN 108376074 B CN108376074 B CN 108376074B CN 201611069177 A CN201611069177 A CN 201611069177A CN 108376074 B CN108376074 B CN 108376074B
Authority
CN
China
Prior art keywords
setting
cgo
file
parameter
ros
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611069177.2A
Other languages
Chinese (zh)
Other versions
CN108376074A (en
Inventor
朱小勇
邓丽君
郭志川
赵然
常乐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Institute of Acoustics CAS
Shanghai 3Ntv Network Technology Co Ltd
Original Assignee
Institute of Acoustics CAS
Shanghai 3Ntv Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Institute of Acoustics CAS, Shanghai 3Ntv Network Technology Co Ltd filed Critical Institute of Acoustics CAS
Priority to CN201611069177.2A priority Critical patent/CN108376074B/en
Publication of CN108376074A publication Critical patent/CN108376074A/en
Application granted granted Critical
Publication of CN108376074B publication Critical patent/CN108376074B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a RancherOSros core module transplanting method based on an embedded system, which comprises the following steps: step 1) creating an interactive container based on specified parameters of a ros-built mirror image; step 2) setting system environment variables and installing a go command with the version number of 1.5; step 3), adding a compiling tool; step 4) modifying a main naming problem and adding a dependency library of the cutil. And 5) cross compiling to obtain an executable file. The method can solve the problem that the RancherOS ros core module is not matched with the embedded system; has the advantages of simple operation and strong practicability.

Description

RancherOS ros core module transplanting method based on embedded system
Technical Field
The invention relates to the field of embedded container operating systems, in particular to a RancherOS ros core module transplanting method based on an embedded system.
Background
The existing embedded system is more and more intelligent along with the development of the internet, communication and computers, and the human-computer interaction is more frequent, so that the requirements of people on the embedded system are higher and higher, and the embedded system is expected to be an environment in which multiple applications can run. However, the current embedded system is not perfect, and as the number of running applications is increased, more entrances are exposed, so that trojans, malicious software and viruses can easily invade the system; resource utilization rate: although the performance of smart devices has improved, more efficient resource management techniques are needed in the face of high-resolution video or complex graphics processing, etc.
Container virtualization technology is a great trend, and a new generation container technology represented by Docker becomes a hot spot for application security research. The Docker virtualization technology can provide a security domain and an isolated island environment for applications, effectively isolates access among the applications, and protects user private data. With the advent of Docker, many new Linux distribution versions of specialized runtime containers have emerged. The container encapsulates everything the application needs, except for the common operating system kernel, which encapsulates the runtime environment, framework and libraries, code, configuration, and related dependencies. The container greatly reduces the role of the operating system as a full-function platform. The operating system under the container now only needs to assume a very lightweight role: the vessel is activated and controlled. However, the existing container operating system is only suitable for a server side and cannot be adapted to an embedded system.
The embedded operating system based on Linux is generally different from the Linux system at the server side in that Linux is partially cut according to the characteristics and application of the embedded system.
Disclosure of Invention
The invention aims to solve the problem that a RancherOS and an embedded Linux system are not matched, embedded system configuration and RancherOS codes need to be modified, and therefore, the RancherOSros core module transplanting method based on the embedded system is provided.
In order to achieve the above object, the present invention provides a rancher os ros core module transplanting method based on an embedded system, the method comprising:
step 1) creating an interactive container based on specified parameters of a ros-built mirror image;
step 2) setting system environment variables and installing a go command with the version number of 1.5;
step 3), adding a compiling tool;
step 4) modifying a main naming problem and adding a dependency library of the cutil.
And 5) cross compiling to obtain an executable file.
In the above technical solution, the specifying parameters in step 1) includes: a parameter-i, -t, setting the container to an interactive mode; a parameter-v, mounting the shared volume according to the designated path; parameter — device, which allows the container to access the device under the specified path.
In the above technical solution, the step 2) specifically includes:
step 2-1) setting a current path BUILD-DIR;
step 2-2) setting a target architecture GOARCH of a program output by the Go compiler;
step 2-3) setting a GOOS (target operating system) operated by the compiled program;
step 2-4) setting a gcc compiled command line parameter GOGCCFLAGS when cgo is compiled;
step 2-5), setting GOPATH: a directory to be searched when the GO command is executed, wherein the directory mainly stores G O source codes and binary files;
step 2-6) setting a GOROOT installation catalog of Go language;
step 2-7) setting GOTOOLDIR: go's tool chain program under this catalog;
step 2-8) judging whether cgo is used or not;
step 2-9) installing a go command of a corresponding version number.
In the above technical solution, the compiling tool in step 3) is an arm-histvb300-linux compiler.
In the above technical solution, the step 4) specifically includes:
step 4-1) modifying the Main file of the Main folder under the folder-from-scratch folder, wherein the Main function is modified into a Main function, and the package Main is modified into a package Main;
step 4-2) modifying cgo parameter sections of the custom. go files in the util folder, adding cgo CFLAGS parameters to specify library file paths, and modifying cgo LDFLAGS parameters to specify paths of static link libraries and file names of the static link libraries;
the library files include blkid.h, libmount.h header files, libblkid.a, libmount.a, and libuiid.a static link library files.
In the above technical solution, in the compiling process of step 5), based on the command of the original core module of the rancher os for compiling ros, the parameters of GOARCH, CGO _ enable, and CC need to be added.
The invention has the advantages that:
1. the method of the invention can solve the problem that the RancherOS ros core module is not matched with the embedded system;
2. the method is simple to operate and high in practicability.
Drawings
Fig. 1 is a flowchart of a rancher os ros core module transplanting method based on an embedded system according to the present invention.
Detailed Description
The invention is described in detail below with reference to the figures and specific embodiments.
As shown in fig. 1, a rancher os ros core module transplanting method based on an embedded system sets up a system environment by independently cross-compiling the rancher os ros core module, modifies naming problems, adds a dependency library, and cross-compiles to obtain an executable file; the method specifically comprises the following steps:
step 1) creating an interactive container based on specified parameters of a ros-built mirror image;
the specified parameters include: a parameter-i, -t, setting the container to an interactive mode; a parameter-v, mounting the shared volume according to the designated path; parameter — device, which allows the container to access the device under the specified path.
Step 2) setting system environment variables and installing a go command with the version number of 1.5; the method specifically comprises the following steps:
step 2-1) setting a current path BUILD-DIR;
step 2-2) setting a target architecture GOARCH of a program output by the Go compiler;
step 2-3) setting a GOOS (target operating system) operated by the compiled program;
step 2-4) setting a gcc compiled command line parameter GOGCCFLAGS when cgo is compiled;
step 2-5), setting GOPATH: a directory to be searched when the GO command is executed, wherein the directory mainly stores G O source codes and binary files;
step 2-6) setting a GOROOT installation catalog of Go language;
step 2-7) setting GOTOOLDIR: go's tool chain program under this catalog;
step 2-8) judging whether cgo is used or not;
step 2-9) installing a go command of a corresponding version number.
Step 3), adding a compiling tool;
the compiling tool is an arm-histvb300-linux compiler.
Step 4) modifying a main naming problem and adding a dependency library of the cutil.
Step 4-1) modifying the Main file of the Main folder under the folder-from-scratch folder, wherein the Main function is modified into a Main function, and the package Main is modified into a package Main;
and 4-2) modifying cgo parameter sections of the custom. go files in the util folder, adding cgo CFLAGS parameters to specify library file paths, and modifying cgo LDFLAGS parameters to specify paths of static link libraries and file names of the static link libraries.
The library files include blkid.h, libmount.h header files, libblkid.a, libmount.a, and libuiid.a static link library files.
And 5) cross compiling to obtain an executable file.
And on the basis of commands of an original compiling ros core module of RancherOS, GOARCH, CGO _ ENABLED and CC parameters need to be added.
One specific embodiment of the present invention is:
step 1) creating an interactive container based on specified parameters of the ros-built image, wherein the command is as follows: socket:/var/run/socket:/dev/kvm-name ═ ros-build
Step 2) setting system environment variables, wherein the setting environment variable command is as follows:
export BUILD_DIR=$PWD
export GOARCH="arm"
export GOOS="linux"
export GOGCCFLAGS="-fPIC-marm-fmessage-length=0-I/include"
export GOPATH=/go
export GOROOT="/usr/local/go"
export GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
export CGO_ENABLED="1"
and step 3) installing a go command with the version number of 1.5.
Step 3-1), deleting the/usr/local/go folder;
step 3-2) setting GO _ VERSION environment variables, wherein the command is as follows: export GO _ VERSION ═ 1.5.1
Step 3-3) uses curl command to download go command with version number 1.5, and the command is:
curl-sSL"https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.t ar.gz"|tar-v-C/usr/local-xz
step 3-4), setting PATH environment variables with the following commands:
exportPATH=$PATH:/go/bin:/usr/local/go/bin:$PATH
step 4) add arm-histvb300-linux compiler.
Step 4-1) downloading an arm-histvb300-linux compiler installation package and decompressing;
step 4-2) executing the command/cross.install and installing a go command with the version number of 1.5;
step 4-3), setting PATH environment variables with the commands of:
export PATH=$PATH:/opt/hisi-linux/x86-arm/arm-histbv300-linux/bin
step 5) modifying the naming problem of the Main file in the Main folder under the locker-from-scratch folder, wherein the modified partial code is as follows:
Figure BDA0001163721540000051
and 6) adding a dependency library of the cutil.
Step 6-1) modifying the util/cutil.go file, wherein the modified partial code is as follows:
Figure BDA0001163721540000052
step 6-2) creating an include folder under the container/path;
step 6-3) create blkid file under/include/Path and add blkid.h under this folder
Step 6-4) creating libmount files under/include/path and adding libmount
Step 6-5) creating libs folders under the containers/paths;
step 6-6) add libblkid.a, libmount.a, libuiid.a static link libraries under the libs folder.
Step 7) cross compiling to obtain an executable file, and adding GOARCH, CGO _ ENABLED and CC parameters based on the commands of the original compiling ros core module of RancherOS, wherein the commands are as follows:
GOARCH=arm CGO_ENABLED=1CC="arm-histbv300-linux-gcc"godep go build-tags netgo-installsuffix netgo-ldflags"-X github.com/rancher/os/config.VERSION v0.4.1-dev-linkmode external-extldflags-extld=arm-histbv300-linux-gcc"-o ros
the above description is only for the purpose of illustrating the embodiments of the present invention and should not be taken as limiting the scope of the present invention, and it should be understood by those skilled in the art that modifications and equivalents may be made without departing from the spirit and scope of the present invention and that the present invention is also covered by the scope of the present invention.

Claims (3)

1. A RancherOS ros core module transplanting method based on an embedded system, the method comprising:
step 1) creating an interactive container based on specified parameters of a ros-built mirror image;
step 2) setting system environment variables and installing a GO language with a version number of 1.5;
step 3), adding a compiling tool;
step 4) modifying a main naming problem and adding a dependency library of the cutil.
Step 5), cross compiling to obtain an executable file;
the parameters specified in the step 1) comprise: a parameter-i, -t, setting the container to an interactive mode; a parameter-v, mounting the shared volume according to the designated path; parameter- -device, which allows the container to access the device under the specified path;
the step 2) specifically comprises the following steps:
step 2-1) setting a current path BUILD-DIR;
step 2-2) setting a target architecture GOARCH of a program output by the GO compiler;
step 2-3) setting a GOOS (target operating system) operated by the compiled program;
step 2-4) setting a gcc compiled command line parameter GOGCCFLAGS when cgo is compiled;
step 2-5), setting GOPATH: a directory to be searched when the GO command is executed, wherein the directory mainly stores G O source codes and binary files;
step 2-6) setting an installation catalog GOROOT of GO language;
step 2-7) setting GOTOOLDIR: the toolchain program of GO is under this catalog;
step 2-8) judging whether cgo is used or not;
step 2-9) installing GO languages with corresponding version numbers;
the step 4) specifically comprises the following steps:
step 4-1) modifying the Main file of the Main folder under the folder-from-scratch folder, wherein the Main function is modified into a Main function, and the package Main is modified into a package Main;
step 4-2) modifying cgo parameter section of the custom. go file in the util folder, adding a path of a cgo CFLAGS parameter appointed library file, and modifying a path of a cgo LDFLAGS parameter appointed static link library and a static link library file name;
the library files include a blkid.h header file, a libmount.h header file, a libblkid.a static link library file, a libmount.a static link library file, and a libuiid.a static link library file.
2. The method for transplanting the RancherOS ros kernel module based on the embedded system of claim 1, wherein the compiling tool of step 3) is an arm-histvb300-linux compiler.
3. The method of claim 1, wherein in the compiling process of step 5), based on commands of a rancher os core module originally compiled, GOARCH, CGO _ ENABLED and CC parameters are added.
CN201611069177.2A 2016-11-28 2016-11-28 RancherOS ros core module transplanting method based on embedded system Active CN108376074B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611069177.2A CN108376074B (en) 2016-11-28 2016-11-28 RancherOS ros core module transplanting method based on embedded system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611069177.2A CN108376074B (en) 2016-11-28 2016-11-28 RancherOS ros core module transplanting method based on embedded system

Publications (2)

Publication Number Publication Date
CN108376074A CN108376074A (en) 2018-08-07
CN108376074B true CN108376074B (en) 2020-10-23

Family

ID=63015378

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611069177.2A Active CN108376074B (en) 2016-11-28 2016-11-28 RancherOS ros core module transplanting method based on embedded system

Country Status (1)

Country Link
CN (1) CN108376074B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111190687B (en) * 2019-11-28 2023-06-30 安超云软件有限公司 Method, device, equipment and storage medium for constructing container mirror image
CN111866084A (en) * 2020-06-24 2020-10-30 北京智芯微电子科技有限公司 Container-based edge internet of things agent device
CN117112144B (en) * 2023-09-22 2024-03-12 上海卓悠网络科技有限公司 Method and system for deploying k3s on android system and storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100633241B1 (en) * 2004-05-21 2006-10-12 오정훈 Integrated development environment system for embedded linux education
CN101790174B (en) * 2010-01-19 2012-07-25 西安交通大学 Ad Hoc network Construction method based on OMAP 3530Mini development board
CN102137101A (en) * 2011-03-04 2011-07-27 中山中珩数字科技有限公司 Embedded Linux system data transmission method based on SCTP (Stream Control Transmission Protocol) and system thereof
CN105204913A (en) * 2015-10-20 2015-12-30 福建升腾资讯有限公司 Method and system for running Linux application on Android operating system and system

Also Published As

Publication number Publication date
CN108376074A (en) 2018-08-07

Similar Documents

Publication Publication Date Title
US11573776B1 (en) Extensible data transformation authoring and validation system
US10929117B2 (en) Container image building using shared resources
US9134974B2 (en) Source code separation and generation for heterogeneous central processing unit (CPU) computational devices
US10768916B2 (en) Dynamic generation of CPU instructions and use of the CPU instructions in generated code for a softcore processor
US8997085B2 (en) Image delta-based upgrade of complex stack in software appliance
CN108376074B (en) RancherOS ros core module transplanting method based on embedded system
CN114816417B (en) Cross compiling method, device, computing equipment and storage medium
WO2020063252A1 (en) Method and device for isolating multiple version dependency
CN112189187A (en) Extensibility of unified platform
WO2021211911A1 (en) Artificial intelligence cloud operating system
CN111984245A (en) Block chain intelligent contract online integrated development environment system and implementation method
CN112835568A (en) Project construction method and device
CN112363728B (en) Cross-platform compiling method and system supporting continuous integrated construction
CN107608672B (en) UI module manager, UI module management method and system
US20180341475A1 (en) Just In Time Deployment with Package Managers
Kishore et al. Designing deep learning neural networks using caffe
Ambler et al. Browserify
US9910645B2 (en) Incremental build generation
Slawinska et al. A Practical, SCVM-based Approach to Enhance Portability and Adaptability of HPC Application Build Systems
CN113741935B (en) Project and product synchronous iteration upgrading method
Guo CDE: Automatically package and reproduce computational experiments
Khan et al. Setting Up the Developer Environment
Bording et al. Using maali to efficiently recompile software post-CLE updates on a Cray XC system
US10853040B2 (en) Address space splitting for legacy application compatibility
Harrison et al. Deploying Generated Code

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant