Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build hi3531 cross-compilation environment arm-hisiv100nptl-linux on Ubuntu

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to build the hi3531 cross-compilation environment arm-hisiv100nptl-linux on Ubuntu, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Install SDK

1. Hi3531 SDK package location

In the "Hi3531_V100R001***/01.software/board" directory, you can see a file of Hi3531_SDK_Vx.x.x.x.tgz

This file is the software development kit for Hi3531.

2. Extract the SDK package

On the linux server (or on a PC with linux, the mainstream linux distribution is fine), use the command: tar-zxf Hi3531_SDK_Vx.x.x.x.tgz

Unzip the file to get a Hi3531_SDK_Vx.x.x.x directory.

3. Expand the contents of SDK package

Return to the Hi3531_SDK_Vx.x.x.x directory and run. / sdk.unpack (please execute with root or sudo permission) will expand the SDK package to pack and compress the stored content. Please follow the prompts to complete the operation.

If you need to transfer a copy of the SDK package through the WINDOWS operating system, run. / sdk.cleanup, put away the contents of the SDK package, copy it to a new directory, and then expand it.

4. Install the cross compiler on the linux server

1) install uclibc cross-compiler (note, sudo permission or root permission is required):

Go to the Hi3531_SDK_Vx.x.x.x/osdrv/toolchain/arm-hisiv100-linux directory, run chmod + x cross.install, and then run. / cross.install.

2) install glibc cross-compiler (note, sudo permission or root permission is required):

Go to the Hi3531_SDK_Vx.x.x.x/osdrv/toolchain/arm-hisiv200-linux directory, run chmod + x cross.install, and then run. / cross.install.

3) execute source / etc/profile, install the cross-compiler script configuration environment variables can take effect, or please log in again. Source / etc/bash.bashrc is also available.

Enter the command arm-linux on the terminal and press the Tab key, and you can see the following figure, which shows that the environment variable is set successfully.

Ls@ubuntu:/slq/nfs/mpp$ arm-hisiv100nptl-linux-

Arm-hisiv100nptl-linux-addr2line arm-hisiv100nptl-linux-gprof

Arm-hisiv100nptl-linux-ar arm-hisiv100nptl-linux-ld

Arm-hisiv100nptl-linux-as arm-hisiv100nptl-linux-nm

Arm-hisiv100nptl-linux-c++ arm-hisiv100nptl-linux-objcopy

Arm-hisiv100nptl-linux-c++filt arm-hisiv100nptl-linux-objdump

Arm-hisiv100nptl-linux-cpp arm-hisiv100nptl-linux-ranlib

Arm-hisiv100nptl-linux-g++ arm-hisiv100nptl-linux-readelf

Arm-hisiv100nptl-linux-gcc arm-hisiv100nptl-linux-size

Arm-hisiv100nptl-linux-gcc-4.4.1 arm-hisiv100nptl-linux-strings

Arm-hisiv100nptl-linux-gccbug arm-hisiv100nptl-linux-strip

Arm-hisiv100nptl-linux-gcov

Validate, compile a hello.c file

# include

Int main ()

{

Printf ("hello world!\ n")

}

Use the command: arm-hisiv100nptl-linux-gcc hello.c-o hello to see if the compilation is successful

Root@ubuntu:/slq/test# ls

Hello hello.c

It can be seen that the binary file was generated successfully.

5. Compile osdrv

Instructions for using 1.osdrv

The design idea of this directory is to support the compilation of two kinds of tool chains in one set of source code, so it is necessary to specify different tool chains through compilation parameters. Arm-hisiv100nptl-linux is the uclibc tool chain and arm-hisiv200-linux is the glibc tool chain. The specific orders are as follows

(1) compile the entire osdrv directory:

Make OSDRV_CROSS=arm-hisiv100nptl-linux all

Or

Make OSDRV_CROSS=arm-hisiv200-linux all

(2) clear the compiled files of the entire osdrv directory:

Make OSDRV_CROSS=arm-hisiv100nptl-linux clean

Or

Make OSDRV_CROSS=arm-hisiv200-linux clean

(3) completely clear the compiled files of the entire osdrv directory. In addition to erasing the compiled files, delete the compiled images:

Make OSDRV_CROSS=arm-hisiv100nptl-linux distclean

Or

Make OSDRV_CROSS=arm-hisiv200-linux distclean

(4) compile kernel separately:

After entering the kernel source directory, do the following

Cp arch/arm/configs/godnet_defconfig .config

Make ARCH=arm CROSS_COMPILE=arm-hisiv100nptl-linux- menuconfig

Make ARCH=arm CROSS_COMPILE=arm-hisiv100nptl-linux- uImage

Or

Cp arch/arm/configs/godnet_defconfig .config

Make ARCH=arm CROSS_COMPILE=arm-hisiv200-linux- menuconfig

Make ARCH=arm CROSS_COMPILE=arm-hisiv200-linux- uImage

(5) compile uboot separately:

After entering the boot source code directory, do the following

Make ARCH=arm CROSS_COMPILE=arm-hisiv100nptl-linux- godnet_config

Make ARCH=arm CROSS_COMPILE=arm-hisiv100nptl-linux-

Or

Make ARCH=arm CROSS_COMPILE=arm-hisiv200-linux- godnet_config

Make ARCH=arm CROSS_COMPILE=arm-hisiv200-linux-

(6) create a file system image:

There is a compiled file system in osdrv/pub/, so there is no need to compile the file system again, just make a file system image according to the specification and model of flash on the single board.

Spi flash uses an image in jffs2 format. When making an jffs2 image, you need to use the block size of spi flash. This information will be printed when uboot starts. It is recommended to run the mkfs.jffs2 tool directly when using it, and fill in the relevant parameters according to the print information. Here is an example of a block size of 64KB:

Osdrv/pub/bin/pc/mkfs.jffs2-d osdrv/pub/rootfs_uclibc-l-e 0x40000-o osdrv/pub/rootfs_uclibc_256k.jffs2

Osdrv/pub/bin/pc/mkfs.jffs2-d osdrv/pub/rootfs_uclibc-l-e 0x10000-o osdrv/pub/rootfs_uclibc_64k.jffs2

Sudo osdrv/pub/bin/pc/mkfs.jffs2-d osdrv/pub/rootfs_uclibc-l-e 0x10000-- pad=0x9A0000-o osdrv/pub/rootfs_uclibc_64k.jffs2

Sudo osdrv/pub/bin/pc/mkfs.jffs2-d osdrv/pub/rootfs_uclibc_slq-l-e 0x10000-- pad=0x9A0000-o osdrv/pub/rootfs_uclibc_64k_slq.jffs2

Sudo osdrv/pub/bin/pc/mkfs.jffs2-d osdrv/pub/rootfs_custom_slq-l-e 0x10000-- pad=0x100000-o osdrv/pub/rootfs_custom_64k_slq.jffs2

Or

Osdrv/pub/bin/pc/mkfs.jffs2-d osdrv/pub/rootfs_glibc-l-e 0x40000-o osdrv/pub/rootfs_glibc_256k.jffs2

Nand flash uses an image in yaffs2 format. When creating an yaffs2 image, you need to use pagesize and ecc of nand flash. This information will be printed when uboot starts. It is recommended to run the mkyaffs2image tool directly when using it, and fill in the relevant parameters according to the print information. Take 2KB pagesize and 1bit ecc as examples:

Osdrv/pub/bin/pc/mkyaffs2image osdrv/pub/rootfs_uclibc osdrv/pub/rootfs_uclibc_2k_1bit.yaffs2 1 1

Or

Osdrv/pub/bin/pc/mkyaffs2image osdrv/pub/rootfs_glibc osdrv/pub/rootfs_glibc_2k_1bit.yaffs2 1 1

(7) compile the PCIE MCC driver module separately:

First, prepare the kernel source code directory that you need to connect to when compiling the module:

Cd. / kernel/

Tar-xvf linux-3.0.y.tgz

After decompressing the kernel source code, you need to compile the kernel (take Hi3531 as an example) according to the specific chip type to generate the corresponding header file.

Cd. / linux-3.0.y

Cp arch/arm/configs/godnet_defconfig .config

Make ARCH=arm CROSS_COMPILE=arm-hisiv100nptl-linux- menuconfig

Make ARCH=arm CROSS_COMPILE=arm-hisiv100nptl-linux- uImage

When the kernel source code is ready, you can go to the source code directory of the PCIE MCC driver module and compile the driver:

Cd.. /.. / drv/pcie_mcc

If you are compiling the ko of the main piece, use the make command directly

Make

If you are compiling the ko file of the slave slice, please take the parameter target=slave

Make target=slave

(note: by default, the compiler-driven tool chain is arm-hisiv100nptl-linux-,. If you need to change it, please bring the parameter CROSS_COMPILE=arm-hisiv200-linux-.)

two。 Description of image storage directory

The compiled image,rootfs is stored in the osdrv/pub directory.

Pub

│ rootfs_uclibc.tgz-rootfs file system compiled by hisiv100nptl

│ rootfs_glibc.tgz-rootfs file system compiled by hisiv200

├─ image_glibc-the image file compiled by hisiv200

│ uImage-kernel image

│ u-boot-hi3531_930MHz.bin-- u-boot image

│ rootfs_256k.jffs2-- jffs2 rootfs image (corresponding to spi-flash blocksize=256K)

│ rootfs_2k_1bit.yaffs2-- yaffs2 rootfs image (corresponding to nand-flash pagesize=2K ecc=1bit)

├─ image_uclibc-the image file compiled by hisiv100nptl

│ uImage-kernel image

│ u-boot-hi3531_930MHz.bin-- u-boot image

│ rootfs_256k.jffs2-- jffs2 rootfs image (corresponding to spi-flash blocksize=256K)

│ rootfs_2k_1bit.yaffs2-- yaffs2 rootfs image (corresponding to nand-flash pagesize=2K ecc=1bit)

└─ bin

├─ pc

│ mkfs.jffs2

│ mkimage

│ mkfs.cramfs

│ mkyaffs2image

├─ board_glibc-hisiv200 compiled single board tools and pcie message communication layer ko

│ flash_eraseall

│ mcc_usrdev_host.ko

│ flash_erase

│ mcc_usrdev_slv.ko

│ hi35xx_dev_slv.ko

│ nandwrite

│ hi35xx_dev_host.ko

│ mcc_drv_slv.ko

│ mtd_debug

│ flash_info

│ mcc_drv_host.ko

│ boot_device.ko

│ pcit_dma_slv.ko

│ sumtool

│ mtdinfo

│ flashcp

│ nandtest

│ nanddump

│ parted_glibc

│ pcit_dma_host.ko

│ gdb-arm-hisiv200-linux

└─ board_uclibc-hisiv100nptl compiled single board tools and pcie message communication layer ko

Flash_eraseall

Mcc_usrdev_host.ko

Flash_erase

Mcc_usrdev_slv.ko

Hi35xx_dev_slv.ko

Nandwrite

Hi35xx_dev_host.ko

Mcc_drv_slv.ko

Mtd_debug

Flash_info

Parted_uclibc

Mcc_drv_host.ko

Boot_device.ko

Pcit_dma_slv.ko

Sumtool

Mtdinfo

Flashcp

Nandtest

Gdb-arm-hisiv100nptl-linux

Nanddump

Pcit_dma_host.ko

Description of 3.osdrv directory structure:

Osdrv

├─ Makefile-- osdrv directory compilation script

├─ busybox-the directory where the busybox source code is stored

├─ tools-A directory where various tools are stored

│ ├─ board_tools-tools used on various veneers

│ │ ├─ reg-tools-1.0.0-Register read / write tool

│ │ ├─ mtd-utils-flash naked read-write tool

│ │ ├─ udev-100-udev tool set

│ │ ├─ gdb-gdb tool

│ │ ├─ parted-large capacity hard disk Partition tool

│ │ └─ e2fsprogs-mkfs tool set

│ └─ pc_tools-tools used on various pc

│ ├─ mkfs.cramfs-cramfs file system authoring tool

│ ├─ mkfs.jffs2-jffs2 file system authoring tool

│ ├─ mkimage-uImage production tool

│ ├─ mkyaffs2image301-yaffs2 file system authoring tool

│ ├─ nand_production-nand flash Burning document making tool

│ └─ uboot_tools-uboot image creation tool, xls file and ddr initialization script, bootrom tool

├─ toolchain-the directory where the tool chain is stored

│ ├─ arm-hisiv100nptl-linux-hisiv100nptl Cross tool chain

│ └─ arm-hisiv200-linux-hisiv200 Cross tool chain

├─ pub-the directory where various images are stored

│ ├─ image_glibc-Image files compiled based on the hisiv100nptl toolchain and available for FLASH to burn, including uboot, kernel, file system

│ ├─ image_uclibc-Image files compiled based on the hisiv200 toolchain and available for FLASH to burn, including uboot, kernel, file system

│ ├─ bin-various tools that are not put into the root file system

│ │ ├─ pc-tools executed on pc

│ │ ├─ board_glibc-A tool compiled based on the hisiv100nptl tool chain and executed on a veneer

│ │ └─ board_uclibc-A tool compiled based on the hisiv200 tool chain and executed on a veneer

│ ├─ rootfs_uclibc.tgz-the root file system compiled based on the hisiv100nptl tool chain

│ └─ rootfs_glibc.tgz-the root file system compiled based on the hisiv200 tool chain

├─ drv-the directory where the peripheral driver is stored

│ └─ pcie_mcc-- pcie message communication layer driver

├─ rootfs_scripts-the directory where the root file system makes scripts

├─ uboot-the directory where the uboot source code is stored

└─ kernel-the directory where the kernel source code is stored

4. Matters needing attention

(1) after compiling with a tool chain, if you need to replace the tool chain, clear the original tool chain compilation file first, and then change the tool chain compilation. The method is make clean.

(2) when copying the source package under windows, the executable file under linux may become a non-executable file, resulting in inability to compile and use; after compilation under u-boot or the kernel, there will be many symbolic link files, and copying these source packages under windows will make the source package become huge, because the symbolic link files under linux become real files under windows, so the source package expands. So be careful not to copy the source code package under windows when using it.

(3) currently, the network is in adaptive mode. If you want to change it to a fixed rate mode, you need to modify the file kernel/linux-3.0.y/drivers/net/stmmac/stmmac_mdio.c:

Turn off the macro definition TNK_HW_PLATFORM_ADJUST and comment out 33 lines

Select the rate that requires a fixed configuration, for example, if the fixed configuration is 100 megabit full duplex, open 46 lines of macro to define the PHY_SPEED_100.

(4) Hi3531 supports hard floating point, and all libraries released in the file system are hard floating point libraries. So please note that when compiling all Hi3531 board code, you need to add the following command to Makefile:

CFLAGS + =-march=armv7-a-mcpu=cortex-a9-mfloat-abi=softfp-mfpu=vfpv3-d16

CXXFlAGS + =-march=armv7-a-mcpu=cortex-a9-mfloat-abi=softfp-mfpu=vfpv3-d16

The XX in CXXFlAGS is determined by the specific name of the macro used in the user Makefile, e.g:CPPFLAGS.

The above is all the contents of the article "how to build the hi3531 cross-compilation environment arm-hisiv100nptl-linux on Ubuntu". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 228

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report