LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 07-28-2018, 03:11 PM   #1
RoLoR
Member
 
Registered: Feb 2018
Posts: 60

Rep: Reputation: Disabled
LFS build on Apple native (Mac OS)


i know it's an old machine and there are some trouble to overcome but should it be possible to try and invest time into make machine below (Apple Intel MacPro early 2008) making running lfs native? Before it had troubles with Ubuntu and refit ending up with only booting OS-X. I am sure i can make the version_check complete for this machine, any (sensible) input is welcome

RoLoR
Quote:
Model: MacPro3,1, BootROM MP31.006C.B05, 8 processors, Quad-Core Intel Xeon, 2,8 GHz, 2 GB, SMC 1.25f4
Graphics: NVIDIA GeForce GT 620, NVIDIA GeForce GT 620, PCIe, 1024 MB
Graphics: ATI Radeon HD 2600 XT, ATI Radeon HD 2600, PCIe, 256 MB
Memory Module: DIMM Riser B/DIMM 1, 1 GB, DDR2 FB-DIMM, 800 MHz, 0x802C, 0x3138484631323837324A4438304544364434
Memory Module: DIMM Riser A/DIMM 1, 1 GB, DDR2 FB-DIMM, 800 MHz, 0x802C, 0x3138484631323837324A4438304544364434
AirPort: spairport_wireless_card_type_airport_extreme (0x168C, 0x6632), Atheros 9280: 4.0.74.0-P2P
Bluetooth: Version 4.4.6f4, 3 services, 26 devices, 1 incoming serial ports
Network Service: Ethernet 1, Ethernet, en0
Network Service: Wi-Fi, AirPort, en3
Serial ATA Device: WDC WD1600JS-55MHB1, 160,04 GB
Serial ATA Device: WDC WD20EARS-00MVWB0, 2 TB
Serial ATA Device: WDC WD20EARS-00J2GB0, 2 TB
Serial ATA Device: ST3320820AS, 320,07 GB
Parallel ATA Device: HL-DT-ST DVD-ROM GDR-H30N
Parallel ATA Device: OPTIARC DVD RW AD-7170A
USB Device: USB Bus
USB Device: Bluetooth HCI
USB Device: IR Receiver
USB Device: USB Bus
USB Device: USB Bus
USB Device: Hub in Apple Pro Keyboard
USB Device: Apple Optical USB Mouse
USB Device: Apple Pro Keyboard
USB Device: USB Bus
USB Device: USB 2.0 Bus
FireWire Device: built-in_hub, Up to 800 Mb/sec
Thunderbolt Bus:

Last edited by RoLoR; 08-05-2018 at 03:03 PM. Reason: Adjusting title to better description
 
Old 07-29-2018, 07:41 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,297

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
The hardware specs look decent enough for the time . . .certainly better than what I bought as a laptop then. Mind you, I did buy bankrupt stock.

LFS would go, I am sure. Troubles are
1. Getting a host system to compile chapter 5 from. You may have to go to a distro for a base system to compile LFS from. Slackware 13.0 (dating from 2009) sounds about right and is still up for download on my local mirror anyhow
There's several cd isos, and a dvd iso depending on your reader. There's also a 64-bit version, but no multilib, unless they're still on Alien Bob's stuff.

2. Getting drivers for Apple peripherals may be torture.

You could do worse than running with slackware. Keep away from kde & gnome. Xfce, or something low cholesterol. My 2008 laptop took Mint-19.0 without only a few hitches, and Slackware 14.1 with basically no hitches. Some old firmware was dropped from the kernel along the way, and that caused the problems. There's a lot of backward compatibility in Linux. If you look in the 'arch' directory of a kernel source, you'll find kernel support for very underpowered and lame cpus beside yours, things that never got out of the 1980s or 1990s with any style and certainly aren't at today's races with Intel/AMD.
 
Old 07-29-2018, 05:14 PM   #3
RoLoR
Member
 
Registered: Feb 2018
Posts: 60

Original Poster
Rep: Reputation: Disabled
Okay doing a stupid thing and ran version_check.sh on the bash shell on the mac.. it got xcode installed to make that even possible. Lot of work left to get it working further...
sharing the output of chapter 2.2 of the book
Quote:
bash-3.2# bash version-check.sh
bash, version 3.2.57(1)-release
readlink: illegal option -- f
usage: readlink [-n] [file ...]
/bin/sh ->
ERROR: /bin/sh does not point to bash
Binutils: ld: unknown option: --version
bison (GNU Bison) 2.3
yacc is bison (GNU Bison) 2.3
bzip2, Version 1.0.6, 6-Sept-2010.
Coreutils: chown: illegal option -- -
usage: chown [-fhv] [-R [-H | -L | -P]] owner[:group] file ...
chown [-fhv] [-R [-H | -L | -P]] :group file ...
diff (GNU diffutils) 2.8.1
find: illegal option -- -
usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]
find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]
version-check.sh: line 25: gawk: command not found
awk is awk version 20070501
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.38)
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.38)
version-check.sh: line 37: ldd: command not found
grep (BSD grep) 2.5.1-FreeBSD
Apple gzip 251
cat: /proc/version: No such file or directory
GNU M4 1.4.6
GNU Make 3.81
patch 2.5.8
Perl version='5.18.2';
sed: illegal option -- -
usage: sed script [-Ealn] [-i extension] [file ...]
sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
bsdtar 2.8.3 - libarchive 2.8.3
makeinfo (GNU texinfo) 4.8
xz (XZ Utils) 5.2.0
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
g++ compilation OK
bash-3.2#
after a few bottles and waiting for updating xcode got the current state of machine already a lot closer to start building lfs
i'll explain the blocks i put together to get this later. (the bottles have to wear off again) i'm sure for example i added binutils but isn't showing up yet
Quote:
bash-3.2# . version-check.sh
bash, version 3.2.57(1)-release
/bin/sh -> /bin/sh
ERROR: /bin/sh does not point to bash
Binutils: ld: unknown option: --version
bison (GNU Bison) 2.3
yacc is bison (GNU Bison) 2.3
bzip2, Version 1.0.6, 6-Sept-2010.
Coreutils: 8.30
diff (GNU diffutils) 2.8.1
find (GNU findutils) 4.6.0
GNU Awk 4.2.1, API: 2.0 (GNU MPFR 4.0.1, GNU MP 6.1.2)
awk is awk version 20070501
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.38)
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.38)
bash: ldd: command not found
grep (GNU grep) 3.1
Apple gzip 251
cat: /proc/version: No such file or directory
GNU M4 1.4.6
GNU Make 3.81
patch 2.5.8
Perl version='5.18.2';
sed (GNU sed) 4.5
tar (GNU tar) 1.30
makeinfo (GNU texinfo) 4.8
xz (XZ Utils) 5.2.0
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
g++ compilation OK
bash-3.2#

Last edited by RoLoR; 07-29-2018 at 07:53 PM. Reason: Adding new update doing on getting the depend done for building
 
Old 07-30-2018, 01:51 AM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,297

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
You're trying to get the MacOS to build LFS? Brave.

Red Hat distros can't build LFS There is a lot of Unix stuff underlying MacOS.

Be confident in your toolchain (kernel & headers, glibc, GCC) before proceeding. Try chapter 5 & report back You usually know if you can build GCC in chapter 6 and pass tests. That's a big one.
 
Old 07-30-2018, 05:22 PM   #5
RoLoR
Member
 
Registered: Feb 2018
Posts: 60

Original Poster
Rep: Reputation: Disabled
Today taking a shortcut on the mac with gparted i created the following
Quote:
ubuntu@ubuntu:~$ sudo -s
root@ubuntu:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 149.1G 0 disk
├─sda1 8:1 0 200M 0 part /target/boot/efi
├─sda2 8:2 0 148.3G 0 part Macintosh HD holding MacOS
└─sda3 8:3 0 619.9M 0 part Recovery of MacOS
sdb 8:16 0 1.8T 0 disk
└─sdb1 8:17 0 945G 0 part
sdc 8:32 0 1.8T 0 disk
└─sdc1 8:33 0 1.8T 0 part
sdd 8:48 0 298.1G 0 disk
├─sdd1 8:49 0 4G 0 part Recovery partition of Windows
├─sdd2 8:50 0 154.1G 0 part Windows virus os with bootcamp
├─sdd3 8:51 0 1K 0 part
├─sdd5 8:53 0 4G 0 part [SWAP]
├─sdd6 8:54 0 16G 0 part /target Ubuntu root
└─sdd7 8:55 0 16G 0 part Free partition for building LFS
sde 8:64 0 1.8T 0 disk
└─sde1 8:65 0 1.8T 0 part /media/ubuntu/09DC88EB57973571
sdf 8:80 1 14.6G 0 disk
└─sdf1 8:81 1 14.6G 0 part /cdrom
sr0 11:0 1 1024M 0 rom
sr1 11:1 1 1024M 0 rom
loop0 7:0 0 975.9M 1 loop /rofs
root@ubuntu:~#
Of course i can start building of LFS on the just installed linux but that is not fun.
Still have trouble on boot manager.
regarding the drivers i can tell the USB-EFI-boot (by shortcut with holding option-key during post) that WiFi is already functioning and so are the wired-network-connections
 
Old 07-31-2018, 04:15 AM   #6
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,297

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
For you, building with llvm and not gcc, the 'make test' stage of builds is critical. gcc has a make test stage in ch 5 & ch.6 and don't proceed if they're not good.
 
Old 07-31-2018, 05:28 AM   #7
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,574
Blog Entries: 19

Rep: Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452
Looks like your shell is original Bourne! The LFS scripts include some specific bashisms and won't work correctly with a different shell. For example, they don't work with dash.

I notice too that your awk is real awk. LFS requires gawk.

You will have fun trying, but I am dubious about your chances of success.

Maybe you should try CLFS. This allows you to use a PC to create a toolkit that will run on a different architecture. Then you transfer it over and use it for the final build.
 
Old 07-31-2018, 06:30 AM   #8
RoLoR
Member
 
Registered: Feb 2018
Posts: 60

Original Poster
Rep: Reputation: Disabled
A little explaining I致e to make what I知 doing to get the gnu software working inside MacOS. Believe me it痴 a bit dirty but trying to clean the mess during progressing of reaching goal.
The machine was used to learn Ruby, there where Mac ports installed which I disabled.
With Ruby I went to Homebrew
From there I could get all gnu packages needed to go with even gcc-8.2.0 which is ugly enough still ignored.

I知 doubting to first refresh the MacOS (El Capitan) or find the reason why several packages are ignored.
This mac is temporarily pushed aside for a even older G5 which is in need of help to get it through 2018.

Still any intel is welcome. Thanks so far for the feedback
 
Old 07-31-2018, 07:31 AM   #9
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 651
Blog Entries: 135

Rep: Reputation: 188Reputation: 188
I ran a 2009 macbook for a while. It's a fight to get any linux on it. In my own experience, most of the Live CDs I tried failed to even boot! I was never able to get any linux installed. Macs (at least then) had a kludgy mix of UEFI (not bios) with an MBR partition table. This tends to break boot-loaders. I would not even consider attempting LFS on such a machine unless I had already installed an easier linux on that machine. Something like an ubuntu or a slackware.

p.s. Despite running a BLFS system, I'm not an expert, so I could well be wrong. If you do get it to work, most excellent and please post how you did it.

Last edited by jr_bob_dobbs; 07-31-2018 at 07:33 AM.
 
Old 07-31-2018, 08:33 AM   #10
RoLoR
Member
 
Registered: Feb 2018
Posts: 60

Original Poster
Rep: Reputation: Disabled
The information I have around partition-styles in Apple is easy:

GPT used on every intel Mac for making a bootable system
APT used on PowerPC macs (and before Motorola 68K) for making a bootable system (older used blessing of a bootable folder)
MBR used on intel macs for creating bootcamp solutions regarding booting Windows on intel macs

BIOS never exist on a Apple machine all Intels are using EFI but indeed in a very different way then the way used on other PCs.

Above is the theory Apple is telling and indeed there is a messed up version in reality seen on the intel Apple machines.
The investigation on how to let the open firmware boot any Linux is still wide open.
For me refit and refind didn’t worked like they promised on the web

Last edited by RoLoR; 07-31-2018 at 09:11 AM. Reason: Typo
 
Old 07-31-2018, 11:27 AM   #11
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,297

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
From what I see of disk partitions, you have an installed ubuntu. Am I correct?

In post #1, you asked us
Quote:
i know it's an old machine and there are some trouble to overcome but should it be possible to try and invest time into make machine below (Apple Intel MacPro early 2008) making running lfs native?
To summarize, we said 'with great difficulties' or 'NO.'
You also said
Quote:
Of course i can start building of LFS on the just installed linux but that is not fun.
So you have your answer. Mark this solved, go away and have 'fun' as it refuses to do what you want it to. You will hone your expertise on the differences between gnu and MacOS. One of the biggest might be that MacOS is not copyleft or GPL. And when that pukes, just try it with your installed ubuntu before posting.
 
Old 07-31-2018, 12:59 PM   #12
RoLoR
Member
 
Registered: Feb 2018
Posts: 60

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by business_kid View Post
So you have your answer. Mark this solved, go away and have 'fun' as it refuses to do what you want it to. You will hone your expertise on the differences between gnu and MacOS. One of the biggest might be that MacOS is not copyleft or GPL. And when that pukes, just try it with your installed ubuntu before posting.
Above remark just hurt me. @business_kid if you don’t like my thread or where i’m going ignore it please. I never would want to hurt you in any way. Nor would I ever want a war or flame as it’s called on a forum.

I’m trying a rather not out of the box thing, possibly even impossible.

I’m indeed trying to get an environment in macOS where I can make a LFS. macOS doesn’t even know anything of an ext partition. Not without use of commercial software. That was the main thing to go to in this case Ubuntu-live so with gparted I could create a ext partition and do a shadow install of Ubuntu for just in case.

It’s not solved yet,
- still have trouble on boot manager.

In other words if I put grub on the macOS drive it will be detected and removed by macOS as soon as it boots back into that.
Same will happen to refit or refind. Of course the installed Ubuntu would boot as long as you don’t want dual-boot.
In my case I told the install of Ubuntu to install grub on the /dev/sdd in stead of the macOS drive.

Last edited by RoLoR; 07-31-2018 at 01:22 PM. Reason: Forgot to mention the grub
 
Old 08-01-2018, 04:15 AM   #13
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,297

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Well, I'm sorry if it hurt you. It was never my intention to cause offense, just to inject some reality.

When you have failed in building LFS more than once, you become aware of the TINY things that can ruin the integrity of a build, and then looking at the large obstacles blocking your path, there is a real negative feeling about this that comes from nearly every respondent.

IT heads know it's possible, and will see some of the obstacles, but will go about it. They wouldn't ask. Half the obstacles might be unseen, but they'd solve them when they got there. With Ubuntu installed, they wouldn't bother with MacOS. You're really writing another LFS book. Document the process. The LFS guys would love you for that. But you may have to patch things, or change patches. Are you up for that?

You should be able to get gnu stuff working inside MacOS by making a /gnu directory in /, building your gnu environment there so you could even run 'chroot /gnu' and find /gnu/bin/bash, but you may consider that cheating. I would use the Ubuntu build, but you want to use MacOS. So try it. If you retire in defeat, you've learned loads.

And I will unsubscribe from this thread as you suggest. You've talked around it enough; we haven't dissuaded you. So go for it.

It strikes me burning a cdrom or dvd might get you round the boot loader thing. If you confined MacOS to booting off a cdrom, it wouldn't see anything else :-D.
 
Old 08-01-2018, 04:50 AM   #14
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,574
Blog Entries: 19

Rep: Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452
I still think CLFS is the way to go. Here's a link to the architectures you can build for. At least browse it and then decide if this would be cheating.
 
Old 08-01-2018, 10:34 AM   #15
RoLoR
Member
 
Registered: Feb 2018
Posts: 60

Original Poster
Rep: Reputation: Disabled
First @business_kid: I must have read it to much in my own emotion, I forgive and will continue.
覧 start normal stuff 覧

You guys really rock.

Today I went on research for why lubuntu would made an easy dual boot with macOS. They use there yaboot. This is sufficient for the Mac G5 PowerPC that came in between. (l and return for Linux, c for CD-ROM, x for Mac OS X (10.5.8 latest ppc) )
Further I looked into SuSe tumbleweed ppc64 disk, where the PowerPC could be booted by open firmware (command+option+O+F holding during post till screen say release) with grub.
Code:
boot cd:\boot\ppc\grub2-ieee1275\core.elf
Hazel you pointed me sure to a good direction to go for reading. I never had read the CLFS but sure looks like there痴 a lot of what I知 searching of to get a multi boot going on the intel based Mac. I知 gonna read that stuff.

For the trouble of boot management I see 2 promising solutions that will most likely hold more then other stuff on the web.

RoLoR

Last edited by RoLoR; 08-01-2018 at 05:21 PM. Reason: Adding url and correct some typos
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Install non native programs as native Vpcghostlinux elementary OS 2 12-26-2017 02:58 AM
[SOLVED] The way to compile kernel with -mtune=native (or -march=native) kaz2100 Debian 3 08-18-2011 03:45 AM
[SOLVED] LFS 6.7 : $LFS/sources and $LFS/tools folders missing prakashsince92 Linux From Scratch 5 12-09-2010 02:26 PM
LFS newbie stuck in Linux API headers step 5.5 LFS book 6.3 Vxplus Linux From Scratch 2 11-10-2008 08:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 03:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration