Difference between revisions of "RSB-3720 Ubunut creation by Yocto30 kernel"

From ESS-WIKI
Jump to: navigation, search
 
(36 intermediate revisions by the same user not shown)
Line 1: Line 1:
  
== '''Prepare Image''' ==
+
{{DISPLAYTITLE:RSB-3720 Ubuntu creation by Yocto30 kernel}}
  
*Build Yocto Linux image with your expected version (e.g. A0386)
+
[[File:RSB-3720 Ubunut creation by Yocto30 kernel top figuare.png|600x500px|RSB-3720 Ubunut creation by Yocto30 kernel top figuare.png]]
  
            You can follow this [http://ess-wiki.advantech.com.tw/view/IoTGateway/BSP/Linux/iMX8/Yocto_LBVA_User_Guide SOP] to build your Yocto image.
+
----
  
*Modify kernel to "[https://github.com/ADVANTECH-Corp/linux-imx/commits/adv_5.4.70_2.3.0 <u>Add&nbsp;commit to support the Ubuntu desktop version</u>]"
+
&nbsp;
 +
 
 +
== <span style="color:#3498db;">'''Prepare Image'''</span> ==
 +
 
 +
*<span style="font-size:medium;">Build Yocto Linux image with your expected version (e.g. A0386)</span>
 +
 
 +
:<span style="font-size:medium;">You can follow this [http://ess-wiki.advantech.com.tw/view/IoTGateway/BSP/Linux/iMX8/Yocto_LBVA_User_Guide SOP] to build your Yocto image.</span>  
  
[[File:Add commit to support ubuntu.png|RTENOTITLE]]
+
*<span style="font-size:medium;">Modify kernel to "[https://github.com/ADVANTECH-Corp/linux-imx/commits/adv_5.4.70_2.3.0 <u>Add&nbsp;commit to support the Ubuntu desktop version</u>]"</span>
  
*&nbsp;Prepare Ubuntu image (e.g. A0362)
+
:<span style="font-size:medium;">[[File:Add commit to support ubuntu.png|RTENOTITLE]]</span>
  
[[File:RSB-3720 Prepare ubuntu image.png|RTENOTITLE]]
+
*<span style="font-size:medium;">&nbsp;Prepare Ubuntu image (e.g. A0362)</span>
  
 +
:<span style="font-size:medium;">[[File:RSB-3720 Prepare ubuntu image.png|RTENOTITLE]]</span>
  
 +
== <span style="color:#3498db;">'''Mount image'''</span> ==
  
 +
*<span style="font-size:medium;">You can find Yocto image in'''<span style="color:#9b59b6;">${WORKSPACE}</span>'''/build/tmp/deplay/image/<span style="color:#9b59b6;">'''${MC}'''</span>, and copy to your&nbsp;'''<span style="color:#9b59b6;">${WORKSPACE}</span>'''.</span>
  
 +
:<span style="font-size:large;"><code>$ sudo cp –a <span style="color:#9b59b6;">'''${rootfs.wic_IMAGE}'''</span>.bz2 <span style="color:#9b59b6;">'''${WORKSPACE}'''</span>.</code></span>
  
 +
:[[File:RSB-3720 copy Yocto30 image to workspace.png|RTENOTITLE]]
  
 +
*<span style="font-size:medium;">Unpack rootfs.wic</span>
  
== '''Mount image''' ==
+
:<span style="font-size:large;"><code>$sudo bzip2 -d <span style="color:#9b59b6;">'''${rootfs.wic_IMAGE}.'''</span>bz2</code></span>
  
*You can find Yocto image in'''<span style="color:#9b59b6;">${WORKSPACE}</span>'''/build/tmp/deplay/image/<span style="color:#9b59b6;">'''${MC}'''</span>, and copy to your&nbsp;'''<span style="color:#9b59b6;">${WORKSPACE}</span>'''.  
+
:[[File:RSB-3720 unpack yocto30 image.png|RTENOTITLE]]
  
:<code>$ sudo cp –a imx-image-<span style="color:#9b59b6;">'''${MC}'''</span>-20230816082527.rootfs.wic.bz2 <span style="color:#9b59b6;">'''${WORKSPACE}'''</span>.</code>  
+
*<span style="font-size:medium;">Create folders to mount</span>  
  
:<code><span style="color:#9b59b6;">'''<span style="color:#9b59b6;">[[File:RSB-3720 copy Yocto30 image to workspace.png|RTENOTITLE]]</span>'''</span></code>  
+
:<span style="font-size:large;"><code>$mkdir ubuntu yocto</code></span>  
  
*'''Unpack rootfs.wic'''
+
:<span style="font-size:large;"><code>$mkdir ubuntu/rootfs yocto/rootfs</code></span>
  
:<code>$sudo bzip2 -d imx-image-full-<span style="color:#9b59b6;">'''${MC}'''</span>-20230814102331.rootfs.wic.bz2</code>
+
:[[File:RSB-3720 Ubunut creation by Yocto30 kernel Create folders to mount.png|RTENOTITLE]]
  
:<code><span style="color:#9b59b6;">'''[[File:RSB-3720 unpack yocto30 image.png|RTENOTITLE]]'''</span></code>  
+
*<span style="font-size:medium;">Mount Yocto image and Ubuntu image Partition2</span>  
  
*'''Create folders to mount'''  
+
:<span style="font-size:large;"><code>$sudo losetup --show -f -P <span style="color:#9b59b6;">'''${rootfs.wic_IMAGE}'''</span></code></span>
  
:<code>$mkdir ubuntu yocto</code>  
+
:<span style="font-size:large;"><span style="font-size:large;"><code>$sudo mount '''<span style="color:#9b59b6;">${virtual_DEVICE}</span>'''p2 yocto/rootfs/</code></span></span>  
  
:<code>$mkdir ubuntu/rootfs yocto/rootfs</code>  
+
:<span style="font-size:large;"><span style="font-size:large;"><span style="font-size:large;"><code>$sudo losetup --show -f -P 3720A1AIM30UIVA0362_iMX8MP_4G_2021-11-29.img</code></span></span></span>
 +
 
 +
:<span style="font-size:large;"><span style="font-size:large;"><span style="font-size:large;"><span style="font-size:large;"><code>$sudo mount</code></span></span><code>'''<span style="color:#9b59b6;">${virtual_DEVICE}</span>'''</code><span style="font-size:large;"><span style="font-size:large;"><code>p2 ubuntu/rootfs/</code></span></span></span></span>
 +
:&nbsp;
 +
:<span style="font-size:large;"><span style="font-size:large;">[[File:RSB-3720 Ubunut creation by Yocto30 kernel Mount Yocto image and Ubuntu image Partition2.png|RTENOTITLE]]</span></span>  
  
 
&nbsp;
 
&nbsp;
 +
 +
== <span style="color:#3498db;">'''Change rootfs'''</span> ==
 +
 +
*<span style="font-size:medium;">Copy Yocto module to&nbsp;</span>'''<span style="font-size:medium;"><span style="color:#9b59b6;">${WORKSPACE}</span></span>'''<span style="font-size:medium;">, then you can find Yocto module in rootfs/lib</span>
 +
 +
:<span style="font-size:large;"><code>$ sudo cp -a yocto/rootfs/lib/modules/ /home/adv/</code></span>
 +
 +
:[[File:RSB-3720 Ubunut creation by Yocto30 kernel copy module.png|RTENOTITLE]]
 +
 +
*<span style="font-size:medium;">Delete under Yocto rootfs all files, and replace with&nbsp; Ubuntu rootfs</span>
 +
 +
:<span style="font-size:large;"><code>$ sudo rm -rf yocto/rootfs/</code></span>
 +
 +
:<span style="font-size:large;"><code>$ sudo cd ubuntu/rootfs/</code></span>
 +
 +
:<span style="font-size:large;"><code>$ sudo cp -a bin boot dev etc home lib media mnt opt proc root run sbin srv swapfile sys tmp usr var ~/yocto/rootfs/</code></span>
 +
 +
:[[File:RSB-3720 Ubunut creation by Yocto30 kernel Delete under Yocto rootfs all files, and replace with Ubuntu rootfs.png|RTENOTITLE]]
 +
 +
*<span style="font-size:medium;">Replace&nbsp;with Yocto module</span>
 +
 +
:<span style="font-size:large;"><code>$ cd ~/yocto/roosfs/lib</code></span>
 +
 +
:<span style="font-size:large;"><code>$ sudo rm -rf modules/</code></span>
 +
 +
:<span style="font-size:large;"><code>$ sudo cp -a ~/modules ~/yocto/rootfs/lib/</code></span>
 +
 +
:<span style="font-size:large;">[[File:RSB-3720 Ubunut creation by Yocto30 kernel change module.png|RTENOTITLE]]</span>
 +
 +
 +
== <span style="color:#3498db;">'''Analyze dependency file'''</span> ==
 +
 +
*<font size="3">Enter target image root directory</font>
 +
 +
:<span style="font-size:large;"><code>$ sudo chroot rootfs/</code></span>
 +
 +
:[[File:RSB-3720 Ubunut creation by Yocto30 kernel Enter target image root directory.png|RTENOTITLE]]
 +
 +
*<font size="3">Analyze&nbsp;file replaced by module dependencies</font>
 +
 +
:<span style="font-size:large;"><code>$ depmod -a 5.4.70-2.3.0/</code></span>
 +
 +
:[[File:RSB-3720 Ubunut creation by Yocto30 kernel Analyze file replaced by module dependencies.png|RTENOTITLE]]
 +
 +
 +
== <span style="color:#3498db;">'''Umount target image'''</span> ==
 +
 +
*<font size="3">Umount rootfs</font>
 +
 +
:<span style="font-size:large;"><code>$ exit</code></span>
 +
 +
:<span style="font-size:large;"><code>$ sudo umount ~/yocto/rootfs/</code></span>
 +
 +
:<span style="font-size:large;"><code>$ sudo umount ~/ubuntu/rootfs/</code></span>
 +
 +
:[[File:RSB-3720 Ubunut creation by Yocto30 kernel Umount target image.png|RTENOTITLE]]
 +
 +
*<span style="font-size:medium;">Remove virtual device</span>
 +
 +
:<span style="font-size:large;"><code>$ sudo losetup -d '''<span style="color:#9b59b6;">${virtual_DEVICE}</span>'''</code></span>
 +
 +
:<span style="font-size:large;"><code>$ sudo losetup -d '''<span style="color:#9b59b6;">${virtual_DEVICE}</span>'''</code></span>
 +
 +
:[[File:RSB-3720 Ubunut creation by Yocto30 kernel Remove virtual device.png|RTENOTITLE]]
 +
 +
== <span style="color:#3498db;">'''Flash target image'''</span> ==
 +
 +
*<span style="font-size:medium;">Creating boot-up on-board flash from built sdcard image</span>
 +
 +
:<span style="font-size:large;"><code>$ sudo dd if=<span style="color:#9b59b6;">'''${rootfs.wic_IMAGE}'''</span> of='''<span style="color:#9b59b6;">${SD_DEVICE}</span>''' bs=1M conv=fsync</code></span>
 +
 +
:[[File:RSB-3720 Ubunut creation by Yocto30 kernel Flash target image.png|RTENOTITLE]]
 +
 +
&nbsp;
 +
 +
== '''Complete''' ==
 +
 +
*<span style="font-size:medium;">Pleace insert SDcard to target machine and booting, You can see Ubuntu Desktop on the monitor.</span>
 +
 +
:[[File:RSB-3720 Ubunut creation by Yocto30 kernel Complete.jpg|500x500px|RTENOTITLE]]

Latest revision as of 09:58, 18 August 2023


RSB-3720 Ubunut creation by Yocto30 kernel top figuare.png


 

Prepare Image

  • Build Yocto Linux image with your expected version (e.g. A0386)
You can follow this SOP to build your Yocto image.
RTENOTITLE
  •  Prepare Ubuntu image (e.g. A0362)
RTENOTITLE

Mount image

  • You can find Yocto image in${WORKSPACE}/build/tmp/deplay/image/${MC}, and copy to your ${WORKSPACE}.
$ sudo cp –a ${rootfs.wic_IMAGE}.bz2 ${WORKSPACE}.
RTENOTITLE
  • Unpack rootfs.wic
$sudo bzip2 -d ${rootfs.wic_IMAGE}.bz2
RTENOTITLE
  • Create folders to mount
$mkdir ubuntu yocto
$mkdir ubuntu/rootfs yocto/rootfs
RTENOTITLE
  • Mount Yocto image and Ubuntu image Partition2
$sudo losetup --show -f -P ${rootfs.wic_IMAGE}
$sudo mount ${virtual_DEVICE}p2 yocto/rootfs/
$sudo losetup --show -f -P 3720A1AIM30UIVA0362_iMX8MP_4G_2021-11-29.img
$sudo mount${virtual_DEVICE}p2 ubuntu/rootfs/
 
RTENOTITLE

 

Change rootfs

  • Copy Yocto module to ${WORKSPACE}, then you can find Yocto module in rootfs/lib
$ sudo cp -a yocto/rootfs/lib/modules/ /home/adv/
RTENOTITLE
  • Delete under Yocto rootfs all files, and replace with  Ubuntu rootfs
$ sudo rm -rf yocto/rootfs/
$ sudo cd ubuntu/rootfs/
$ sudo cp -a bin boot dev etc home lib media mnt opt proc root run sbin srv swapfile sys tmp usr var ~/yocto/rootfs/
RTENOTITLE
  • Replace with Yocto module
$ cd ~/yocto/roosfs/lib
$ sudo rm -rf modules/
$ sudo cp -a ~/modules ~/yocto/rootfs/lib/
RTENOTITLE


Analyze dependency file

  • Enter target image root directory
$ sudo chroot rootfs/
RTENOTITLE
  • Analyze file replaced by module dependencies
$ depmod -a 5.4.70-2.3.0/
RTENOTITLE


Umount target image

  • Umount rootfs
$ exit
$ sudo umount ~/yocto/rootfs/
$ sudo umount ~/ubuntu/rootfs/
RTENOTITLE
  • Remove virtual device
$ sudo losetup -d ${virtual_DEVICE}
$ sudo losetup -d ${virtual_DEVICE}
RTENOTITLE

Flash target image

  • Creating boot-up on-board flash from built sdcard image
$ sudo dd if=${rootfs.wic_IMAGE} of=${SD_DEVICE} bs=1M conv=fsync
RTENOTITLE

 

Complete

  • Pleace insert SDcard to target machine and booting, You can see Ubuntu Desktop on the monitor.
RTENOTITLE