153 | | [=#kernel] |
154 | | == Kernel Updates |
155 | | |
156 | | |
157 | | === Gateworks build kernel |
158 | | Gateworks periodically updates their pre-built IMX6 kernel release and it is easy to install on a running system: |
159 | | {{{#!bash |
160 | | wget http://dev.gateworks.com/ventana/images/gateworks-linux-4.20.7.tar.xz |
161 | | tar -C / -xvf gateworks-linux-4.20.7.tar.xz |
162 | | rm gateworks-linux-4.20.7.tar.xz |
163 | | }}} |
164 | | |
165 | | If you want to clean out old kernels no longer used, you can remove the directory of modules in /lib/modules/<kernel-version> |
166 | | |
167 | | |
168 | | === Ubuntu built kernel |
169 | | Ubuntu releases are based on a specific major kernel version. However over time the Ubuntu team releases new major kernel version updates for specific distro versions. An {{{apt-get install linux-image}}} will not change the kernel major version and you have to specifically install a new major version to switch to it. |
170 | | |
171 | | For example the latest kernel release available for Ubuntu 16.04 (Xenial) LTS at the time of this writing is 4.15 and can be installed with the following: |
172 | | {{{#!bash |
173 | | apt-get update |
174 | | apt-get install linux-image-4.15.0-34-generic |
175 | | # install mkimage |
176 | | apt-get install u-boot-tools |
177 | | # create u-boot image for kernel |
178 | | mkimage -A arm -O linux -T kernel -C none \ |
179 | | -a 0x10008000 -e 0x10008000 -n "linux" \ |
180 | | -d /boot/vmlinuz-4.15.0-34-generic /boot/uImage |
181 | | # install device-tree blobs |
182 | | cp /lib/firmware/4.15.0-34-generic/device-tree/imx6*-gw*.dtb /boot |
183 | | #blacklist imx rtc driver, Gateworks board uses GSC RTC, and does not use imx RTC |
184 | | echo "blacklist rtc_snvs" > /etc/modprobe.d/blacklist-rtc.conf |
185 | | # create u-boot image for initrd |
186 | | mkimage -A arm -O linux -T ramdisk \ |
187 | | -a 0x0 -e 0x0 -n "initrd" \ |
188 | | -d /boot/initrd.img-4.15.0-34-generic /boot/uramdisk |
189 | | }}} |
190 | | - use {{{apt-get search linux-image}}} to determine what Ubuntu kernel versions are available |
191 | | |
192 | | If you want to clean out old kernels no longer used you can use {{{apt list --instealled | grep linux}} to list installed packages and remove them (remove linux-headers, linux-image, linux-modules for example). For example if you want to remove the 4.15.0-42-generic packages: |
193 | | {{{#!bash |
194 | | apt purge linux-image-4.15.0-42-generic linux-modules-4.15.0-42-generic linux-headers-4.15.0-42 |
195 | | }}} |
196 | | - modify the above to remove the specific version(s) you want to remove |
197 | | |
198 | | |
199 | | == Root filesystem Sources == |
| 153 | |
| 154 | [=#rootfs] |
| 155 | == Root filesystem Sources |
406 | | * The default Ubuntu kernel supports booting a microSD/SATA rootfs directly, but lacks nand/ubifs/ubi/usb-storage support. If you need that (and have a large enough flash to boot from that) you will need to use the Ubuntu initrd: |
407 | | - add NAND/ubifs/usb-storage modules to the initrd: |
408 | | {{{#!bash |
409 | | cat << EOF >> /etc/initramfs-tools/modules |
410 | | # for NAND/ubi |
411 | | gpmi_nand |
412 | | ubi mtd=2 |
413 | | ubifs |
414 | | |
415 | | # for usb-storage |
416 | | ci_hdrc_imx |
417 | | usb-storage |
418 | | EOF |
419 | | update-initramfs -u # press 'Enter' when prompted |
420 | | # create u-boot image for initrd |
421 | | mkimage -A arm -O linux -T ramdisk \ |
422 | | -a 0x0 -e 0x0 -n "initrd" \ |
423 | | -d /boot/initrd.img-*-generic /boot/uramdisk |
424 | | }}} |
425 | | - create a bootscript that uses the Ubuntu initrd appropriately for NAND/usb-storage (utilizing the 'dtype' var that is set by the default ventana bootscript): |
426 | | {{{#!bash |
427 | | wget https://raw.githubusercontent.com/Gateworks/linux-imx6/gateworks_4.20.7/gwventana_bootscript -O /boot/6x_bootscript-ventana.txt |
428 | | mkimage -A arm -O linux -T script -n bootscript -d /boot/6x_bootscript-ventana.txt /boot/6x_bootscript-ventana |
429 | | }}} |
| 418 | }}} |
| 419 | |
| 420 | |
| 421 | |
| 422 | [=#kernel] |
| 423 | == Kernel |
| 424 | While a kernel is not specifically part of a root filesystem it usually resides on the root filesystem. There are several kernel sources you can choose from: |
| 425 | * Gateworks pre-built 4.20 kernel (**recommended**) |
| 426 | * Gateworks pre-built 3.14 kernel |
| 427 | * Ubuntu built kernel |
| 428 | * Kernel built by hand |
| 429 | |
| 430 | === Gateworks build kernel |
| 431 | Gateworks periodically updates their pre-built IMX6 kernel release and it is easy to install on a running system: |
| 432 | {{{#!bash |
| 433 | wget http://dev.gateworks.com/ventana/images/gateworks-linux-4.20.7.tar.xz |
| 434 | tar -C / -xvf gateworks-linux-4.20.7.tar.xz |
| 435 | rm gateworks-linux-4.20.7.tar.xz |
| 436 | }}} |
| 437 | |
| 438 | If you want to clean out old kernels no longer used, you can remove the directory of modules in /lib/modules/<kernel-version> |
| 439 | |
| 440 | Benefits of using the Gateworks kernel: |
| 441 | * contains all drivers 'static' required to boot off boot devices supported by Gateworks boards (ie NAND, SATA, MMC, USB Mass storage all static in kernel) removing requirement for an 'inital ramdisk' (initrd) that Ubuntu Built kernels require |
| 442 | * contains kernel patches that may not be in mainline yet |
| 443 | * tested and supported by Gateworks |
| 444 | |
| 445 | |
| 446 | === Ubuntu built kernel |
| 447 | Ubuntu releases are based on a specific major kernel version. However over time the Ubuntu team releases new major kernel version updates for specific distro versions. An {{{apt-get install linux-image}}} will not change the kernel major version and you have to specifically install a new major version to switch to it. |
| 448 | |
| 449 | It is recommended that you use the Gateworks kernel above for the following reasons: |
| 450 | * Ubuntu built kernels can require initrd for some boot devices complicating things (ie NAND and USB Mass Storage are kernel modules) |
| 451 | * Ubuntu built kernels may be configured in ways not appropriate for Gateworks boards (ie the DS1672 RTC driver is not static which complicates restoring system time on boot from the GSC provided RTC) |
| 452 | |
| 453 | If you wish to use an Ubuntu built kernel here are some notes but Gateworks can not support you if you run into issues as we don't maintain this kernel. |
| 454 | |
| 455 | To install a specific kernel image search for available packages and pick the version you want. For example if wanting the 4-15.0-34-generic kernel: |
| 456 | {{{#!bash |
| 457 | apt-get update |
| 458 | apt-get install linux-image-4.15.0-34-generic |
| 459 | # install mkimage |
| 460 | apt-get install u-boot-tools |
| 461 | # create u-boot image for kernel |
| 462 | mkimage -A arm -O linux -T kernel -C none \ |
| 463 | -a 0x10008000 -e 0x10008000 -n "linux" \ |
| 464 | -d /boot/vmlinuz-4.15.0-34-generic /boot/uImage |
| 465 | # install device-tree blobs |
| 466 | cp /lib/firmware/4.15.0-34-generic/device-tree/imx6*-gw*.dtb /boot |
| 467 | #blacklist imx rtc driver, Gateworks board uses GSC RTC, and does not use imx RTC |
| 468 | echo "blacklist rtc_snvs" > /etc/modprobe.d/blacklist-rtc.conf |
| 469 | # create u-boot image for initrd |
| 470 | mkimage -A arm -O linux -T ramdisk \ |
| 471 | -a 0x0 -e 0x0 -n "initrd" \ |
| 472 | -d /boot/initrd.img-4.15.0-34-generic /boot/uramdisk |
| 473 | }}} |
| 474 | - use {{{apt-get search linux-image}}} to determine what Ubuntu kernel versions are available |
| 475 | |
| 476 | If you want to clean out old kernels no longer used you can use {{{apt list --instealled | grep linux}} to list installed packages and remove them (remove linux-headers, linux-image, linux-modules for example). For example if you want to remove the 4.15.0-42-generic packages: |
| 477 | {{{#!bash |
| 478 | apt purge linux-image-4.15.0-42-generic linux-modules-4.15.0-42-generic linux-headers-4.15.0-42 |
| 479 | }}} |
| 480 | - modify the above to remove the specific version(s) you want to remove |
| 481 | |
| 482 | If booting from boot media that requires kernel modules you need to create an initrd: |
| 483 | * The default Ubuntu kernel supports booting a microSD/SATA rootfs directly, but lacks nand/ubifs/ubi/usb-storage support. If you need that (and have a large enough flash to boot from that) you will need to use the Ubuntu initrd: |
| 484 | - add NAND/ubifs/usb-storage modules to the initrd: |
| 485 | {{{#!bash |
| 486 | cat << EOF >> /etc/initramfs-tools/modules |
| 487 | # for NAND/ubi |
| 488 | gpmi_nand |
| 489 | ubi mtd=2 |
| 490 | ubifs |
| 491 | |
| 492 | # for usb-storage |
| 493 | ci_hdrc_imx |
| 494 | usb-storage |
| 495 | EOF |
| 496 | update-initramfs -u # press 'Enter' when prompted |
| 497 | # create u-boot image for initrd |
| 498 | mkimage -A arm -O linux -T ramdisk \ |
| 499 | -a 0x0 -e 0x0 -n "initrd" \ |
| 500 | -d /boot/initrd.img-*-generic /boot/uramdisk |
| 501 | }}} |
| 502 | |
| 503 | |
| 504 | You will need to create a boot script that sets kernel cmdline properly based on boot device and loads the Ubuntu initrd if needed. You can do this on the target board: |
| 505 | {{{#!bash |
| 506 | # The Gateworks bootscript is a good starting point |
| 507 | wget https://raw.githubusercontent.com/Gateworks/linux-imx6/gateworks_4.20.7/gwventana_bootscript -O /boot/6x_bootscript-ventana.txt |
| 508 | # re-enable ramdisk when its needed |
| 509 | sed -i 's/^setenv rd_addr$/#setenv rd_addr/' /boot/6x_bootscript-ventana.txt |
| 510 | mkimage -A arm -O linux -T script -n bootscript -d /boot/6x_bootscript-ventana.txt /boot/6x_bootscript-ventana |