Qemu 运行ARMv8开发平台 ubuntu16.04

前端之家收集整理的这篇文章主要介绍了Qemu 运行ARMv8开发平台 ubuntu16.04前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1. Ubuntu 安装aarch64的gcc编译工具:

sudo apt-get install gcc-aarch64-linux-gnu

2. 编译制作aarch64架构的最小文件系统

Download busyBox

http://busyBox.net/download
$cd busyBox

$export ARCH=arm64

$export CROSS_COMPILE=aarch64-linux-gnu-
$make menuconfig
静态编译busyBox
BusyBox Settings --->
Build Options --->

[*] Build BusyBox as a static binary (no shared libs)

$make

$make install

$cp _install/ -rf ../linux-4.0/

$cd linux-4.0/_install
$mkdir etc dev mnt
$mkdir -p etc/init.d/
$vim init.d/rcS
         mkdir -p /proc
         mkdir -p /tmp
         mkdir -p /sys
         mkdir -p /mnt
        /bin/mount -a
        mkdir -p /dev/pts
        mount -t devpts devpts /dev/pts
        echo /sbin/mdev > /proc/sys/kernel/hotplug
        mdev -s
$vim etc/fstab
        proc /proc proc defaults 0 0
	tmpfs /tmp tmpfs defaults 0 0 
	sysfs /sys sysfs defaults 0 0
	tmpfs /dev tmpfs defaults 0 0
	debugfs /sys/kernel/debug debugfs defaults 0 0

$vim etc/inittab
        ::sysinit:/etc/init.d/rcS
	::respawn:-/bin/sh
	::askfirst:-/bin/sh
	::cttlaltdel:/bin/umount -a -r

$cd dev
          sudo mknod console c 5 1
          sudo mknod null c 1 3

3.编译linux kernel
$export ARCH=arm64
$export CROSS_COMPILE=aarch64-linux-gnu-
$make menuconfig
General setup --->
[*] Initial RAM filesystem and RAM disk (initramfs/initrd) support │ │
│ │ (_install) Initramfs source file(s)

Boot options --->
Default kernel command string

Kernel Features --->
Page size (4KB) --->
Virtual address space size (48-bit) --->

$make -j8

$qemu-system-aarch64 -machine virt -cpu cortex-a57 -machine type=virt -nographic -m 2048 -smp 2 -kernel arch/arm64/boot/Image --append "rdinit=/linuxrc console=ttyAMA0"

Booting Linux on physical cpu 0x0
Initializing cgroup subsys cpuset
Linux version 4.0.0 (xinchangxiang@xinchangxiang) (gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) ) #5 SMP Sun Oct 1 12:53:11 CST 2017
cpu: AArch64 Processor [411fd070] revision 0
Detected PIPT I-cache on cpu0
efi: Getting EFI parameters from FDT:
efi: UEFI not found.
psci: probing for conduit method from DT.
psci: PSCIv0.2 detected in firmware.
psci: Using standard PSCI v0.2 function IDs
PERcpu: Embedded 14 pages/cpu @ffff80007ffcc000 s18008 r8192 d31144 u57344
Built 1 zonelists in Zone order,mobility grouping on. Total pages: 516096
Kernel command line: rdinit=/linuxrc console=ttyAMA0
PID hash table entries: 4096 (order: 3,32768 bytes)
Dentry cache hash table entries: 262144 (order: 9,2097152 bytes)
Inode-cache hash table entries: 131072 (order: 8,1048576 bytes)
software IO TLB [mem 0xb9a00000-0xbda00000] (64MB) mapped at [ffff800079a00000-ffff80007d9fffff]
Memory: 1986756K/2097152K available (4795K kernel code,281K rwdata,1640K rodata,1312K init,220K bss,110396K reserved,0K cma-reserved)
Virtual kernel memory layout:
 vmalloc : 0xffff000000000000 - 0xffff7bffbfff0000 (126974 GB)
 vmemmap : 0xffff7bffc0000000 - 0xffff7fffc0000000 ( 4096 GB maximum)
 0xffff7bffc1000000 - 0xffff7bffc3000000 ( 32 MB actual)
 fixed : 0xffff7ffffabfe000 - 0xffff7ffffac00000 ( 8 KB)
 PCI I/O : 0xffff7ffffae00000 - 0xffff7ffffbe00000 ( 16 MB)
 modules : 0xffff7ffffc000000 - 0xffff800000000000 ( 64 MB)
 memory : 0xffff800000000000 - 0xffff800080000000 ( 2048 MB)
 .init : 0xffff8000006cb000 - 0xffff800000813000 ( 1312 KB)
 .text : 0xffff800000080000 - 0xffff8000006ca504 ( 6442 KB)
 .data : 0xffff800000815000 - 0xffff80000085b600 ( 282 KB)
SLUB: HWalign=64,Order=0-3,MinObjects=0,cpus=2,Nodes=1
Hierarchical RCU implementation.
 CONFIG_RCU_FANOUT set to non-default value of 32
 Additional per-cpu info printed with stalls.
 RCU restricting cpus from NR_cpuS=8 to nr_cpu_ids=2.
RCU: Adjusting geometry for rcu_fanout_leaf=16,nr_cpu_ids=2
NR_IRQS:64 nr_irqs:64 0
Architected cp15 timer(s) running at 62.50MHz (virt).
sched_clock: 56 bits at 62MHz,resolution 16ns,wraps every 2199023255552ns
Console: colour dummy device 80x25
Calibrating delay loop (skipped),value calculated using timer frequency.. 125.00 BogoMIPS (lpj=625000)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 4096 (order: 3,32768 bytes)
Mountpoint-cache hash table entries: 4096 (order: 3,32768 bytes)
EFI services will not be available.
cpu1: Booted secondary processor
Detected PIPT I-cache on cpu1
Brought up 2 cpus
SMP: Total of 2 processors activated.
devtmpfs: initialized
DMI not present or invalid.
NET: Registered protocol family 16
cpuidle: using governor ladder
cpuidle: using governor menu
vdso: 2 pages (1 code @ ffff80000081d000,1 data @ ffff80000081c000)
hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
DMA: preallocated 256 KiB pool for atomic allocations
Serial: AMBA PL011 UART driver
9000000.pl011: ttyAMA0 at MMIO 0x9000000 (irq = 38,base_baud = 0) is a PL011 rev1
console [ttyAMA0] enabled
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Advanced Linux Sound Architecture Driver Initialized.
Switched to clocksource arch_sys_counter
NET: Registered protocol family 2
TCP established hash table entries: 16384 (order: 5,131072 bytes)
TCP bind hash table entries: 16384 (order: 6,262144 bytes)
TCP: Hash tables configured (established 16384 bind 16384)
TCP: reno registered
UDP hash table entries: 1024 (order: 3,32768 bytes)
UDP-Lite hash table entries: 1024 (order: 3,32768 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
futex hash table entries: 512 (order: 3,32768 bytes)
squashfs: version 4.0 (2009/01/31) Phillip Lougher
jffs2: version 2.2. (NAND) © 2001-2006 Red Hat,Inc.
9p: Installing v9fs 9p2000 file system support
io scheduler noop registered (default)
0.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
0.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
Concatenating MTD devices:
(0): "0.flash"
(1): "0.flash"
into device "0.flash"
usbcore: registered new interface driver usb-storage
mousedev: PS/2 mouse device common for all mice
rtc-pl031 9010000.pl031: rtc core: registered pl031 as rtc0
Driver 'mmcblk' needs updating - please use bus_type methods
ledtrig-cpu: registered to indicate activity on cpus
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP: cubic registered
NET: Registered protocol family 17
9pnet: Installing 9P2000 support
rtc-pl031 9010000.pl031: setting system clock to 2017-10-01 04:53:36 UTC (1506833616)
ALSA device list:
 No soundcards found.
Freeing unused kernel memory: 1312K (ffff8000006cb000 - ffff800000813000)
Freeing alternatives memory: 4K (ffff800000813000 - ffff800000814000)
Bad inittab entry at line 4

Please press Enter to activate this console. 
/ # ls
bin etc mnt sbin tmp
dev linuxrc proc sys usr
/ # 
/ # 

4.ok , 到这里就已经run起来了。 原文链接:https://www.f2er.com/ubuntu/351077.html

猜你在找的Ubuntu相关文章