[vc_row][vc_column][vc_column_text]We have covered the uboot. Now we will continue the adventure by looking at port linux3.15.
[/vc_column_text][vc_tour][vc_tab title=”Download source files of the latest Linux kenel” tab_id=”1404093631-1-76″][vc_column_text]
#git clone git://github.com/mripard/linux.git -b sunxi-next
Note: # means that the command is on a host PC that is doing cross compilation for the target, which is pcDuino with ARM core.[/vc_column_text][/vc_tab][vc_tab title=”Add dtb of pcDuino” tab_id=”1404093631-2-57″][vc_column_text]
#vim arch/arm/boot/dts/sun7i-a20-pcduino3.dts
/* * Copyright 2014 LinkSprite * Pillar Zuo<zuobaozhu@gmail.com> * * The code contained herein is licensed under the GNU General Public * License. You may obtain a copy of the GNU General Public License * Version 2 or later at the following locations: * * http://www.opensource.org/licenses/gpl-license.html * http://www.gnu.org/copyleft/gpl.html */ /dts-v1/; /include/ "sun7i-a20.dtsi" /include/ "sunxi-ahci-reg.dtsi" /include/ "sun4i-a10-usb-vbus-reg.dtsi" #include <dt-bindings/input/input.h> / { model = "LinkSprite pcDuino V3"; compatible = "linksprite,a20-pcduino", "allwinner,sun7i-a20"; aliases { spi0 = &spi1; spi1 = &spi2; }; soc@01c00000 { spi1: spi@01c06000 { pinctrl-names = "default"; pinctrl-0 = <&spi1_pins_a>; status = "okay"; }; spi2: spi@01c17000 { pinctrl-names = "default"; pinctrl-0 = <&spi2_pins_a>; status = "okay"; }; mmc0: mmc@01c0f000 { pinctrl-names = "default", "default"; pinctrl-0 = <&mmc0_pins_a>; pinctrl-1 = <&mmc0_cd_pin_reference_design>; cd-gpios = <&pio 7 1 0>; /* PH1 */ status = "okay"; }; usbphy: phy@01c13400 { usb1_vbus-supply = <®_usb1_vbus>; usb2_vbus-supply = <®_usb2_vbus>; status = "okay"; }; ehci0: usb@01c14000 { status = "okay"; }; ohci0: usb@01c14400 { status = "okay"; }; ahci: sata@01c18000 { target-supply = <®_ahci_5v>; status = "okay"; }; ehci1: usb@01c1c000 { status = "okay"; }; ohci1: usb@01c1c400 { status = "okay"; }; pinctrl@01c20800 { led_pins_pcduino3: led_pins@0 { allwinner,pins = "PH2"; allwinner,function = "gpio_out"; allwinner,drive = <1>; allwinner,pull = <0>; }; }; lradc: lradc@01c22800 { allwinner,chan0-step = <200>; linux,chan0-keycodes = <KEY_VOLUMEUP KEY_VOLUMEDOWN KEY_MENU KEY_SEARCH KEY_HOME KEY_ESC KEY_ENTER>; status = "okay"; }; uart0: serial@01c28000 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pins_a>; status = "okay"; }; uart6: serial@01c29800 { pinctrl-names = "default"; pinctrl-0 = <&uart6_pins_a>; status = "okay"; }; uart7: serial@01c29c00 { pinctrl-names = "default"; pinctrl-0 = <&uart7_pins_a>; status = "okay"; }; i2c0: i2c@01c2ac00 { pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins_a>; status = "okay"; }; i2c1: i2c@01c2b000 { pinctrl-names = "default"; pinctrl-0 = <&i2c1_pins_a>; status = "okay"; }; i2c2: i2c@01c2b400 { pinctrl-names = "default"; pinctrl-0 = <&i2c2_pins_a>; status = "okay"; }; gmac: ethernet@01c50000 { pinctrl-names = "default"; pinctrl-0 = <&gmac_pins_mii_a>; phy = <&phy1>; phy-mode = "mii"; status = "okay"; phy1: ethernet-phy@1 { reg = <1>; }; }; }; leds { compatible = "gpio-leds"; pinctrl-names = "default"; pinctrl-0 = <&led_pins_pcduino3>; green { label = "a20-pcduino:green:usr"; gpios = <&pio 7 2 0>; default-state = "on"; }; }; };
#vim arch/arm/boot/dts/sunxi-ahci-reg.dtsi
/* * sunxi boards sata target power supply common code * * Copyright 2014 - Hans de Goede <hdegoede@redhat.com> * * The code contained herein is licensed under the GNU General Public * License. You may obtain a copy of the GNU General Public License * Version 2 or later at the following locations: * * http://www.opensource.org/licenses/gpl-license.html * http://www.gnu.org/copyleft/gpl.html */ / { soc@01c00000 { pio: pinctrl@01c20800 { ahci_pwr_pin_a: ahci_pwr_pin@0 { allwinner,pins = "PB8"; allwinner,function = "gpio_out"; allwinner,drive = <0>; allwinner,pull = <0>; }; }; }; reg_ahci_5v: ahci-5v { compatible = "regulator-fixed"; pinctrl-names = "default"; pinctrl-0 = <&ahci_pwr_pin_a>; regulator-name = "ahci-5v"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; enable-active-high; gpio = <&pio 1 8 0>; }; };
#vim arch/arm/boot/dts/sun4i-a10-usb-vbus-reg.dtsi
/* * sun4i boards usb vbus supply common code * * Copyright 2014 - Hans de Goede <hdegoede@redhat.com> * * The code contained herein is licensed under the GNU General Public * License. You may obtain a copy of the GNU General Public License * Version 2 or later at the following locations: * * http://www.opensource.org/licenses/gpl-license.html * http://www.gnu.org/copyleft/gpl.html */ / { soc@01c00000 { pio: pinctrl@01c20800 { usb1_vbus_pin_a: usb1_vbus_pin@0 { allwinner,pins = "PH6"; allwinner,function = "gpio_out"; allwinner,drive = <0>; allwinner,pull = <0>; }; usb2_vbus_pin_a: usb2_vbus_pin@0 { allwinner,pins = "PH3"; allwinner,function = "gpio_out"; allwinner,drive = <0>; allwinner,pull = <0>; }; }; }; reg_usb1_vbus: usb1-vbus { compatible = "regulator-fixed"; pinctrl-names = "default"; pinctrl-0 = <&usb1_vbus_pin_a>; regulator-name = "usb1-vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; enable-active-high; gpio = <&pio 7 6 0>; }; reg_usb2_vbus: usb2-vbus { compatible = "regulator-fixed"; pinctrl-names = "default"; pinctrl-0 = <&usb2_vbus_pin_a>; regulator-name = "usb2-vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; enable-active-high; gpio = <&pio 7 3 0>; }; };
[/vc_column_text][/vc_tab][vc_tab title=”Modify Makefile” tab_id=”1404094128111-2-2″][vc_column_text]
#vim arch/arm/boot/dts/Makefile
[/vc_column_text][/vc_tab][vc_tab title=”Create a new directory and configure the kernel” tab_id=”1404094176878-3-5″][vc_column_text]
#mkdir build #ARCH=arm make sunxi_defconfig O=build #ARCH=arm make menuconfig O=build
Select:
[*] Enable loadable module support —> [*] Forced module loading [*] Module unloading [*] Forced module unloading [*] Module versioning support [*] Source checksum for all modules [*] Module signature verification [*] Require modules to be validly signed [*] Automatically sign all modules Which hash algorithm should modules be signed with? (Sign modules with SHA-1)
System Type —> [*] Allwinner SoCs —> [*] Allwinner A20 (sun7i) SoCs support
[/vc_column_text][/vc_tab][vc_tab title=”Save, quit and begin to build” tab_id=”1404094436939-4-0″][vc_column_text]
#ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LOADADDR=0×40008000 make uImage dtbs O=build -j 8
[/vc_column_text][/vc_tab][vc_tab title=”Copy uImage and dtb to SD” tab_id=”1404095290898-5-5″][vc_column_text]
#cp arch/arm/boot/uImage /media/5BC6-6413/ #cp cp arch/arm/boot/dts/sun7i-a20-pcduino3.dtb /media/5BC6-6413/
5BC6-6413 is the first partition. [/vc_column_text][/vc_tab][vc_tab title=”Reboot” tab_id=”1404095867489-6-2″][vc_column_text]
U-Boot SPL 2014.04-rc3-10520-g87ca6dc-dirty (May 28 2014 - 14:07:34) Board: pcDuino3 DRAM: 1024 MiB CPU: 960000000Hz, AXI/AHB/APB: 3/2/2 spl: not an uImage at 1600 U-Boot 2014.04-rc3-10520-g87ca6dc-dirty (May 28 2014 - 14:07:34) Allwinner Technology CPU: Allwinner A20 (SUN7I) Board: pcDuino3 I2C: ready DRAM: 1 GiB MMC: SUNXI SD/MMC: 0 *** Warning - bad CRC, using default environment In: serial Out: serial Err: serial Hit any key to stop autoboot: 0 reading uEnv.txt 240 bytes read in 17 ms (13.7 KiB/s) Loaded environment from uEnv.txt Running uenvcmd ... reading uImage 2077528 bytes read in 144 ms (13.8 MiB/s) reading dtb 20919 bytes read in 26 ms (785.2 KiB/s) ## Booting kernel from Legacy Image at 46000000 ... Image Name: Linux-3.15.0-rc6-01550-g119918d- Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 2077464 Bytes = 2 MiB Load Address: 40008000 Entry Point: 40008000 Verifying Checksum ... OK ## Flattened Device Tree blob at 49000000 Booting using the fdt blob at 0x49000000 Loading Kernel Image ... OK Using Device Tree in place at 49000000, end 490081b6 Starting kernel ... [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 3.15.0-rc6-01550-g119918d-dirty (pillar@server) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #2 SMP Sun Jun 22 20:06:46 CST 2014 [ 0.000000] CPU: ARMv7 Processor [410fc074] revision 4 (ARMv7), cr=10c5387d [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache [ 0.000000] Machine model: LinkSprite pcDuino V3 [ 0.000000] Memory policy: Data cache writealloc [ 0.000000] PERCPU: Embedded 7 pages/cpu @eefd5000 s6592 r8192 d13888 u32768 [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 260624 [ 0.000000] Kernel command line: console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2 rootwait [ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes) [ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes) [ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes) [ 0.000000] Memory: 1035192K/1048576K available (2735K kernel code, 159K rwdata, 884K rodata, 194K init, 222K bss, 13384K reserved, 270336K highmem) [ 0.000000] Virtual kernel memory layout: [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB) [ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB) [ 0.000000] vmalloc : 0xf0000000 - 0xff000000 ( 240 MB) [ 0.000000] lowmem : 0xc0000000 - 0xef800000 ( 760 MB) [ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB) [ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB) [ 0.000000] .text : 0xc0008000 - 0xc03910f8 (3621 kB) [ 0.000000] .init : 0xc0392000 - 0xc03c29c0 ( 195 kB) [ 0.000000] .data : 0xc03c4000 - 0xc03ebc20 ( 160 kB) [ 0.000000] .bss : 0xc03ebc28 - 0xc04234cc ( 223 kB) [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1 [ 0.000000] Hierarchical RCU implementation. [ 0.000000] RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2. [ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2 [ 0.000000] NR_IRQS:16 nr_irqs:16 16 [ 0.000000] Architected cp15 timer(s) running at 24.00MHz (virt). [ 0.000008] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 2863311519744ns [ 0.000015] Switching to timer-based delay loop [ 0.000283] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956969942ns [ 0.000410] sched_clock: 32 bits at 160MHz, resolution 6ns, wraps every 26843545593ns [ 0.000564] Console: colour dummy device 80x30 [ 0.000591] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000) [ 0.000605] pid_max: default: 32768 minimum: 301 [ 0.000717] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes) [ 0.000729] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes) [ 0.001275] CPU: Testing write buffer coherency: ok [ 0.001548] /cpus/cpu@0 missing clock-frequency property [ 0.001566] /cpus/cpu@1 missing clock-frequency property [ 0.001577] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000 [ 0.001607] Setting up static identity map for 0x402977b8 - 0x40297810 [ 0.002525] CPU1: failed to boot: -38 [ 0.002559] Brought up 1 CPUs [ 0.002566] SMP: Total of 1 processors activated. [ 0.002572] CPU: All CPU(s) started in SVC mode. [ 0.003080] devtmpfs: initialized [ 0.006668] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 4 [ 0.006880] pinctrl core: initialized pinctrl subsystem [ 0.007083] regulator-dummy: no parameters [ 0.011494] NET: Registered protocol family 16 [ 0.011788] DMA: preallocated 256 KiB pool for atomic coherent allocations [ 0.019501] reg-fixed-voltage ahci-5v.3: could not find pctldev for node /soc@01c00000/pinctrl@01c20800/ahci_pwr_pin@0, deferring probe [ 0.019531] platform ahci-5v.3: Driver reg-fixed-voltage requests probe deferral [ 0.019554] reg-fixed-voltage usb1-vbus.4: could not find pctldev for node /soc@01c00000/pinctrl@01c20800/usb1_vbus_pin@0, deferring probe [ 0.019568] platform usb1-vbus.4: Driver reg-fixed-voltage requests probe deferral [ 0.019587] reg-fixed-voltage usb2-vbus.5: could not find pctldev for node /soc@01c00000/pinctrl@01c20800/usb2_vbus_pin@0, deferring probe [ 0.019599] platform usb2-vbus.5: Driver reg-fixed-voltage requests probe deferral [ 0.019905] pps_core: LinuxPPS API ver. 1 registered [ 0.019915] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it> [ 0.020021] PTP clock support registered [ 0.020723] Switched to clocksource arch_sys_counter [ 0.027676] NET: Registered protocol family 2 [ 0.028124] TCP established hash table entries: 8192 (order: 3, 32768 bytes) [ 0.028203] TCP bind hash table entries: 8192 (order: 4, 65536 bytes) [ 0.028324] TCP: Hash tables configured (established 8192 bind 8192) [ 0.028405] TCP: reno registered [ 0.028419] UDP hash table entries: 512 (order: 2, 16384 bytes) [ 0.028477] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes) [ 0.028676] NET: Registered protocol family 1 [ 0.029089] RPC: Registered named UNIX socket transport module. [ 0.029101] RPC: Registered udp transport module. [ 0.029108] RPC: Registered tcp transport module. [ 0.029114] RPC: Registered tcp NFSv4.1 backchannel transport module. [ 0.030120] futex hash table entries: 512 (order: 3, 32768 bytes) [ 0.030189] Initialise system trusted keyring [ 0.030688] bounce pool size: 64 pages [ 0.039135] Key type asymmetric registered [ 0.039151] Asymmetric key parser 'x509' registered [ 0.039420] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251) [ 0.039432] io scheduler noop registered [ 0.039439] io scheduler deadline registered [ 0.039622] io scheduler cfq registered (default) [ 0.041812] sun7i-a20-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver [ 0.083537] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled [ 0.086046] console [ttyS0] disabled [ 0.106239] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 33, base_baud = 1500000) is a U6_16550A [ 0.654046] console [ttyS0] enabled [ 0.679521] dw-apb-uart 1c29800.serial: Couldn't set LCR to 0 [ 0.686268] dw-apb-uart 1c29800.serial: Couldn't set LCR to 0 [ 0.692058] 1c29800.serial: ttyS1 at MMIO 0x1c29800 (irq = 51, base_baud = 1500000) is a U6_16550A [ 0.722886] dw-apb-uart 1c29c00.serial: Couldn't set LCR to 0 [ 0.729631] dw-apb-uart 1c29c00.serial: Couldn't set LCR to 0 [ 0.735403] 1c29c00.serial: ttyS2 at MMIO 0x1c29c00 (irq = 52, base_baud = 1500000) is a U6_16550A [ 0.745736] stmmaceth 1c50000.ethernet: no regulator found [ 0.751305] stmmaceth 1c50000.ethernet: no reset control found [ 0.757136] Ring mode enabled [ 0.760187] No HW DMA feature register supported [ 0.764722] Normal descriptors [ 0.768043] TX Checksum insertion supported [ 0.775997] libphy: stmmac: probed [ 0.779404] eth0: PHY ID 02430c54 at 1 IRQ 0 (stmmac-0:01) active [ 0.785898] mousedev: PS/2 mouse device common for all mice [ 0.791778] i2c /dev entries driver [ 0.797168] sunxi-wdt 1c20c90.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0) [ 0.806288] TCP: cubic registered [ 0.809611] NET: Registered protocol family 17 [ 0.814177] Registering SWP/SWPB emulation handler [ 0.819343] Loading compiled-in X.509 certificates [ 0.831499] Loaded X.509 cert 'Magrathea: Glacier signing key: cc6b77f1515c32d2b4b1365136c9f000545ef48d' [ 0.841469] ahci-5v: 5000 mV [ 0.844682] usb1-vbus: 5000 mV [ 0.848055] usb2-vbus: 5000 mV [ 0.852025] Waiting for root device /dev/mmcblk0p2...
Till now,we can see that the kernel has already booted. [/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]
Leave a Reply
You must be logged in to post a comment.