
一Raspberry Pi入门向导。
可以在以下地址下载Raspberry向导
2构建android framework
命令如下:
cd <your_android_path>
source build/envsetupsh
lunch
显示lunch菜单如下:
You’re building on Linux
Lunch menu… pick a combo:
1 full-eng
2 full_x86-eng
3 simulator
4 full_rpi-eng
5 cyanogen_generic-eng
6 cyanogen_rpi-eng
选择第6个菜单。
然后进行编译
make -j8
等待编译成功,这可能需要几十分钟。
编译成功之后将”system”目录复制到root目录下,接下来我们可能会用到。
命令如下:
cd <your_android_path>
cp -r system out/target/product/rpi/root
ps:编译时如果jdk版本不对,可将其改成jdk16
五如何在Raspberry Pi上跑android linux内核?
1准备一张存储空间2G以上的SD卡及相应读卡器。
2下载arch linux镜像文件
用wget工具下载镜像文件:
wget >
解压:
unzip archlinux-hf-2012-09-18zip
成功之后,你会在当前目录下发现一个镜像文件。
3烧linux镜像文件。
sudo dd bs=4M if=archlinux-hf-2012-09-18img of=/dev/sdb
sudo sync
ps:/dev/sdb是SD卡在主机上的设备文件。不同的电脑可能不同。
4用android linux内核代替这个内核。
做完上述步骤之后,当你把SD卡插在电脑上,你会发现有两个分区:一个是引导区,另一个是文件系统区。
用android linux内核代替引导区的kernelimg。
cp -uv <your_android_linux_path>/arch/arm/boot/zImage <your_sdcard_boot_partition>/kernelimg
5用android linux文件系统代替这个linux文件系统
rm -rf <your_sdcard_file_system_partition>
cp -r <your_android_source_code_path>/out/target/product/rpi/root/ <your_sdcard_file_system_partition>
6配置内核命令行cmdlinetxt
Edit the <your_sdcard_boot_partition>/cmdlingtxt, and replace “init=/…” with “init=/init”
7做完这些之后就可以在Raspberry Pi上跑这个android linux内核。
六如何为Android linux做一张可引导的SD卡
1删除已有分区,如果没有就不用删了。
Command(m for help):p
Disk /dev/sdb: 157 GB, 15707668480 bytes
64 heads, 32 sectors/track, 14980 cylinders, total 30668085 sectors
Units = sectors of 1 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0×00000000
sudo fdisk/dev/sdb
Command(m for help):d
Partition number(1-4):1
Command(m for help):d
Selected partition 2
Command (m for help): p
Disk /dev/sdb: 157 GB, 15707668480 bytes
64 heads, 32 sectors/track, 14980 cylinders, total 30679040 sectors
Units = sectors of 1 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0×00000000
Device Boot Start End Blocks Id System
Command(m for help):w
ps:确定删除之后,卸掉SD卡,然后再装上。
以bytes问单位记下SD卡的大小。后面的步骤会用到。
然后进入”Expert mode”。
Command(m for help):x
将这个SD卡设置为255个磁面,63个扇区和磁柱数量(不同的SD/mmc卡有着不同的此柱数量)
Expert command (m for help): h
Number of heads (1-256, default 64): 255
Expert command (m for help): s
Number of sectors (1-63, default 32): 63
ps:在下一步开始前,先要计算磁柱数量,计算过程如下:
B:SD卡以bytes为单位的大小(前面已经记住了即:15707668480)
C:磁柱的数量
C=B/255/63/512
例如:我的SD卡大小是16G(15707668480)
C=15707668480/255/63/512=190968191721,约等于1909
Expert command (m for help): c
Number of cylinders (1-1048576, default 14980): 1909
Expert command (m for help): r
2新建分区
如果你的SD卡已经分区,请按照上述步骤删除分区。接下来,我们将创建两个分区,一个是引导区,用来存放内核镜像等文件;另一个文件系统区存放android linux文件系统。
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-30679039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-30679039, default 30679039): +128M
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))
Command (m for help): a
Partition number (1-4): 1
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (1-4, default 2):
Using default value 2
First sector (264192-30679039, default 264192):
Using default value 264192
Last sector, +sectors or +size{K,M,G} (264192-30679039, default 30679039):
Using default value 30679039
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table
WARNING: If you have created or modified any DOS 6x
partitions, please see the fdisk manual page for additional
information
Syncing disks
ok,分区成功,现在我们有两个分区,接下我们对分区进行格式化。
3格式化分区
对引导区进行格式化:
sudo mkfsmsdos -F 32 /dev/sdb1 -n BOOT
mkfsmsdos 3012 (29 Oct 2011)
对文件系统区进行格式化:
sudo mkfsext3 /dev/sdb2 -L ROOTFS
mke2fs 142 (29-Nov-2011)
Filesystem label=ROOTFS
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
950976 inodes, 3801856 blocks
190092 blocks (500%) reserved for the super user
First data block=0
Maximum filesystem blocks=3896508416
117 block groups
32768 blocks per group, 32768 fragments per group
8128 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
4设置引导区
引导区必须包含以下文件,你可以从官方镜像里获取(bootable/fat32 partition)也可以从书面步骤中复制过来:
bootcodebin:第二阶段的引导程序,
loaderbin:第三阶段的引导程序,
startelf:GPU二进制固件映像,
kernelimg *** 作系统的内核镜像文件,
cmdlinetxt:传递给内核的参数
5设置root文件系统分区
ROOTFS分区包含android文件系统,是从<your_android_framework_path>/out/target/product/rpi/root复制过来的。
cp -r <your_android_framework_path>/out/target/product/rpi/root/ /media/ROOTFS/
6完成上述步骤之后,将其放在Raspberry Pi上跑。
七如何在Raspberry Pi使用adb
1查看网络
当android linux在Raspberry Pi运行时,切换到控制台,执行以下命令:
ifconfig eth0
记下ip地址。
如果不能找到ip,可以输入以下命令:/system/xbin/dhcp-eth0,来启动网络连接程序。
ps:如果屏幕没有显示控制台,只要按CTRL+ALT+F2即可切换到控制台。如果你想要切换到Android界面,只要按CTRL+ALT+F7即可。
2远程连接adb服务器
在主机上执行以下命令即可与同一局域网的Raspberry Pi相连
adb connect ip
连接成功后,你就可以用adb工具输出日志,执行shell命令等。
3也可以用数据线连接主机,直接在主机上调试。
进入调试的命令为:
screen /dev/ttyUSB0 115200
名词解释:
交叉编译(cross compile):交叉编译呢,简单地说,就是在一个平台上生成另一个平台上的可执行代码。这里需要注意的是所谓 平台,实际上包含两个概念:体系结构(Architecture)、 *** 作系统(Operating System)。同一个体系结构可以运行不同的 *** 作系统;同样,同一个 *** 作系统也可以在不同的体系结构上运行。举例来说,我们常说的x86 Linux平台实际上是Intel x86体系结构和Linux for x86 *** 作系统的统称;而x86 WinNT平台实际上是Intel x86体系结构和Windows NT for x86 *** 作系统的简称。
三星手机uboot 下更改NAND的分区 fdisk
一、NAND分区大小:
机器用的是8G的INAND,三星平台一般把它分为四个区:
(1)、fat分区,作为sd卡用;
(2)、系统分区,相当为电脑c 盘,用来安装android系统;
(3)、userdata分区;
(4)、cache分区。
二、分区更改 *** 作过程
1, 更改uboot中代码/common/cmd_mmc_fdiskc
在这个文件中我们可以看到对四个分区大小的定义:
2,编译uboot 、烧录
#sudo fastboot flash bootloader u-bootbin(三星平台的命令,不同平台也许不同)
重启,进入uboot命令行模式,一定要重启。
3,重新分区 fdisk -c 0
#fdisk –c 0 //重新把INAND分区
#fdisk –p 0 //查看INAND分区信息
如下所示,600MB为我们新分的空间。
4,把整个系统区重新格式化
系统重重分区后,原来烧录程序位置发生改变,系统分区(相当于电脑的c盘)也变化,所以要重新格式化。(下面的命令是三星平台下的,因平台而不同)
5、把整个系统重新烧录
6,打开机器,如下图所示,查看更改结果 。
以上就是关于如何将android linux烧到Raspberry Pi及其调试全部的内容,包括:如何将android linux烧到Raspberry Pi及其调试、安卓系统fidsk工具 重新分区、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)