Skip to content

Instantly share code, notes, and snippets.

@Nokius
Last active June 29, 2023 18:40
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save Nokius/81cd46405b537931a472e0a55abb7ccd to your computer and use it in GitHub Desktop.
Save Nokius/81cd46405b537931a472e0a55abb7ccd to your computer and use it in GitHub Desktop.
ARCH LINUX WITH MAINLINE KERNEL FOR TOSHIBA AC100 [paz00 / dynabookaz]

ARCH LINUX WITH MAINLINE KERNEL FOR TOSHIBA AC100

all u need

  • 1-2 hours of your life
  • build envirment for the Kernel
  • device with Ubuntu and nvflash
  • AC100
  • mini-usb cabel
  • usb-stick >512MB

build the kernel

  1. setup the build enviorment

    • create the work directory:

      mkdir -p ~/ac100/output_files

  2. get the kernel source

    • get the sources:

      curl -LO https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.5.2.tar.xz

      cd linux-4.5.2

  3. build the kernel

    • genrate the config

      make tegra_defconfig ARCH=arm

    • adjust the config for:

      1. Kernel low-level debugging options

        in Kernel hacking

        to OFF

      2. USB Video Class

        in Device drivers --> Multimedia support --> Media USB Adapters

        to MODULE

      3. USB NETWORK Device [only if like to use anadapter] you will find the availbe Modules under

        in Device drivers --> Network device support --> USB Network Adapters

        to MODULE

      make menuconfig ARCH=arm

    • build zIMAGE, modules, dtb

      make zImage modules dtbs INSTALL_MOD_STRIP=1 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

    • build install-modules

      make modules_install INSTALL_MOD_PATH=../output_files INSTALL_MOD_STRIP=1 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

    • copy dtb and zImage to the output_files directory

      cp arch/arm/boot/dts/tegra20-paz00.dtb ../output_files

      cp arch/arm/boot/zImage ../output_files

  4. make output flashable

    • change into output_files directory

      cd ../output_files

    • create needed folders

      mkdir boot usr

    • move lib into usr [to avoid breaks of arch]

      mv lib usr

    • move zImage and dtb into boot

      mv zImage boot

      mv tegra20-paz00.dtb boot

    • create boot.cmd

      
        cat <<'EOF' > ~/ac100/output_files/boot/boot.cmd
        setenv bootargs 'root=/dev/mmcblk0p1 rootfstype=ext4 rootwait'
        ext2load mmc 0:1 0x1000000 /boot/zImage
        ext2load mmc 0:1 0x2000000 /boot/tegra20-paz00.dtb
        bootz 0x1000000 - 0x2000000
        EOF
        
    • create directory etc

      mkdir etc

    • add fstab

      
        cat <<'EOF' > ~/ac100/output_files/etc/fstab
        /dev/mmcblk0p1  /   ext4    rw,noatime,commit=30,barrier=1,data=ordered    0    0
        EOF
        
    • pack the files

      tar cf kernel.tar boot usr etc

  5. prepare pen drive

    • copy kernel.tar to pen drive

      cp ~/ac100/output_files/kernel.tar < mountpoint of the pen drive >

    • get Arch Linux filesystem for Tegra systems

      curl -o < mountpoint of the pen drive > http://archlinuxarm.org/os/ArchLinuxARM-trimslice-latest.tar.gz

  6. boot AC100 into recovery mode

    • press ctrl + esc + Power
  7. install on the flash host nvflash

    curl -O /tmp https://phablet-paz00.googlecode.com/files/nvflash_20110628-2_all.deb ; sudo dpkg -i nvflash_20110628-2_all.deb

  8. connect AC100 with your flash Host

  9. get and boot a minimal SOSUBOOT

    • on the flash Host

      curl -O /tmp https://dl.dropboxusercontent.com/u/40761340/Test/sos-uboot-r5-2013-11-10.bin nvflash --bl sos-uboot-r5-2013-11-10.bin --go

    • on the AC100

      ./switch-to-uboot

  10. prepare the AC100

    • create one new partions [maybe u like to backup the old once]

      
        parted /dev/mmcblk0 mklabel gpt
        parted /dev/mmcblk0 -s mkpart primary 7168s '100%'
        parted /dev/mmcblk0 -s name 1 UDB
        
    • create filesystem

      mkfs.ext4 /dev/mmcblk0p1

  11. Install Kernel and OS

    • create mount point

      mkdir /target mkdir /source

    • mount the emmc

      mount -t ext4 /dev/mmcblk0p1 /target

    • inserte the stick and mount it

      mount -t vfat /dev/sda1 /source

    • change into directory /target

      cd /target

    • extract the ARCH Linux filesystem

      gzip -dc /source/ArchLinuxARM-trimslice-latest.tar.gz | tar xp

    • erase /boot to add new builded kernel for the AC100

      rm -rf boot/*

    • unpack kernel.tar

      tar xf /source/kern.tar

    • change into the /boot directory

      cd /target/boot

    • make the kernel bootable

      mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "ubootscript" -d boot.cmd boot.scr

    • sync for safety

      sync

    • unmount the pen drive and the emmc

      cd /; umount /target; umount /source

enjoy Arch Linux and the mainline kernel on your AC100 \o/

Source:

AC100 wiki
dev.cutecolors.jp.net
UNicksDaemon
ddevnet.net

@ScrapJack
Copy link

Hi, thanks for the reply. I still have a couple of question for you.

manually edit kernel/exit.c reverting changes before the patch

Does this mean that you replace the file with an older version from "working" kernels?
Also did you change anything else in the config when building the kernel other than the three things mentioned by Nokius?

Personally I'm still at kernel 5.11.2, I've stopped updating it since it's a long process and I have no issues other than the poweroff. To be fair though I just use the shell. Thanks again.

@martin-ac100
Copy link

Does this mean that you replace the file with an older version from "working" kernels?

NO, I don't think it would work. I just add lines, that were removed (-) and remove line that were added by the patch (+)

--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -577,10 +577,6 @@ static struct task_struct *find_child_re
        }

        write_unlock_irq(&tasklist_lock);
-       if (unlikely(pid_ns == &init_pid_ns)) {
-               panic("Attempted to kill init! exitcode=0x%08x\n",
-                       father->signal->group_exit_code ?: father->exit_code);
-       }

        list_for_each_entry_safe(p, n, dead, ptrace_entry) {
                list_del_init(&p->ptrace_entry);
@@ -823,6 +819,14 @@ void __noreturn do_exit(long code)
        acct_update_integrals(tsk);
        group_dead = atomic_dec_and_test(&tsk->signal->live);
        if (group_dead) {
+               /*
+                * If the last thread of global init has exited, panic
+                * immediately to get a useable coredump.
+                */
+               if (unlikely(is_global_init(tsk)))
+                       panic("Attempted to kill init! exitcode=0x%08x\n",
+                               tsk->signal->group_exit_code ?: (int)code);
+
 #ifdef CONFIG_POSIX_TIMERS
                hrtimer_cancel(&tsk->signal->real_timer);
                exit_itimers(tsk->signal);

Also did you change anything else in the config when building the kernel other than the three things mentioned by Nokius?

You can download my config file here
https://drive.google.com/file/d/1acxVstwBeb6yaodeEKEXbMPwLHmASQTf/view?usp=sharing

and my kernel here
https://drive.google.com/file/d/1gCJOGRRA-zVC5KFSZoA5BjUqAMR_nI29/view?usp=sharing

@ScrapJack
Copy link

@martin-ac100 Thanks a lot! And good job on spotting the issue too.

@ibisal
Copy link

ibisal commented Dec 19, 2021

@martin-ac100 seems like your compilation use IPv6 only. How can I change it for IPv4 only (disable IPv6/enable IPv4)?

@franzy3kk
Copy link

Good morning,
After some time, I tried to update the system.
I have locked the linux-armv7, libdrm and mesa packages in the pacman.conf file.....but every time I run Syu, the update always results in: kernel panic.
Am I forgetting some steps or? Does anyone have a stable image to share?

Greetings in advantage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment