Tiny Core Linux
Tiny Core Base => TCB Q&A Forum => Topic started by: Twist on January 01, 2020, 06:59:25 PM
-
I feel like I'm close but can't quite get it working: corepure64 on a 13" MacBook Air (mid 2013)
What I'd like: a bootable usb device with TC on it. Hold 'alt' during boot to select USB with TC instead of (default) OS X on built in HDD.
What I'd also like: leave the internal hdd completely alone (i.e. not change the EFI partition on there).
My progress so far:
- I managed to install rEFInd on its own on a usb stick. Fine, as a proof of concept that is recognised when holding alt during boot and presents boot options.
- Then got the core-10.1.iso, converted that to .img, and with etcher wrote it to another usb stick.
- rEFInd stick presents that as something with a bootable kernel on it. Needed to add initrd=/boot/corepure64.gz in the rEFInd boot screen and then it boots
- Downloaded tinycorepure64-10.1iso and use that after boot with the fromISOfile command, so I could do startx
- With some information from here (http://forum.tinycorelinux.net/index.php?topic=21096.0) got the wifi up
- downloaded tc-install-GUI and tried to do a frugal install on (yet another) usb drive. It completes fine, but it doesn't appear In rEFInd.
- Tried an install to an existing partition (no reformat) on the 2nd usb stick, completes fine, but not recognised by rEFInd.
I lack some understanding of EFI, bootloaders, and the way they can work to get TC bootable on a USB drive in this MacBook Air. Seems like the tc-install program is geared towards BIOS based PCs, not EFI? I feel I'm close, but also missing something to nail this.
Help appreciated!
Note: I'm more familiar with piCore ip to now
-
Hi Twist
I successively used this writeup to make a boot-able EFI USB for an ASUS tablet:
http://forum.tinycorelinux.net/index.php/topic,22848.msg143377.html#msg143377
-
Hi Rich,
Thanks, unfortunately no luck yet.
I'm unable to run gparted: it crashes almost immediately after startup. The output is:
GParted 1.0.0
configuration --enable-online-resize
libparted 3.2.122-46cd
** (gpartedbin:10050): WARNING **: 11:17:41.532: AT-SPI: Could not obtain desktop path or name
** (gpartedbin:10050): WARNING **: 11:17:41.535: atk-bridge: GetRegisteredEvents returned message with unknown signature
** (gpartedbin:10050): WARNING **: 11:17:41.535: atk-bridge: get_device_events_reply: unknown signature
** (gpartedbin:10050): WARNING **: 11:17:41.535: atk-bridge: get_device_events_reply: unknown signature
(gpartedbin:10050): Gdk-ERROR **: 11:17:42.736: The program 'gpartedbin' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadValue (integer parameter out of range for operation)'.
(Details: serial 2422 error_code 2 request_code 139 (RENDER) minor_code 34)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the GDK_SYNCHRONIZE environment
variable to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
Trace/breakpoint trap
So I used parted instead to set up the usb stick with a 200MB fat32 partition and the remainder as ext2. Used mkfs.fat -F 32 on /dev/sde1 and mkfs.ext2 on /dev/sde2. Able to complete all instructions.
Alas, when booting with 'alt' key pressed, only the internal hdd is show as a boot option. The new tc stick doesn't show up.
When I insert my rEFInd-only usb stick, I can boot into the rEFInd menu. However, also now, the fresh tc-stick doesn't show as a boot option.
-
The gparted error is possibly due to using Xvesa/Xfbdev rather than Xorg-7.7
-
Hi Twist
... So I used parted instead to set up the usb stick with a 200MB fat32 partition and the remainder as ext2. ...
Did you create a new partition table? It needs to be GPT not MSDOS.
-
The gparted error is possibly due to using Xvesa/Xfbdev rather than Xorg-7.7
The crash of gparted is perhaps better for a different topic? Surely anything that gparted does can be done with parted? Or is that assumptions wrong?
Hi Twist
... So I used parted instead to set up the usb stick with a 200MB fat32 partition and the remainder as ext2. ...
Did you create a new partition table? It needs to be GPT not MSDOS.
Yes I completely wiped it and put a new GPT table on it.
I'm confused why there is still a need for GRUB(2) to be involved and installed. I thought the whole idea was that a modern linux kernel (with efi support) has a built on boot loader. Such that the firmware boot manager in the macbook just presents an option to boot the linux kernel.
Q: is the kernel in tinycorepure64 actually efi bootable?
Should I set a boot flag on the first /boot partition of the usb stick with TC?
-
Hi Twist
... Surely anything that gparted does can be done with parted? Or is that assumptions wrong? ...
I suspect that is true. The GUI makes the job easier and less error prone in my opinion.
Should I set a boot flag on the first /boot partition of the usb stick with TC?
I don't think it should be necessary, but I haven't dealt with Apple devices. This is what parted -l returned for a working thumb drive:
Model: UFD USB Flash Drive (scsi)
Disk /dev/sdg: 514MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 37.7MB 36.7MB fat32 Boot msftdata
2 37.7MB 513MB 475MB ext2 Linux
You probably need to turn off secure boot since none of the executables are signed by Microsoft.
-
Bit of progress and further insight:
When I
- grab a tinycore kernel (vmlinuz64)
- rename it bootx64.efi
- place it on an EFI partition from a GPT formatted USB stick ...
- ... inside EFI/boot/
... then it is recognised by the MacBooks built-in efi bootmanager (hold alt during boot).
So, the tinycore kernel does have EFI-stub support, and can be booted without needing another bootmanager.
The kernel boots, but then fails as the command line options for the initrd hasn't been passed to it.
Can I use efbootmgr to pass the arguments? Perhaps (haven't tried yet), but that limits the usb stick to the particular Mac where the NVRAM has been update with the efibootmgr tools. (Or at least that is what I understand efibootmgr to do)
So, perhaps I should go for rEFInd, as an intermediary bootmanager and setup its config file so it passes the correct command line options to the kernel.
Thoughts?
-
My 2012-ish mac mini boots from a standard efi install - I used bootcamp and made an additional partition on the ssd for tinycore.
Although rEFInd works, there's no need to use it - holding down the apply key during boot brings up an efi menu with tinycore being one of the options.
-
https://github.com/KNNSpeed/UEFI-Stub-Loader seems to be what you want, a simpler efi bootloader than grub.
-
My 2012-ish mac mini boots from a standard efi install - I used bootcamp and made an additional partition on the ssd for tinycore.
Although rEFInd works, there's no need to use it - holding down the apply key during boot brings up an efi menu with tinycore being one of the options.
So how do you pass command options to the kernel in that setup?
https://github.com/KNNSpeed/UEFI-Stub-Loader seems to be what you want, a simpler efi bootloader than grub.
Yes spot on, that sounds promising. It keeps the macbook completely 'standard', with everything needed to run tinycore on a USB drive.
Thanks all. I'll report back here.
-
You pass commands using grub.cfg in the usual way.
-
Nearly there!
The KNNSpeed/UEFI-Stub-Loader as suggested by curaga is working. When holding down alt (option) at startup I can select the USB disk. The UEFI-stub-loader then grabs the command line options form a text file and passes over to tiny core's vmlinuz. The initrd is picked up correctly.
Tiny core boots, but seems to ignore my tce= and opt= directive. I've added a waitusb option as well, and surely all 15 seconds pass by, but no luck. Which seems to suggest the waitusb is not effective here?
Note that dmesg at the end says:
EXT4-fs (sdb2): mounting ext2 file system using the ext4 subsystem
EXT4-fs (sdb2): mounted filesystem without journal. Opts: (null)
But mount shows nothing of a mounted sdb2 at all.
Here's the contents of the Kernelcmd.txt
\EFI\tc10-x86_64\vmlinuz64
initrd=\EFI\tc10-x86_64\corepure64.gz waitusb=15:UUID="b88c641f-ad15-4d9f-9c97-3a3b2e752d0e" tce=UUID="19C897BC-1573-4758-A315-5B5E304FDA2A"/tce opt=UUID="19C897BC-1573-4758-A315-5B5E304FDA2A" blacklist=bcma,ssb,bc43
This is the output of blkid which I ran inside TC
/dev/sdb: PTUUID="b88c641f-ad15-4d9f-9c97-3a3b2e752d0e" PTTYPE="gpt"
/dev/sdb1: LABEL="EFI" UUID="67E3-17ED" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="34823828-e6ad-4f98-8ff8-673f28f0f701"
/dev/sdb2: UUID="5403a65f-6c9e-4d1a-a037-da2ee96d5287" TYPE="ext2" PARTLABEL="ext" PARTUUID="19c897bc-1573-4758-a315-5b5e304fda2a"
And for completeness here's dmesg output attached
[EDIT]: Renamed attached file. Rich
-
Hi Twist
Are UUIDs case sensitive? Your blkid command shows:
PARTUUID="19c897bc-1573-4758-a315-5b5e304fda2a"
but you command file show this:
tce=UUID="19C897BC-1573-4758-A315-5B5E304FDA2A"/tce opt=UUID="19C897BC-1573-4758-A315-5B5E304FDA2A"
In the future, please use a .txt extension for files containing text.
-
Thanks Rich. .txt it is in the future.
I figured it out... I was using the PARTUUID instead of the (filesystem?)UUID. Not sure the waitusb does anything useful in my case, so will experiment with that.
At last! A bootable tinycore USB drive that's completely self contained (i.e. does not rely on anything specifically set up on the hardware it runs on, just press alt(option) at boot)
This particular macbook runs some (hydro)navigation software and the licences for the charts are reliant on some sort of system fingerprint. I don't want to risk messing that up. Hence my quest to have it all contained on a USB drive.
I will do this once more from scratch and document the steps for future reference.
-
FWIW and future reference (and thanks to the contributions in this thread and elsewhere on the forum):
Steps to create a self contained tinycore linux USB drive for a Mac using just OS X as a starting point.
Why like this? Because it gets you going from scratch from a plain OS X machine. I.e. the setup steps do not depend on having linux or tinycore up already. You don't need a CD/DVD drive, and you don't need a USB-Ethernet dongle.
Worked for me with MacBook Air 13 (mi 2013) running 10.13.6 and TinyCorePure64-10.1 (Adapted from here (http://forum.tinycorelinux.net/index.php/topic,22848.msg143377.html#msg143377))
1) wipe and prepare USB stick using terminal (Warning: change disk2 appropriately or wipe something you didn't intend to):
sudo diskutil partitionDisk disk2 2 GPT FAT32 EFI 64Mi Free\ Space Free R
2) On USB create a folder called EFI and one called installTC. Within the EFI folder create two folders named: boot and linux
3) download the TinyCorePure64-10.1.iso and mount it (double click)
4) from the [mounted ISO]/boot folder copy vmlinuz and corepure64.gz to the [usb]/EFI/linux folder
5) also copy the isofile itself to [usb]/installTC/
6) download STUBLOAD_release_x64.EFI and Kernelcmd_sample.txt from https://github.com/KNNSpeed/UEFI-Stub-Loader (https://github.com/KNNSpeed/UEFI-Stub-Loader)
7) place both in [usb]/EFI/boot
8 ) rename STUBLOAD_release_x64.EFI to BOOTx64.EFI and rename Kernelcmd_sample.txt to Kernelcmd.txt
9) edit Kernelcmd.txt with TextEdit. Make sure it is plain text, and saved with UTF16 encoding. You can also check the encoding from the terminal with `file Kernelcmd.txt`, check for UTF-16.
Contents of Kernelcmd.txt:
\EFI\linux\vmlinuz64
initrd=\EFI\linux\corepure64.gz blacklist=bcma,ssb,bc43
^ Make sure there's an empty 3rd line
line 1: path relative to the efi partition root to the kernel file
line 2: command line options to pass to the kernel (no start/end quote)
line 3: empty line. needed to signal end of command line options
Note: those last lines are not strictly needed. Also note that the blacklist=bcma,ssb,bc43 is needed on my macbook to get the wireless working later on. You may not need this.
10) from the repo download the tcz's needed to get wifi up (get the .tcz, tcz.md5.txt and .dep files for):
wl-modules-4.19.10-tinycore64 acl attr dbus elogind expat2 libcap libiw libnl ncursesw openssl readline wifi wireless_tools wireless-4.9.10-tinycore64 wpa_supplicant-dbus
11) ... and place them in [usb]/installTC
12) The USB is now prepared. Boot into tinycore (hold alt and choose EFI USB icon)
13) get wifi (well, internet access really)
mount /dev/sdb1
tce-load -i /mnt/sdb1/installTC/wl-modules-4.19.10-tinycore64
tce-load -i /mnt/sdb1/installTC/wifi
sudo wifi.sh
14) let's get gdisk:
tce-load -iw gdisk
and then use gdisk to add second partition (default start and end will use remainder or disk)
15) use gdsik to label both parttions
16) reboot into tinycore (updated partition table)
17) mkfs.ext2 on new parttion
18) reboot once more (so /etc/fstab is up to date)
19) copy the needed files
mount /dev/sdb1
mount /dev/sdb2
mkdir /tmp/iso
sudo mount -o loop /mnt/sdb1/installTC/TinyCorePure64-10.1.iso /tmp/iso
sudo cp -R /tmp/iso/cde to /mnt/sdb2/tce
sudo rm /mnt/sdb2/copy2fs.flg
20) Capture the relevant UUIDs and Labels:
blkid /dev/sdb* > /mnt/sdb1/blkid.txt
21) reboot into OSX
22) open blkid.txt from the EFI partition
/dev/sdb: PTUUID="9976057f-21bc-4818-88ea-4e8099cc8ed3" PTTYPE="gpt"
/dev/sdb1: LABEL="EFI" UUID="DC62-1C1C" TYPE="vfat" PARTLABEL="EFI" PARTUUID="02579055-5922-44e4-bab5-a6572541749e"
/dev/sdb2: UUID="33f90c68-592b-479f-a5e8-021a3bf132c7" TYPE="ext2" PARTLABEL="tc" PARTUUID="7f3a8150-5669-4423-b9dc-8df656011acd"
23) edit Kernelcmd.txt and adjust UUIDs as needed
\EFI\linux\vmlinuz64
initrd=\EFI\linux\corepure64.gz blacklist=bcma,ssb,bc43 waitusb=15:UUID=33f90c68-592b-479f-a5e8-021a3bf132c7 tce=UUID=33f90c68-592b-479f-a5e8-021a3bf132c7/tce opt=33f90c68-592b-479f-a5e8-021a3bf132c7
^ Make sure there's an empty 3rd line
That's it. You now have TCPure64 on a EFI bootable USB stick with working wifi. It should also boot straight into X on the next reboot.
8)