openbmc development 26: using image server

The version of openbmc has reached 2.11. Not only does the software package required for each version compilation fail, but also the software package required for commit compilation under the same version may fail, This will cause our downloads to become larger and larger (my downloads are almost 30G). At the same time, in order to quickly compile, we may also open a separate cache folder for each version, which not only occupies virtual machine resources, but also is not conducive to synchronization and updating. opebmc itself supports the image server, so we can use the image server to solve this problem.

1 create software image

In loca Conf or "your laer / conf / machine / xxx. Conf" file, add the following command:

BB_GENERATE_MIRROR_TARBALLS = "1"

This command will generate a tar package for the software to be used during compilation, so that it can be placed on the image server.

2 specify mirror

Since the "downloads" are relatively large and the compilation will be fast if there is a cache, these can be shared in multi person development to improve the development and compilation efficiency, It is also convenient for virtual machine backup, etc (there are dozens of G's in these two folders). The server image includes http server and FTP server. If the server file has write permission, you can directly mount the server file locally, and then specify the path through a variable or create a soft connection. If the service file does not have write permission, you can also mount locally, but you cannot use the soft connection method. After mounting locally, Same as accessing local files; Otherwise, you need to download the downloads file or cache locally before compiling. (in order to save virtual machine space, I choose to mount it.)

1.1 specify software source server

At local The "DL_DIR" variable in conf can specify the storage path of the software package source code download. If it is not set, it is under "build/downloads" by default. Generally, we do not modify it, or establish a soft connection to other locations (to establish a soft connection, delete "build/downloads" first).

Executing do_ When fetching, first check whether there is a software package under the path specified by "DL_DIR" (one is the package compression package protecting the git warehouse, the other is the package name. done file, and the ". done" file is the same), and then obtain it from the image address. If the image address is not specified, download it from the network specified by the URL.

2.1. 1 specify http server

In machine Conf or local Add the following command to conf

BB_FETCH_PREMIRRORONLY = "1"
PREMIRRORS_prepend = "\
             git://.*/.* http://www.xxx/sources/  \
             ftp://.*/.* http://www.xxx/sources//sources/  \
             http://.*/.* http://www.xxx/sources//sources/  \
             https://.*/.* http:/www.xxx/sources//sources/ "

2.1. 2 specify FTP server

In machine Conf or local Add the following command to conf

BB_FETCH_PREMIRRORONLY = "1"
PREMIRRORS_prepend = "\
             git://.*/.* ftp://www.xxx/sources/ \
             ftp://.*/.* ftp://www.xxx/sources//sources/  \
             http://.*/.* ftp://www.xxx/sources//sources/  \
             https://.*/.* ftp:/www.xxx/sources//sources/ "

2.1. 3 specify local

In machine Conf or local Add the following command to conf

BB_FETCH_PREMIRRORONLY = "1"
PREMIRRORS_prepend = "\
             git://.*/.* file://path/  \
             ftp://.*/.* file://path/  \
             http://.*/.* file://path/  \
             https://.*/.* file:/path/ "

I might think it would be better if the path is not specified by "DL_DIR" locally. Isn't this unnecessary? Of course, if it is a local folder, you can directly specify or establish a soft connection, but the local folder proposed here is to solve the operation of some unauthorized FTP services. See section 3.3.3 for details four o'clock

2.2 specify cache image server

At local In conf, you can specify the compilation cache path through "SSTATE_DIR". Generally, the default location is "build / sstate cache". Generally, we do not modify the variable value. If we want to modify or establish a soft connection. (with the cache file, the compilation time will be greatly reduced if we compile it again or compile the same soc model)

2.2. 1 specify the http server image

In machine Conf or local Add the following command to conf

SSTATE_MIRRORS = " file://path/(.*) http://server_url_sstate_path/PATH/\1 "

perhaps

SSTATE_MIRRORS = " file://.* http://www.xxxx/PATH;downloadfilename=PATH  "

2.2. 2. Specify ftp server image

In machine Conf or local Add the following command to conf

SSTATE_MIRRORS = " file://path/(.*) ftp://server_url_sstate_path/PATH/\1 "

perhaps

SSTATE_MIRRORS = " file://.* ftp://www.xxxx/PATH;downloadfilename=PATH  "

3 ftp server

3.1 setting up ftp server

Here, FTP server is built on the host (under windows system). There are many FTP server software. Here, IPOP is selected.
After opening the IPOP software, select FTP on the right side of the software, then select the path "Home Dir", and finally click "start" to start the FTP server.
Note:
If this item sets the access user, you can click the arrow behind "Home Dir" to set the user name and password, and check "Rights" to set the permissions of reading, writing, deleting and renaming.

3.2 testing ftp server

Open the windows file browser and enter:“ ftp://ip/downloads ”Press enter to see the files under downloads.

3.3 virtual machine mount

3.3. 1 tools

Under ubuntu, you need to use curlftpfs tool to mount ftp server files. If you do not have curlftpfs, use the following command to install curlftpfs.

sudo apt install curlftpfs

3.3. 2 mount FTP files

Create an empty folder (downloads), and then use the "curlftpfs" tool to mount the ftp server files to the folder just created by the virtual machine.

mkdir downloads
curlftpfs ftp://192.168.3.12 downloads


Due to the establishment of local software FTP server and the large number of downloads files, it will take a long time to open it for the first time.

3.3. 3 uninstall FTP files

To uninstall the FTP server file mount, use the following command

fusermount -u downloads

perhaps

sudo umount downloads

Note that relative paths are used here.

3.3. 4. Have write permission to mount and compile

For FTP server files with read-write permission, we can directly mount the downloads file under "build/downloads", and then compile it directly.

curlftpfs ftp://192.168.3.12 downloads

After testing, the FTP server under linux can use this method. If the FTP server tool in this paper is used under windows, although it is given write permission, it cannot modify the file because it cannot recognize the commands sent by linux.

3.3. 4 mount and compile without write permission

For FTP server files, we can use the following methods:

mkdir ~/Desktop/downloads
curlftpfs ftp://192.168.3.12 ~/Desktop/downloads

At local Add the following command to conf

BB_FETCH_PREMIRRORONLY = "1"
PREMIRRORS_prepend = "\
             git://.*/.* file://home/master/Desktop/downloads/  \
             ftp://.*/.* file://home/master/Desktop/downloads/  \
             http://.*/.* file://home/master/Desktop/downloads/  \
             https://.*/.* file://home/master/Desktop/downloads/  "

After executing the compile command, the compressed software package will create a soft connection to "~ / Desktop/downloads/xxx", and the under git2 will be copied. In addition, if the url of the mirror is specified in the bb file, you need to manually copy the corresponding software package from the FPT server and put it under the corresponding path of "build/downloads".

3.3. 5 set auto mount

Modify the "~ /. bashrc" file and add the following content at the end (there are other methods to search by yourself):

if [ ! -d "~/Desktop/downloads" ];then
         mkdir -p ~/Desktop/downloads
fi
if [ "`ls ~/Desktop/downloads`" = "" ];then
         curlftpfs ftp://192.168.3.12 ~/Desktop/downloads
fi

When the Terminal terminal is opened for the first time, the FTP server file will be automatically mounted (the downloads file needs to be empty for mounting. Do not put the file in this folder before mounting).

4 virtual machine sharing mode

In the virtual machine setting interface, click Edit virtual machine - > click options in the upper left corner - > select shared folder on the left - > click add on the right - > click next in the pop-up window - > then select the host shared folder path and set the shared folder name - > click Next - > click finish.

Restart the virtual machine, and you can see the downloads folder under "/ mnt/h /".
Create soft connection

ln -s /mnt/hgfs/downloads/ ~/Desktop/openbmc/build/downloads

Added by notonurnelly on Sat, 18 Dec 2021 06:17:57 +0200