debootstrap Debian Buster on imx8mminievk

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

debootstrap Debian Buster on imx8mminievk

5,348 Views
andreasgustafss
Contributor III

This guide will show you how to debootstrap Debian Buster on imx8mminievk on a SD-card, but will very likely help you on other systems as well. First you need a Linux installation present on the imx8mminievk.

Follow the Getting Started guide to install a Linux System on the board. In short it is done in the following 5 steps:

  1.  Download L4.14.78_1.0.0_ga_images_MX8MMEVK.zip
  2. Download uuu
  3. Put board in download mode (SDP) [1010xxxxxx] [xxxxxxxxx0]
  4. run uuu with L4.14.78_1.0.0_ga_images_MX8MMEVK.zip as argument
  5. plug in and turn on the board

Now put the board back in eMMC boot mode [0110110001] [0001010100] and start up the supplied Linux system. All logins are done with root (no password).

Plug in a SD-card and copy the partition table:

sfdisk -d /dev/mmcblk2 | sfdisk /dev/mmcblk1

Copy data from the boot partition:

dd if=/dev/mmcblk2p1 of=/dev/mmcblk1p1 bs=1M

Resize data partition on the target (SD-card):

echo ",+" | sfdisk -N2 /dev/mmcblk1

Create file system and mount it:

mkfs.ext4 /dev/mmcblk1p2
mkdir /mnt/target
mount /dev/mmcblk1p2 /mnt/target

To be able to bootstrap the system we need debootstrap and binutils, (1), (2) available on the system. Use ar to extract the data.tar on another computer (or 7zip if you use Windows), copy the tar-files with scp/winscp onto the board and extract with tar -xf. (Because 7zip/windows cant handle symlinks).

Set up symbolic links for debootstrap, ar and libbfd:

ln -s /home/root/usr/sbin/debootstrap /usr/sbin/
ln -s /home/root/usr/share/debootstrap /usr/share/
ln -s /home/root/usr/bin/ar /usr/bin/
ln -s /home/root/usr/lib/aarch64-linux-gnu/libbfd-2.31.1-system.so /usr/lib/

Start the debootstrap:

debootstrap --arch arm64 buster /mnt/target http://ftp.debian.org/debian

Configuring the target:

#copy mtab (will be overwritten later at restart)
cp /etc/mtab /mnt/target/etc/mtab

#bind virtual file systems
mount -o bind /dev /mnt/target/dev
mount -o bind /proc /mnt/target/proc
mount -o bind /sys /mnt/target/sys

#enter target
chroot /mnt/target /bin/bash

#set up fstab
echo UUID=$(blkid /dev/mmcblk1p2 -o value|head -n1) / ext4 defaults,errors=remount-ro 0 1 > /etc/fstab

#put hostname in /etc/hosts
sed -i "1 a 127.0.0.1 $(cat /etc/hostname)" /etc/hosts

#install sudo
apt install sudo

#remove root login
passwd -d root
passwd -l root
#add new user
adduser debian

Don't forget:

addgroup debian sudo

Install more packages (not necessary):

tasksel --new-install

Exit the chroot:

exit

You're now ready to boot your new Debian installation. Put the card in MicroSD boot mode [0110110010] [0001101000]. And issue a reboot command:

reboot

If everything went smoothly you should now see your system start with Debian Buster. It's also possible to debootstrap Ubuntu or other Debian based systems.

Feel free to comment or ask questions.

I'll soon put up a guide how to build the linux kernel from source.

https://community.nxp.com/thread/499895 

With inspiration from: HOW-TO: Install Debian using debootstrap.

Labels (2)
10 Replies

2,144 Views
VincasD
Contributor III

Greate post! Is it possible to setup Debian with Wayland and to have hardware-accelerated OpenGL?

0 Kudos

3,245 Views
BiyongSUN
NXP Employee
NXP Employee

Enable docker, contains installation of arm/arm64 ubuntu rootfs. 

It is very similar to install arm/arm64 debian.


Docker On i.MX8MM With Ubuntu
https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/Docker-On-i-MX8MM-With-Ubuntu/ta-p/11152...


Docker On i.MX8QXP With Ubuntu
https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/Docker-On-i-MX8QXP-With-Ubuntu/ta-p/1105...


Docker On i.MX6UL With Ubuntu16.04
https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/Docker-On-i-MX6UL-With-Ubuntu16-04/ta-p/...

 

0 Kudos

3,861 Views
s_goetz
Contributor I

Hi Andreas,

I followed your steps and after switching to SD boot, the board does not do anything. I see no output on the debug console either. If I switch back to the eMMC boot option the loaded linux image boots successfully. I tried twice to create the sd card without error (besides that I had to unmount some auto-mounted partitions to make sfdisk execute without complaint). But no success so far. Do I have to adjust something else?

0 Kudos

3,861 Views
andreasgustafss
Contributor III

Are you sure that the partitions are created correctly on the sd-card?

0 Kudos

3,861 Views
s_goetz
Contributor I

Hi Andreas,

thank you for the reply. Yes I am. A FAT boot partiation and a ext4

rootFs partition are definitly create. I have been playing with

RaspberryPI-like device which use the same sd card setup

My normal approach for those devices is to format the sd card (low

level) and use Win32 DiskImager to write preconfigured image onto this

card. This worked always so far.

The approach pointed out in your description was new to me (deboostrap)

but the guide was explained good enough for me to step through it.

Although I must admit, that I do not understand every command :smileyhappy:

Meanwhile I have loaded a binary image of another device which is based

on the iMX8 mini and used my standard approach but even with that sd

card the dev board does nothing but lighting the PWR-LED near the USB

power connector. I double checked the boot switches already. So for the

moment I have no idea what else I could do.

For my current research it would be sufficient to have a Debian running

from eMMC. So is it possible to load such an image into eMMC via the

uuu.exe? I would like to install some apt packages from the regular

debian repository online.

Kind regards

Sebastian

Am 08.11.2019 um 10:28 schrieb andreasgustafsson:

>

NXP Community

<https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

>

Re: debootstrap Debian Buster on imx8mminievk

reply from Andreas Gustafsson

<https://community.nxp.com/people/andreasgustafsson?et=watches.email.thread>

in /i.MX Processors/ - View the full discussion

<https://community.nxp.com/message/1229993?commentID=1229993&et=watches.email.thread#comment-1229993>

>

0 Kudos

3,861 Views
pavel_
Contributor II

Nice HowTo!

However, wireless is missing when booting in Debian.

and

Tasksel exits with an error:

tasksel: apt-get failed (100)

0 Kudos

3,861 Views
pavel_
Contributor II

Well, found out that /lib/firmware, /lib/modules and lib/modules/4.1xxxx/extra folders were not copied to chroot.

1. Copy missing folders containing qca9377 firmware and the kernel module

2. Fix modprobe dependencies: depmod -A

Then wlan0 appears.

3,861 Views
andreasgustafss
Contributor III

I'm not using wlan so have not noticed this. Thank you for the fix!

0 Kudos

3,299 Views
andreasgustafss
Contributor III
cp -ra /lib/firmware /lib/modules /mnt/target/lib/

 

0 Kudos

3,861 Views
andreasgustafss
Contributor III

Moderator: Please put this up as a Blog post.

0 Kudos