Cross-compile Python-2.7.13 to ARM (aarch64) platform

Publisher:玉立风华Latest update time:2020-02-16 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The method is basically the same as cross-compiling Python-2.7.13 to ARM (aarch32) platform. The only difference is that the toolchain is replaced with the toolchain for compiling aarch64. You can refer to using qemu to build an aarch64 learning environment.


Create a directory:


mkdir python2_7_13_for_aarch64

Here are the scripts for configuration, compilation and installation:


1. Configuration: mk1_conf.sh


 1 #!/bin/bash

 2 

 3 export PATH=/home/pengdonglin/src/qemu/aarch64/gcc-linaro-aarch64-linux-gnu-4.9-2014.07_linux/bin:$PATH

 4 

 5 ../Python-2.7.13/configure --prefix=`pwd`

 6     --host=aarch64-linux-gnu

 7     --build=x86_64-linux-gnu

 8     --enable-ipv6

 9     --enable-shared

10     ac_cv_file__dev_ptmx="yes"

11     ac_cv_file__dev_ptc="no"


2. Compile: mk2_make.sh


 1 #!/bin/bash

 2 

 3 export PATH=/home/pengdonglin/src/qemu/aarch64/gcc-linaro-aarch64-linux-gnu-4.9-2014.07_linux/bin:$PATH

 4 

 5 make HOSTPYTHON=../python2_7_13_for_x86_64/python

 6     HOSTPGEN=../python2_7_13_for_x86_64/Parser/pgen

 7     BLDSHARED="aarch64-linux-gnu-gcc -shared"

 8     CROSS_COMPILE=aarch64-linux-gnu-

 9     CROSS_COMPILE_TARGET=yes

10     HOSTARCH=aarch64-linux-gnu

11     BUILDARCH=x86_64-linux-gnu

12     -j4


3. Installation: mk3_install.sh


1 #!/bin/bash

3 export PATH=/home/pengdonglin/src/qemu/aarch64/gcc-linaro-aarch64-linux-gnu-4.9-2014.07_linux/bin:$PATH

5 make install HOSTPYTHON=../python2_7_13_for_x86_64/python

6     BLDSHARED="aarch64-linux-gnu-gcc -shared"

7     CROSS_COMPILE=arm-none-linux-gnueabi-

8     CROSS_COMPILE_TARGET=yes

9     prefix=`pwd`



Also, don't forget to modify the ramdisk creation script and the kernel configuration.


Run Qemu:


 1 sudo qemu-system-aarch64

 2     -M  virt

 3     -cpu cortex-a53

 4 - junior high school 2

 5     -m 4096M

 6     -kernel ./linux-4.10/out_aarch64/arch/arm64/boot/Image

 7     -nographic

 8     -append "root=/dev/ram0 rw rootfstype=ext4 console=ttyAMA0 init=/linuxrc ignore_loglevel"

 9     -initrd ./rootfs/ramdisk.img

10     -net nic,vlan=0 -net tap,vlan=0,ifname=tap0

11     -fsdev local,security_model=passthrough,id=fsdev0,path=/nfsroot

12     -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare


Start log:


  1 $./run_all.sh 

  2 sudo tunctl -u root -t tap0

  3 TUNSETIFF: Device or resource busy

  4 sudo ifconfig tap0 0.0.0.0 promisc up

  5 sudo brctl addif br0 tap0

  6 brctl show

  7 bridge name    bridge id        STP enabled    interfaces

  8 br0        8000.36de5b2e5a93    no        eth0

  9                             tap0

 10 docker0        8000.024280392ab1    no        

 11 [    0.000000] Booting Linux on physical CPU 0x0

 12 [    0.000000] Linux version 4.10.0+ (pengdonglin@pengdonglin-HP) (gcc version 4.9.1 20140529 (prerelease) (crosstool-NG linaro-1.13.1-4.9-2014.07 - Linaro GCC 4.9-2014.06) ) #6 SMP PREEMPT Mon Mar 20 13:59:55 CST 2017

 13 [    0.000000] Boot CPU: AArch64 Processor [410fd034]

 14 [    0.000000] debug: ignoring loglevel setting.

 15 [    0.000000] efi: Getting EFI parameters from FDT:

 16 [    0.000000] efi: UEFI not found.

 17 [    0.000000] cma: Reserved 16 MiB at 0x00000000ff000000

 18 [    0.000000] NUMA: No NUMA configuration found

 19 [    0.000000] NUMA: Faking a node at [mem 0x0000000000000000-0x000000013fffffff]

 20 [    0.000000] NUMA: Adding memblock [0x40000000 - 0x13fffffff] on node 0

 21 [    0.000000] NUMA: Initmem setup node 0 [mem 0x40000000-0x13fffffff]

 22 [    0.000000] NUMA: NODE_DATA [mem 0x13ffea600-0x13ffec57f]

 23 [    0.000000] Zone ranges:

 24 [    0.000000]   DMA      [mem 0x0000000040000000-0x00000000ffffffff]

 25 [    0.000000]   Normal   [mem 0x0000000100000000-0x000000013fffffff]

 26 [    0.000000] Movable zone start for each node

 27 [    0.000000] Early memory node ranges

 28 [    0.000000]   node   0: [mem 0x0000000040000000-0x000000013fffffff]

 29 [    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000013fffffff]

 30 [    0.000000] On node 0 totalpages: 1048576

 31 [    0.000000]   DMA zone: 12288 pages used for memmap

 32 [    0.000000]   DMA zone: 0 pages reserved

 33 [    0.000000]   DMA zone: 786432 pages, LIFO batch:31

 34 [    0.000000]   Normal zone: 4096 pages used for memmap

 35 [    0.000000]   Normal zone: 262144 pages, LIFO batch:31

 36 [    0.000000] psci: probing for conduit method from DT.

 37 [    0.000000] psci: PSCIv0.2 detected in firmware.

 38 [    0.000000] psci: Using standard PSCI v0.2 function IDs

 39 [    0.000000] psci: Trusted OS migration not required

 40 [    0.000000] percpu: Embedded 21 pages/cpu @ffff8000fffbd000 s48128 r8192 d29696 u86016

 41 [    0.000000] pcpu-alloc: s48128 r8192 d29696 u86016 alloc=21*4096

 42 [    0.000000] pcpu-alloc: [0] 0 [0] 1 

 43 [    0.000000] Detected VIPT I-cache on CPU0

 44 [    0.000000] CPU features: enabling workaround for ARM erratum 845719

 45 [    0.000000] Built 1 zonelists in Node order, mobility grouping on.  Total pages: 1032192

 46 [    0.000000] Policy zone: Normal

 47 [    0.000000] Kernel command line: root=/dev/ram0 rw rootfstype=ext4 console=ttyAMA0 init=/linuxrc ignore_loglevel

 48 [    0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)

 49 [    0.000000] software IO TLB [mem 0xfafff000-0xfefff000] (64MB) mapped at [ffff8000bafff000-ffff8000beffefff]

 50 [    0.000000] Memory: 4008696K/4194304K available (8572K kernel code, 946K rwdata, 3864K rodata, 1024K init, 398K bss, 169224K reserved, 16384K cma-reserved)

 51 [    0.000000] Virtual kernel memory layout:

 52 [    0.000000]     modules : 0xffff000000000000 - 0xffff000008000000   (   128 MB)

 53 [    0.000000]     vmalloc : 0xffff000008000000 - 0xffff7dffbfff0000   (129022 GB)

 54 [    0.000000]       .text : 0xffff000008080000 - 0xffff0000088e0000   (  8576 KB)

 55 [    0.000000]     .rodata : 0xffff0000088e0000 - 0xffff000008cb0000   (  3904 KB)

 56 [    0.000000]       .init : 0xffff000008cb0000 - 0xffff000008db0000   (  1024 KB)

 57 [    0.000000]       .data : 0xffff000008db0000 - 0xffff000008e9ca00   (   947 KB)

 58 [    0.000000]        .bss : 0xffff000008e9ca00 - 0xffff000008f003d0   (   399 KB)

 59 [    0.000000]     fixed   : 0xffff7dfffe7fd000 - 0xffff7dfffec00000   (  4108 KB)

 60 [    0.000000]     PCI I/O : 0xffff7dfffee00000 - 0xffff7dffffe00000   (    16 MB)

 61 [    0.000000]     vmemmap : 0xffff7e0000000000 - 0xffff800000000000   (  2048 GB maximum)

 62 [    0.000000]               0xffff7e0000000000 - 0xffff7e0004000000   (    64 MB actual)

 63 [    0.000000]     memory  : 0xffff800000000000 - 0xffff800100000000   (  4096 MB)

 64 [    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1

 65 [    0.000000] Preemptible hierarchical RCU implementation.

 66 [    0.000000]     Build-time adjustment of leaf fanout to 64.

 67 [    0.000000]     RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=2.

 68 [    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=2

 69 [ 0.000000] NR_IRQS:64 nr_irqs:64 0

 70 [    0.000000] GICv2m: range[mem 0x08020000-0x08020fff], SPI[80:143]

 71 [    0.000000] arm_arch_timer: WARNING: Invalid trigger for IRQ3, assuming level low

 72 [    0.000000] arm_arch_timer: WARNING: Please fix your firmware

 73 [    0.000000] arm_arch_timer: Architected cp15 timer(s) running at 62.50MHz (virt).

 74 [    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1cd42e208c, max_idle_ns: 881590405314 ns

 75 [    0.000102] sched_clock: 56 bits at 62MHz, resolution 16ns, wraps every 4398046511096ns

 76 [    0.002442] Console: colour dummy device 80x25

 77 [    0.005189] Calibrating delay loop (skipped), value calculated using timer frequency.. 125.00 BogoMIPS (lpj=250000)

 78 [    0.005287] pid_max: default: 32768 minimum: 301

 79 [    0.006012] Security Framework initialized

 80 [    0.008915] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes)

 81 [    0.013062] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes)

 82 [    0.014733] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes)

 83 [    0.014797] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes)

 84 [    0.042484] ASID allocator initialised with 65536 entries

 85 [    0.065159] EFI services will not be available.

 86 [    0.079440] smp: Bringing up secondary CPUs ...

 87 [    0.114887] Detected VIPT I-cache on CPU1

 88 [    0.116592] CPU1: Booted secondary processor [410fd034]

 89 [    0.124003] smp: Brought up 1 node, 2 CPUs

 90 [    0.124142] SMP: Total of 2 processors activated.

 91 [    0.124377] CPU features: detected feature: 32-bit EL0 Support

 92 [    0.128079] CPU: All CPU(s) started at EL1

 93 [    0.129967] alternatives: patching kernel code

 94 [    0.158339] devtmpfs: initialized

 95 [    0.168735] DMI not present or invalid.

 96 [    0.169788] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns

 97 [    0.169924] futex hash table entries: 512 (order: 4, 65536 bytes)

 98 [    0.172991] pinctrl core: initialized pinctrl subsystem

 99 [    0.189367] NET: Registered protocol family 16

100 [    0.219905] cpuidle: using governor menu

101 [    0.221064] vdso: 2 pages (1 code @ ffff0000088e7000, 1 data @ ffff000008db5000)

102 [    0.221247] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.

103 [    0.225392] DMA: preallocated 256 KiB pool for atomic allocations

104 [    0.226642] Serial: AMBA PL011 UART driver

105 [    0.264136] 9000000.pl011: ttyAMA0 at MMIO 0x9000000 (irq = 39, base_baud = 0) is a PL011 rev1

106 [    0.275026] console [ttyAMA0] enabled

107 [    0.279829] irq: type mismatch, failed to map hwirq-27 for /intc!

108 [    0.374165] HugeTLB registered 2 MB page size, pre-allocated 0 pages

109 [    0.388778] ACPI: Interpreter disabled.

110 [    0.392241] vgaarb: loaded

111 [    0.393255] SCSI subsystem initialized

112 [    0.396197] libata version 3.00 loaded.

113 [    0.397290] usbcore: registered new interface driver usbfs

114 [    0.397613] usbcore: registered new interface driver hub

115 [    0.399000] usbcore: registered new device driver usb

116 [    0.400821] pps_core: LinuxPPS API ver. 1 registered

117 [    0.400936] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti

[1] [2]
Reference address:Cross-compile Python-2.7.13 to ARM (aarch64) platform

Previous article:Cross-compile Python-2.7.13 to ARM (aarch32) - support sqlite3
Next article:讓TQ2440也用上設備樹(1)

Recommended ReadingLatest update time:2024-11-16 13:32

Microchip Cerebot 32MX7 Embedded Control and Communication Solutions
Microchip's PIC32MX7xx series is a 32-bit MCU that integrates the MIPSA M4KA core , with high-performance 32-bit flash memory for USB, CAN and Ethernet, a maximum frequency of 80 MHz, a performance of 1.56 DMIPS/MHz (Dhrystone 2.1) when accessing zero-wait-state flash memory, and an operating voltage
[Microcontroller]
Microchip Cerebot 32MX7 Embedded Control and Communication Solutions
Some operations of stm8 and DS1302
I recently wanted to see the state of the DS1302's internal RAM after power failure. Will it be all 0x00 by default? First, I checked the information on the Internet and the chip manual, but there was no introduction to it. DS1302 is a very common clock chip. I have used other microcontrollers before, but I never p
[Microcontroller]
Detailed explanation of ARM interrupt implementation in linux-2.6.26 kernel (1)
I have read some articles on the Internet about the implementation of Linux interrupts, and I feel that some of them are very well written. I would like to thank them for their selfless contributions, and then I would like to add my understanding of some issues. Let's start with the problem of function registration.
[Microcontroller]
ARM image files and their address mapping
1. What is the arm image file? The arm image file is actually an executable file, including bin or hex formats, which can be directly burned into the ROM for execution. In the axd debugging process, we debug the axf file, which is actually an image file. It just adds a file header and some debugging information to the
[Microcontroller]
In-depth understanding of ARM architecture (S3C6410) --- Understanding S3C6410
The chip architecture is shown in the figure   The S3C64xx series of application processor chips are Samsung's main 16/32 RISC microprocessors. Samsung currently has launched the S3C6400 and S3C6410, both of which are based on the ARM11 architecture and are hardware pin compatible. It should be said that their fu
[Microcontroller]
In-depth understanding of ARM architecture (S3C6410) --- Understanding S3C6410
Parallelization Method for Embedded ARM Multi-core Processors
  At present, embedded multi-core processors have been widely used in the field of embedded devices, but embedded system software development technology is still stuck in the traditional single-core mode, and has not fully utilized the performance of multi-core processors. Program parallel optimization is currently us
[Power Management]
Parallelization Method for Embedded ARM Multi-core Processors
Masayoshi Son: Arm and Nvidia will form an amazing combination, and Huang Renxun will be the next
According to Nikkei, SoftBank Group Chairman Masayoshi Son said that SoftBank's decision to sell Arm to Nvidia will form an "amazing combination" to accelerate the application of artificial intelligence. Son, who spoke online with Huang at the SoftBank World Conference 2020 in Tokyo, said Arm's low-power chips and Nv
[Mobile phone portable]
ARM-Linux s3c2440 UART Analysis (Part 2)
This article is original from itspy. Please indicate the original source when copying/reprinting: http://blog.csdn.net/yyplc/article/details/7196290. Thank you! Software (linux-2.6.30.4): The serial port driver of the Linux system is different from the general character device. It adopts a hierarchical architecture
[Microcontroller]
ARM-Linux s3c2440 UART Analysis (Part 2)
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components
Guess you like

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号