lubuntu18.04 arm 文件系统制作

开发板 rk3288 kernel linux 4.4
主机:Ubuntu 16.04
一、准备工作
1、安装qemu-user-static 搭建arm 模拟环境

sudo apt-get install qemu-user-static

2、下载 ubuntu-base-18.04.5-base-armhf.tar.gz
下载: http://cdimage.ubuntu.com/
选择32位
ubuntu-base-18.04.5-base-armhf.tar.gz

wget http://cdimage.ubuntu.com/ubuntu-base/releases/18.04.5/release/ubuntu-base-18.04.5-base-armhf.tar.gz
mkdir lubunut18
sudo tar -zxvf ubuntu-base-18.04.5-base-armhf.tar.gz -C lubunut18

sudo cp /usr/bin/qemu-arm-static lubunut18/usr/bin/
sudo cp -b /etc/resolv.conf lubunut18/etc/

修改软件源,改为国内,可以提高下载速度
记得把软件源sources.list里的https改成http就行了,不然会无法更新。或者先安装apt-transport-https之后再修改sources.list.
参考:https://www.cnblogs.com/yongy1030/p/10315569.html
https://blog.csdn.net/yhcasey/article/details/123891296?spm=1001.2014.3001.5506

3、chroot
ch-mount.sh

#!/bin/bash
function mnt() {
    echo "MOUNTING"
    sudo mount -t proc /proc ${2}proc
    sudo mount -t sysfs /sys ${2}sys
    sudo mount -o bind /dev ${2}dev
    sudo mount -o bind /dev/pts ${2}dev/pts
    sudo chroot ${2}
}
function umnt(){
    echo "UNMOUNTING"
    sudo umount ${2}proc
    sudo umount ${2}sys
    sudo umount ${2}dev/pts
    sudo umount ${2}dev
}
if [ "$1" == "-m" ] && [ -n "$2" ] ;
then
    mnt $1 $2
elif [ "$1" == "-u" ] && [ -n "$2" ];
then
    umnt $1 $2
else
    echo ""
    echo "Either 1'st, 2'nd or bothparameters were missing"
    echo ""
    echo "1'st parameter can be one ofthese: -m(mount) OR -u(umount)"
    echo "2'nd parameter is the full pathof rootfs directory(with trailing '/')"
    echo ""
    echo "For example: ch-mount -m/media/sdcard/"
    echo ""
    echo 1st parameter : ${1}
    echo 2nd parameter : ${2}
fi

二、制作文件系统

sudo bash ch-mount.sh -m lubunut18/
apt-get update
apt-get upgrade
ubuntu更新软件源报错: **Certificate verification failed: The certificate is NOT trusted.**
把软件源里的`https`改成`http`就行了
**Couldn't create temporary file /tmp/apt.conf.9i46a0 for passing config to apt-key**
给tmp加权限
chmod 777 /tmp

成功就可以安装所需软件
1、安装语言包

以防中途有乱码,或者警告语言包什么的
英文
					language-pack-en
					language-pack-en-base
中文语言包: language-pack-zh-hans 简体中文
					language-pack-zh-hans-base
					language-pack-zh-hant 繁体中文
					language-pack-zh-hant-base
apt-get install language-pack-en language-pack-zh-hans

2、安装一些工具

apt-get install sudo dialog apt-utils iputils-ping wget net-tools ethtool wireless-tools network-manager resolvconf wpasupplicant dhcpcd5 rsyslog bash-completion htop vim 	--no-install-recommends
sudo dialog apt-utils iputils-ping wget 
net-tools ethtool wireless-tools network-manager resolvconf
wpasupplicant dhcpcd5
rsyslog bash-completion htop
vim openssh-sever 

3、添加用户,设置密码,设置主机名等

adduser winston
...
addgroup winston adm
addgroup winston sudo
addgroup winston audio

passwd root
...

设置主机名
/etc/hostname

echo 'x3288' > etc/hostname
cat etc/hostname
x3288

/etc/hosts
127.0.0.1 localhost
127.0.1.1 x3288

echo '127.0.0.1	localhost'	> etc/hosts
echo '127.0.1.1	x3288'		>> etc/hosts

或者

echo '127.0.0.1 localhost.localdomain localhost x3288'	> etc/hosts
echo '::1 		localhost.localdomain localhost x3288'	>> etc/hosts

可以退出用开发板网络挂载或者优盘挂载安装桌面了,在这里可以继续安装,但我安装时老是出错,所以选择了开发板

exit
sudo bash ch-mount.sh -u ubuntu-rootfs/

4、安装桌面

	Ubuntu 的软件源提供的图形界面,适用于ARM 的,包括xubuntu、lubuntu、ubuntu 等,大体上包含这三类,相应的软件包为:xubuntu-desktop、xubuntu-core、lubuntu-desktop、lubuntu-core、ubuntu-desktop,其中带有core 的软件包是只安装核心的相关的图形库,-desktop 是完整安装,包括一些工具等。
	资源消耗  ubuntu > xubuntu > lubuntu
apt-get install lubuntu-desktop	##lubuntu-desktop太大了3GB不建议安装,可以安装lubuntu-core,完了选装些软件
时间比较久,要等好一会儿,中途会弹出一些语言、时区选择
在电脑chroot安装老出错。。。。。。。。。。。。。。
dpkg: 处理软件包 XXXX (--configure)时出错解决方法
[参考:](https://blog.csdn.net/qq_41204927/article/details/83376560)
 sudo mv var/lib/dpkg/info var/lib/dpkg/info_old //现将info文件夹更名 
sudo mkdir var/lib/dpkg/info //再新建一个新的info文件夹
sudo apt-get update && apt-get -f install //不用解释了吧
sudo mv var/lib/dpkg/info/* var/lib/dpkg/info_old //执行完上一步操作后会在新的info文件夹下生成一些文件,现将这些文件全部移到info_old文件夹下
sudo rm -rf var/lib/dpkg/info //把自己新建的info文件夹删掉
sudo mv var/lib/dpkg/info_old var/lib/dpkg/info //把以前的info文件夹重新改

5、测试
可以通过优盘启动或者网络启动测试文件系统,修改完善

6、检查更新,删除不用的软件包,可以清理缓存

完成后可以退出
apt-get autoremove -y
apt-get autoclean -y
apt-get clean -y

sudo rm -rf var/lib/apt/lists/ports.*

exit
sudo bash ch-mount.sh -u ubuntu-rootfs/

清理用户目录下.viminfo 和.bash_history 等等

7、制作镜像

dd if=/dev/zero of=rootfs-lubuntu18.04.img bs=1M count=4096
sudo mkfs.ext4 -F -L linuxroot rootfs-lubuntu18.04.img
sudo mount rootfs-lubuntu18.04.img ubuntu-rootfs/
sudo cp -rvfp lubunut18/* ubuntu-rootfs/
sudo umount ubuntu-rootfs/
sudo e2fsck -p -f rootfs-lubuntu18.04.img
sudo resize2fs -M rootfs-lubuntu18.04.img

制作好后即可用来烧写到rootfs 分区
注意:linuxroot 与 bootargs 里的参数一致

mpalyer ffmpeg
openssh-server
mysql-server mysql-client
lubuntu-core
lxde
qt5-default
lightdm
xfce4-power-manager ##电源管理设置熄屏睡眠
lxappearance ##主题设置,图标设置

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值