海运的博客

为n1制作aarcm64/arm64 ubuntu rootfs系统

发布时间:October 20, 2018 // 分类:N1 // No Comments

安装debootstrap和qemu-user-static:

apt install apt-transport-https qemu qemu-user-static binfmt-support debootstrap

构建ubuntu 18.04系统,基础包为minbase,使用清大的源:

qemu-debootstrap --arch arm64 --variant=minbase --include=whiptail,ca-certificates,tzdata bionic rootfs http://mirrors.ustc.edu.cn/ubuntu-ports/

配置软件源:

cat > rootfs/etc/apt/sources.list <<EOF
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse
EOF

配置网络信息:

mkdir rootfs/etc/network/ 
echo 'nameserver 192.168.168.1' > rootfs/etc/resolv.conf
echo 'ubuntu-18.04' > rootfs/etc/hostname
cat > rootfs/etc/netplan/50-cloud-init.yaml <<EOF
network:
    ethernets:
        eth0:
            addresses:
            - 192.168.168.6/24
            dhcp4: false
            gateway4: 192.168.168.1
            nameservers:
                addresses:
                - 192.168.168.1
                search: []
    version: 2
EOF

挂载本地设备文件到rootfs:

mount -t proc /proc  rootfs/proc 
mount -t sysfs /sys  rootfs/sys 
mount -o bind /dev  rootfs/dev 
mount -o bind /dev/pts  rootfs/dev/pts 

chroot rootfs内配置:

LANG=C.UTF-8 chroot rootfs/  /bin/bash

在rootfs内执行:

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
apt update
apt upgrade
apt install systemd -y 
apt install wireless-regdb crda -y
apt install rsyslog udev dbus kmod openssh-server netplan.io man vim wget net-tools sysstat tmux less wireless-regdb crda dosfstools parted rng-tools -y
echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
passwd root
umount /dev/pts/ /dev/ /proc/ /sys 
exit

为方便使用之前编译的内核和armbian的uInitrd、firmware文件,挂载armbian的img镜像到本地:

losetup -P -f --show Armbian_5.62_Aml-s9xxx_Ubuntu_bionic_default_4.18.7_20181012.img
mount /dev/loop3p2 /mnt
mount /dev/loop3p2 /mnt/boot
mv /mnt/boot/* rootfs/boot/
mv /mnt/lib/modules/ rootfs/lib/
#也可安装armbian的firmware-aml-4.18-20181011_5.62_arm64.deb
mv /mnt/lib/firmware/ rootfs/lib/
mv /mnt/etc/modprobe.d/ rootfs/etc/
mv /mnt/etc/fstab rootfs/etc/
mv /mnt/root/install.sh rootfs/root/

将armbain镜像内的文件全部删除,将新做的系统移动过去。

rm -rf /mnt/*
mv rootfs/boot/* /mnt/boot/
mv rootfs/* /mnt/

参考:
https://help.ubuntu.com/lts/installation-guide/s390x/apds04.html

n1下ubuntu安装cups配置airprint网络打印服务器

发布时间:October 20, 2018 // 分类:N1 // No Comments

打印机通过usb接口连接n1,ubuntu/armbian要安装usblp内核模块,查看本机是否有usblp模块:

modinfo usblp
filename:       /lib/modules/4.18.7-aml-s9xxx/kernel/drivers/usb/class/usblp.ko
license:        GPL
description:    USB Printer Device Class driver

如果没有需编译内核usblp模块,可参考:https://www.haiyun.me/archives/1266.html
系统软件源使用所有,不然很多打印机驱动没有:

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse

然后安装配置cpus

apt update
apt install cups

修改为以下配置:

#这行很重要,是否将共享的打印机让本地网络发现,如使用airprint。
Browsing on
Listen 0.0.0.0:631
<Location />
  Order allow,deny
  Allow all
</Location>

<Location /admin>
  Order allow,deny
  Allow all
</Location>

重启cups:

systemctl restart cups
systemctl restart cups-browsed

将打印机和n1连接,此时内核日志应该提示打印机已连接:

dmesg|tail -n 1
usblp 1-1:1.1: usblp0: USB Bidirectional printer dev 8 if 1 alt 0 proto 2 vid 0x04A9 pid 0x176C

cups有此打印机驱动也正常识别了:

lpinfo -v      
network ipp
direct usb://Canon/MG2400%20series?serial=988776&interface=1

查看支持的打印机驱动:

lpinfo -m

访问cups web管理界面添加打印机,地址:ip:631,配置很简单,详细步骤略过。
添加打印机后iphone应该就能通过airprint识别打印机了。
windows下可在控制面板下添加打印机,地址为ip:631/printers/name

无打印机驱动的可添加打印机为raw模式,windows下连接共享的打印机选择相应的驱动也可打印:

lpadmin -p mg2400 -E -v  parallel:/dev/usb/lp0 

遇到的一些问题:
1.开机启动时加载内核驱动失败,cups默认会加载lp/ppdev/parport_pc内核驱动,由于已使用usblp内核驱动,可将这些注释掉,/etc/modules-load.d/cups-filters.conf
2.通过cups打印时没反应,内核提示usblp0: removed,打印机未正常工作,可将打印机连接至电脑查看具体原因。

更多参考:
http://www.winotmk.com/2017/03/1136
https://www.ncnynl.com/archives/201608/742.html
https://ubuntuforums.org/showthread.php?t=2295559

n1盒子不能开机救砖

发布时间:October 17, 2018 // 分类:N1 // No Comments

将armbian写入N1 mmc分区的时候将分区搞坏了,启动时显示logo界面后一直黑屏,不能进入android系统和通过U盘启动,也就没办法进入线刷模式,准备拆机短接进入线刷模式,再不行上TTL线,偶然在恩山看到通过插拔电源接口线可进入线刷模式,试了下刷机成功,万幸。
1.打开刷机软件导入镜像,点击开始。
2.N1盒子端拔掉电源线,用双公头USB线连接电脑和盒子
3.插入电源线,不出意外开始刷机。

参考:
http://www.right.com.cn/forum/thread-336312-1-1.html
http://www.right.com.cn/forum/thread-335972-1-1.html

ubuntu/linux交叉编译n1下armbian内核

发布时间:October 15, 2018 // 分类:N1 // 6 Comments

之前有写编译armbian内核模块 ,但是在有些情况下模块并不能被加载。如我要开启bbr,虽然系统自带了bbr模块,但是没bbr所需要的fq队列模块,编译fq模块后不能加载,因为内核在编译的时候未开启NET_SCHED,遇到这种情况只有重新编译内核了。
2018-10-15_192540.png
将下载的armbian img镜像挂载到硬盘,等会编译好内核后直接替换镜像中原先的内核,使用armbian的rootfs系统。

losetup -P -f --show Armbian_5.62_Aml-s9xxx_Ubuntu_bionic_default_4.18.7_20181012.img 
#loop3为上面挂载的loop设备
mount /dev/loop3p2 /mnt/
mount /dev/loop3p1 /mnt/boot/

安装编译工具及配置编译环境:

apt-get install gcc make pkg-config git bison flex libelf-dev libssl-dev libncurses5-dev
wget https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz
tar -Jxvf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz 
export ARCH=arm64 
export CROSS_COMPILE=/root/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
git clone https://github.com/150balbes/Amlogic_s905-kernel.git
#4.9内核,gcc要使用版本6
#git clone -b khadas-4.9 https://github.com/150balbes/Amlogic_s905-kernel.git
cd Amlogic_s905-kernel
#使用4.18.7内核
git checkout 20181012

使用armbian自带内核的配置文件:

cp /mnt/boot/config-4.18.7-aml-s9xxx .config

然后再配置要开启的功能,退出时要保存配置,更多编译选项使用make help查看。

make clean
make menuconfig

编译安装内核文件:

make LOCALVERSION="-aml-s9xxx" Image -j 4
make install INSTALL_PATH=/mnt/boot/
cp arch/arm64/boot/Image /mnt/boot/zImage

编译安装内核模块:

rm -rf /mnt/lib/modules
make LOCALVERSION="-aml-s9xxx" modules -j 4
make modules_install INSTALL_MOD_PATH=/mnt/

使用修改的dtb文件解决armbian 4.18负载较高问题:

rm -rf /mnt/boot/dtb.img
wget https://github.com/yangxuan8282/phicomm-n1/releases/download/dtb/meson-gxl-s905d-phicomm-n1.dtb -O /mnt/boot/dtb.img

完成,将修改好的img镜像dd到u盘即可使用。

linux下查看N1盒子mmc分区信息

发布时间:October 14, 2018 // 分类:N1 // No Comments

在x86电脑上使用fdisk就能查看所有硬盘的信息,n1为android mmc分区,通过u盘引导linux后查看分区方法如下
查看mmc存储的设置号:

cat /proc/devices |grep mmc
179 mmc

查看对应的分区信息:

cat /proc/partitions |grep 179
 179        0    7634944 mmcblk0
 179        1       4096 mmcblk0p1
 179        2      65536 mmcblk0p2
 179        3     524288 mmcblk0p3
 179        4       8192 mmcblk0p4
 179        5      32768 mmcblk0p5
 179        6      32768 mmcblk0p6
 179        7       8192 mmcblk0p7
 179        8       8192 mmcblk0p8
 179        9      32768 mmcblk0p9
 179       10      32768 mmcblk0p10
 179       11      32768 mmcblk0p11
 179       12    1310720 mmcblk0p12
 179       13    5419008 mmcblk0p13
 179       96        512 mmcblk0rpmb
 179       64       4096 mmcblk0boot1
 179       32       4096 mmcblk0boot0

查看分区映射:

ls -al /dev/block/179*        
lrwxrwxrwx 1 root root 10 Jul 29 09:08 /dev/block/179:0 -> ../mmcblk0
lrwxrwxrwx 1 root root 13 Jul 29 09:08 /dev/block/179:1 -> ../bootloader
lrwxrwxrwx 1 root root  7 Jul 29 09:08 /dev/block/179:10 -> ../misc
lrwxrwxrwx 1 root root  7 Jul 29 09:08 /dev/block/179:11 -> ../boot
lrwxrwxrwx 1 root root  9 Jul 29 09:08 /dev/block/179:12 -> ../system
lrwxrwxrwx 1 root root  7 Jul 29 09:08 /dev/block/179:13 -> ../data
lrwxrwxrwx 1 root root 11 Jul 29 09:08 /dev/block/179:2 -> ../reserved
lrwxrwxrwx 1 root root  8 Jul 29 09:08 /dev/block/179:3 -> ../cache
lrwxrwxrwx 1 root root 15 Jul 29 09:08 /dev/block/179:32 -> ../mmcblk0boot0
lrwxrwxrwx 1 root root  6 Jul 29 09:08 /dev/block/179:4 -> ../env
lrwxrwxrwx 1 root root  7 Jul 29 09:08 /dev/block/179:5 -> ../logo
lrwxrwxrwx 1 root root 11 Jul 29 09:08 /dev/block/179:6 -> ../recovery
lrwxrwxrwx 1 root root 15 Jul 29 09:08 /dev/block/179:64 -> ../mmcblk0boot1
lrwxrwxrwx 1 root root  6 Jul 29 09:08 /dev/block/179:7 -> ../rsv
lrwxrwxrwx 1 root root  6 Jul 29 09:08 /dev/block/179:8 -> ../tee
lrwxrwxrwx 1 root root  8 Jul 29 09:08 /dev/block/179:9 -> ../crypt
lrwxrwxrwx 1 root root 14 Jul 29 09:08 /dev/block/179:96 -> ../mmcblk0rpmb

然后可以使用fdisk查看特定分区信息了,如查看mmcblk0p13:

fdisk -l /dev/data
分类
最新文章
最近回复
  • 海运: 正常情况下编译整个内核执行make menuconfig后就不会出现此提示,当单独编译单个模块...
  • oijq: 就是用的armbian的配置文件哈,按你的教程做的,在执行make LOCALVERSION=...
  • 海运: 使用armbian的配置文件,其它添加或修改自己懂的部分,不懂的就不要碰了。
  • oijq: 编译时这些选项全部选Y吗?Actions Semi Platforms (ARCH_ACTIO...
  • 海运: n1编译bbr内核模块参考这个:https://www.haiyun.me/archives/...
  • jiqz: make M=net/ipv4/ CONFIG_TCP_CONG_BBR=m modules编...
  • ruralhunter: 哦,文档里应该是对的,是.config
  • ruralhunter: cp /mnt/boot/config-4.18.7-aml-s9xxx .config这里应...
  • 海运: 你是编译不成功呢?还是编译后不能运行呢?还是运行后不能访问web界面呢?
  • 白墨: 可能不清楚就是编译安装后启动后访问不了web界面
归档