1. John Lenz
  2. blog

Commits

John Lenz  committed 8d87736

Updates to arch draft

  • Participants
  • Parent commits 88be2fe
  • Branches default

Comments (0)

Files changed (2)

File drafts/2013-03-09-arch-latex-and-nexus-10.markdown

----
-title: Arch Linux and LaTeX on the Nexus 10
-author: John Lenz
-tags: android
-date: March 9, 2013
----
-
-# Arch
-
-Now that we have access to root, we can install Arch.  I mostly followed [this
-guide](http://lrvick.net/blog/arch_linux_terminals_in_android/), although there are some changes
-since newer versions of Android changed some things around.
-
-#### Terminal Environment
-
-First, we need a working terminal environment.  By far the best is a combination of
-
-* [Terminal Emulator](https://play.google.com/store/apps/details?id=jackpal.androidterm&hl=en)
-* [Busybox](https://play.google.com/store/apps/details?id=stericson.busybox&hl=en)
-* [Hacker's
-  Keyboard](https://play.google.com/store/apps/details?id=org.pocketworkstation.pckeyboard&hl=en)
-
-especially as they are all open source.  Install these three apps.  Also, I have a bluetooth
-keyboard which I use for heavy terminal work: the hacker's onscreen keyboard works well though and I
-actually used the hacker's onscreen keyboard for my entire install of Arch since I didn't have my
-bluetooth keyboard yet.
-
-Busybox will request superuser access and have some stuff about two ways of installing: simple and
-smart install.  How the busybox app works is by installing a single binary busybox and then creating
-a bunch of symlinks to it.  The single busybox binary contains implementations of many tools like
-"cp", "mv", "sed", "awk", "bzip2", "tar", etc.  Busybox knows which command you want to execute
-in two ways: you can either run something like
-
-~~~ {.bash}
-$ busybox tar <normal tar flags>
-~~~
-
-which launches the busybox executable with tar as the first argument.  Or you can create a symlink
-from "tar -> busybox" and then just run tar.  This will still run the busybox executable but busybox
-will check argv[0] and see "tar" in argv[0] and know that it should be acting like tar.  (Busybox
-combining all these tools into a single executable is how it saves so much space.)
-
-What the busybox android app does is switch to root, temporarily remount the / filesystem
-read-write, copy the busybox binary, create some symlinks, then remount read-only. The busybox
-"smart install" lets you control exactly which symlinks get created and if you want to actually
-replace any of the existing android tools with a symlink to busybox.  (For example, android already
-has an executable "cp" and with smart install you can decide to replace android's cp with a symlink
-to busybox.)  I did not use smart install and instead just pressed the install button.  This creates
-symlinks to all tools that don't already exist and does not replace any of Android's tools.  The
-built in android tools are pretty crappy and don't always support all the command line options
-(which is why you might want to replace them), but when that happens I just run "busybox <tool>
-<options>" instead of using it through the symlink.
-
-

File drafts/2013-03-10-arch-latex-and-nexus-10.markdown

View file
+---
+title: Arch Linux and LaTeX on the Nexus 10
+author: John Lenz
+tags: android
+date: March 10, 2013
+---
+
+I recently got a Nexus 10 and wanted to get Vim and LaTeX and related software on my tablet. Looking
+around at the various options, I decided to install Arch Linux in a chroot.  The first step was
+[rooting the tablet](2013-03-09-rooting-nexus-10.page).  Now that we have root access, we can
+install Arch.  This guide is written assuming knowledge of the linux command line. I mostly followed
+[this guide](http://lrvick.net/blog/arch_linux_terminals_in_android/), although there are some
+changes since newer versions of Android changed some things around.  This guide is for Android 4.2,
+future Android versions might require changes.
+
+# Terminal Environment
+
+First, we need a working terminal environment.  By far the best is a combination of
+
+* [Terminal Emulator](https://play.google.com/store/apps/details?id=jackpal.androidterm&hl=en)
+* [Busybox](https://play.google.com/store/apps/details?id=stericson.busybox&hl=en)
+* [Hacker's
+  Keyboard](https://play.google.com/store/apps/details?id=org.pocketworkstation.pckeyboard&hl=en)
+
+especially as they are all open source.  Install these three apps.  Also, I have a bluetooth
+keyboard which I use for heavy terminal work: the hacker's onscreen keyboard works well though and I
+actually used the hacker's onscreen keyboard for my entire install of Arch since I didn't have my
+bluetooth keyboard yet.  Another option is to install a ssh server on the tablet.
+
+Busybox will request superuser access and have some stuff about two ways of installing: simple and
+smart install.  How the busybox app works is by installing a single binary busybox and then creating
+a bunch of symlinks to it.  The single busybox binary contains implementations of many tools like
+"cp", "mv", "sed", "awk", "bzip2", "tar", etc.  Busybox knows which command you want to execute in
+two ways: you can either run something like "busybox tar <normal tar flags>" which launches the
+busybox executable with tar as the first argument.  Or you can create a symlink from "tar ->
+busybox" and then just run tar.  This will still run the busybox executable but busybox will check
+argv[0] and see "tar" in argv[0] and know that it should be acting like tar.  (Busybox combining all
+these tools into a single executable is how it saves so much space.)
+
+What the busybox android app does is switch to root, temporarily remount the /system filesystem
+read-write, copy the busybox binary, create some symlinks, then remount read-only. The busybox
+"smart install" lets you control exactly which symlinks get created and if you want to actually
+replace any of the existing android tools with a symlink to busybox.  (For example, android already
+has an executable "cp" and with smart install you can decide to replace android's cp with a symlink
+to busybox.)  I did not use smart install and instead just pressed the install button.  This creates
+symlinks to all tools that don't already exist and does not replace any of Android's tools.  The
+built in android tools are pretty crappy and don't always support all the command line options
+(which is why you might want to replace them), but when that happens I just run "busybox <tool>
+<options>" instead of using it through the symlink.
+
+# Background
+
+There are several android filesystems of interest and there were several changes in Android 4 for
+tablets (so if you look at other older guides, they will not match).  There are four filesystems
+that are mounted from partitions on internal storage.
+
+* /system: mounted read-only but the only filesystem mounted without the nosuid option
+* /cache: supposedly used as a cache for applications and Dalvik, although my tablet currently has
+  nothing in this entire filesystem besides the lost-and-found directory automatically created by
+  ext4.  Dalvik cache seems to be at /data/dalvik-cache.
+* /data: mounted rw, where applications are installed.  We will install Arch here.
+* /factory: small partition (19MiB) used to store some tablet info like wifi mac address, the keys
+  for verifying signed packages.  I guess this is separate from /system because /system gets
+  overwritten during an upgrade.
+
+Older versions of Android would have another partition mounted at /sdcard which I suppose at some
+point was an actual sdcard.  This folder is where applications store user data, and I guess for
+backwards compatibility modern versions of Android must still put something at this location. Just
+one of the many strange things about Android, having a folder called /sdcard backed by internal
+storage; on my phone the actual SD card is mounted somewhere else.  This even gets exposed in the
+GUI in the settings.  On the Nexus 10, to support multiple users, there is a FUSE mounted filesystem
+monuted at /storage with subdirectories for each user.  The FUSE filesystem is backed by the /data
+partition.  There is then a symlink from /sdcard to /storage/<id>/legacy.  The existence of the FUSE
+filesystem is weird, why not just symlink /sdcard to somewhere in the /data directory?
+
+The next thing to understand is how Android makes use of user ids.  Each application gets its own
+uid and is locked out of accessing anything in /data besides the one subdirectory allotted to it.